OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 // since the omnibox expects the correct element to already be focused when it | 1006 // since the omnibox expects the correct element to already be focused when it |
1007 // is updated. | 1007 // is updated. |
1008 window_->OnActiveTabChanged(old_contents, new_contents, index, reason); | 1008 window_->OnActiveTabChanged(old_contents, new_contents, index, reason); |
1009 | 1009 |
1010 exclusive_access_manager_->OnTabDetachedFromView(old_contents); | 1010 exclusive_access_manager_->OnTabDetachedFromView(old_contents); |
1011 | 1011 |
1012 // Discarded tabs always get reloaded. | 1012 // Discarded tabs always get reloaded. |
1013 // TODO(georgesak): Validate the usefulness of this. And if needed then move | 1013 // TODO(georgesak): Validate the usefulness of this. And if needed then move |
1014 // to TabManager. | 1014 // to TabManager. |
1015 if (g_browser_process->GetTabManager()->IsTabDiscarded(new_contents)) | 1015 if (g_browser_process->GetTabManager()->IsTabDiscarded(new_contents)) |
1016 chrome::Reload(this, CURRENT_TAB); | 1016 chrome::Reload(this, WindowOpenDisposition::CURRENT_TAB); |
1017 | 1017 |
1018 // If we have any update pending, do it now. | 1018 // If we have any update pending, do it now. |
1019 if (chrome_updater_factory_.HasWeakPtrs() && old_contents) | 1019 if (chrome_updater_factory_.HasWeakPtrs() && old_contents) |
1020 ProcessPendingUIUpdates(); | 1020 ProcessPendingUIUpdates(); |
1021 | 1021 |
1022 // Propagate the profile to the location bar. | 1022 // Propagate the profile to the location bar. |
1023 UpdateToolbar((reason & CHANGE_REASON_REPLACED) == 0); | 1023 UpdateToolbar((reason & CHANGE_REASON_REPLACED) == 0); |
1024 | 1024 |
1025 if (search::IsInstantExtendedAPIEnabled()) | 1025 if (search::IsInstantExtendedAPIEnabled()) |
1026 search_delegate_->OnTabActivated(new_contents); | 1026 search_delegate_->OnTabActivated(new_contents); |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE; | 1361 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE; |
1362 if (params.user_gesture) | 1362 if (params.user_gesture) |
1363 nav_params.window_action = chrome::NavigateParams::SHOW_WINDOW; | 1363 nav_params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
1364 nav_params.user_gesture = params.user_gesture; | 1364 nav_params.user_gesture = params.user_gesture; |
1365 | 1365 |
1366 PopupBlockerTabHelper* popup_blocker_helper = NULL; | 1366 PopupBlockerTabHelper* popup_blocker_helper = NULL; |
1367 if (source) | 1367 if (source) |
1368 popup_blocker_helper = PopupBlockerTabHelper::FromWebContents(source); | 1368 popup_blocker_helper = PopupBlockerTabHelper::FromWebContents(source); |
1369 | 1369 |
1370 if (popup_blocker_helper) { | 1370 if (popup_blocker_helper) { |
1371 if ((params.disposition == NEW_POPUP || | 1371 if ((params.disposition == WindowOpenDisposition::NEW_POPUP || |
1372 params.disposition == NEW_FOREGROUND_TAB || | 1372 params.disposition == WindowOpenDisposition::NEW_FOREGROUND_TAB || |
1373 params.disposition == NEW_BACKGROUND_TAB || | 1373 params.disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB || |
1374 params.disposition == NEW_WINDOW) && | 1374 params.disposition == WindowOpenDisposition::NEW_WINDOW) && |
1375 !params.user_gesture && | 1375 !params.user_gesture && |
1376 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 1376 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
1377 switches::kDisablePopupBlocking)) { | 1377 switches::kDisablePopupBlocking)) { |
1378 if (popup_blocker_helper->MaybeBlockPopup(nav_params, | 1378 if (popup_blocker_helper->MaybeBlockPopup(nav_params, |
1379 WebWindowFeatures())) { | 1379 WebWindowFeatures())) { |
1380 return NULL; | 1380 return NULL; |
1381 } | 1381 } |
1382 } | 1382 } |
1383 } | 1383 } |
1384 | 1384 |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1935 #if defined(OS_CHROMEOS) | 1935 #if defined(OS_CHROMEOS) |
1936 const GURL external_url = | 1936 const GURL external_url = |
1937 chromeos::CreateExternalFileURLFromPath(profile_, file_info.file_path); | 1937 chromeos::CreateExternalFileURLFromPath(profile_, file_info.file_path); |
1938 if (!external_url.is_empty()) | 1938 if (!external_url.is_empty()) |
1939 url = external_url; | 1939 url = external_url; |
1940 #endif | 1940 #endif |
1941 | 1941 |
1942 if (url.is_empty()) | 1942 if (url.is_empty()) |
1943 return; | 1943 return; |
1944 | 1944 |
1945 OpenURL(OpenURLParams( | 1945 OpenURL(OpenURLParams(url, Referrer(), WindowOpenDisposition::CURRENT_TAB, |
1946 url, Referrer(), CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false)); | 1946 ui::PAGE_TRANSITION_TYPED, false)); |
1947 } | 1947 } |
1948 | 1948 |
1949 /////////////////////////////////////////////////////////////////////////////// | 1949 /////////////////////////////////////////////////////////////////////////////// |
1950 // Browser, content::NotificationObserver implementation: | 1950 // Browser, content::NotificationObserver implementation: |
1951 | 1951 |
1952 void Browser::Observe(int type, | 1952 void Browser::Observe(int type, |
1953 const content::NotificationSource& source, | 1953 const content::NotificationSource& source, |
1954 const content::NotificationDetails& details) { | 1954 const content::NotificationDetails& details) { |
1955 switch (type) { | 1955 switch (type) { |
1956 case extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { | 1956 case extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2564 if (contents && !allow_js_access) { | 2564 if (contents && !allow_js_access) { |
2565 contents->web_contents()->GetController().LoadURL( | 2565 contents->web_contents()->GetController().LoadURL( |
2566 target_url, | 2566 target_url, |
2567 content::Referrer(), | 2567 content::Referrer(), |
2568 ui::PAGE_TRANSITION_LINK, | 2568 ui::PAGE_TRANSITION_LINK, |
2569 std::string()); // No extra headers. | 2569 std::string()); // No extra headers. |
2570 } | 2570 } |
2571 | 2571 |
2572 return contents != NULL; | 2572 return contents != NULL; |
2573 } | 2573 } |
OLD | NEW |