| 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 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 // since the omnibox expects the correct element to already be focused when it | 1042 // since the omnibox expects the correct element to already be focused when it |
| 1043 // is updated. | 1043 // is updated. |
| 1044 window_->OnActiveTabChanged(old_contents, new_contents, index, reason); | 1044 window_->OnActiveTabChanged(old_contents, new_contents, index, reason); |
| 1045 | 1045 |
| 1046 exclusive_access_manager_->OnTabDetachedFromView(old_contents); | 1046 exclusive_access_manager_->OnTabDetachedFromView(old_contents); |
| 1047 | 1047 |
| 1048 // Discarded tabs always get reloaded. | 1048 // Discarded tabs always get reloaded. |
| 1049 // TODO(georgesak): Validate the usefulness of this. And if needed then move | 1049 // TODO(georgesak): Validate the usefulness of this. And if needed then move |
| 1050 // to TabManager. | 1050 // to TabManager. |
| 1051 if (g_browser_process->GetTabManager()->IsTabDiscarded(new_contents)) | 1051 if (g_browser_process->GetTabManager()->IsTabDiscarded(new_contents)) |
| 1052 chrome::Reload(this, CURRENT_TAB); | 1052 chrome::Reload(this, WindowOpenDisposition::CURRENT_TAB); |
| 1053 | 1053 |
| 1054 // If we have any update pending, do it now. | 1054 // If we have any update pending, do it now. |
| 1055 if (chrome_updater_factory_.HasWeakPtrs() && old_contents) | 1055 if (chrome_updater_factory_.HasWeakPtrs() && old_contents) |
| 1056 ProcessPendingUIUpdates(); | 1056 ProcessPendingUIUpdates(); |
| 1057 | 1057 |
| 1058 // Propagate the profile to the location bar. | 1058 // Propagate the profile to the location bar. |
| 1059 UpdateToolbar((reason & CHANGE_REASON_REPLACED) == 0); | 1059 UpdateToolbar((reason & CHANGE_REASON_REPLACED) == 0); |
| 1060 | 1060 |
| 1061 if (search::IsInstantExtendedAPIEnabled()) | 1061 if (search::IsInstantExtendedAPIEnabled()) |
| 1062 search_delegate_->OnTabActivated(new_contents); | 1062 search_delegate_->OnTabActivated(new_contents); |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE; | 1397 nav_params.tabstrip_add_types = TabStripModel::ADD_NONE; |
| 1398 if (params.user_gesture) | 1398 if (params.user_gesture) |
| 1399 nav_params.window_action = chrome::NavigateParams::SHOW_WINDOW; | 1399 nav_params.window_action = chrome::NavigateParams::SHOW_WINDOW; |
| 1400 nav_params.user_gesture = params.user_gesture; | 1400 nav_params.user_gesture = params.user_gesture; |
| 1401 | 1401 |
| 1402 PopupBlockerTabHelper* popup_blocker_helper = NULL; | 1402 PopupBlockerTabHelper* popup_blocker_helper = NULL; |
| 1403 if (source) | 1403 if (source) |
| 1404 popup_blocker_helper = PopupBlockerTabHelper::FromWebContents(source); | 1404 popup_blocker_helper = PopupBlockerTabHelper::FromWebContents(source); |
| 1405 | 1405 |
| 1406 if (popup_blocker_helper) { | 1406 if (popup_blocker_helper) { |
| 1407 if ((params.disposition == NEW_POPUP || | 1407 if ((params.disposition == WindowOpenDisposition::NEW_POPUP || |
| 1408 params.disposition == NEW_FOREGROUND_TAB || | 1408 params.disposition == WindowOpenDisposition::NEW_FOREGROUND_TAB || |
| 1409 params.disposition == NEW_BACKGROUND_TAB || | 1409 params.disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB || |
| 1410 params.disposition == NEW_WINDOW) && | 1410 params.disposition == WindowOpenDisposition::NEW_WINDOW) && |
| 1411 !params.user_gesture && | 1411 !params.user_gesture && |
| 1412 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 1412 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 1413 switches::kDisablePopupBlocking)) { | 1413 switches::kDisablePopupBlocking)) { |
| 1414 if (popup_blocker_helper->MaybeBlockPopup(nav_params, | 1414 if (popup_blocker_helper->MaybeBlockPopup(nav_params, |
| 1415 WebWindowFeatures())) { | 1415 WebWindowFeatures())) { |
| 1416 return NULL; | 1416 return NULL; |
| 1417 } | 1417 } |
| 1418 } | 1418 } |
| 1419 } | 1419 } |
| 1420 | 1420 |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1971 #if defined(OS_CHROMEOS) | 1971 #if defined(OS_CHROMEOS) |
| 1972 const GURL external_url = | 1972 const GURL external_url = |
| 1973 chromeos::CreateExternalFileURLFromPath(profile_, file_info.file_path); | 1973 chromeos::CreateExternalFileURLFromPath(profile_, file_info.file_path); |
| 1974 if (!external_url.is_empty()) | 1974 if (!external_url.is_empty()) |
| 1975 url = external_url; | 1975 url = external_url; |
| 1976 #endif | 1976 #endif |
| 1977 | 1977 |
| 1978 if (url.is_empty()) | 1978 if (url.is_empty()) |
| 1979 return; | 1979 return; |
| 1980 | 1980 |
| 1981 OpenURL(OpenURLParams( | 1981 OpenURL(OpenURLParams(url, Referrer(), WindowOpenDisposition::CURRENT_TAB, |
| 1982 url, Referrer(), CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false)); | 1982 ui::PAGE_TRANSITION_TYPED, false)); |
| 1983 } | 1983 } |
| 1984 | 1984 |
| 1985 /////////////////////////////////////////////////////////////////////////////// | 1985 /////////////////////////////////////////////////////////////////////////////// |
| 1986 // Browser, content::NotificationObserver implementation: | 1986 // Browser, content::NotificationObserver implementation: |
| 1987 | 1987 |
| 1988 void Browser::Observe(int type, | 1988 void Browser::Observe(int type, |
| 1989 const content::NotificationSource& source, | 1989 const content::NotificationSource& source, |
| 1990 const content::NotificationDetails& details) { | 1990 const content::NotificationDetails& details) { |
| 1991 switch (type) { | 1991 switch (type) { |
| 1992 case extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { | 1992 case extensions::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: { |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2600 if (contents && !allow_js_access) { | 2600 if (contents && !allow_js_access) { |
| 2601 contents->web_contents()->GetController().LoadURL( | 2601 contents->web_contents()->GetController().LoadURL( |
| 2602 target_url, | 2602 target_url, |
| 2603 content::Referrer(), | 2603 content::Referrer(), |
| 2604 ui::PAGE_TRANSITION_LINK, | 2604 ui::PAGE_TRANSITION_LINK, |
| 2605 std::string()); // No extra headers. | 2605 std::string()); // No extra headers. |
| 2606 } | 2606 } |
| 2607 | 2607 |
| 2608 return contents != NULL; | 2608 return contents != NULL; |
| 2609 } | 2609 } |
| OLD | NEW |