| 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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 #endif // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 #include "chrome/browser/sessions/tab_restore_service.h" | 78 #include "chrome/browser/sessions/tab_restore_service.h" |
| 79 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 79 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 80 #include "chrome/browser/sync/profile_sync_service.h" | 80 #include "chrome/browser/sync/profile_sync_service.h" |
| 81 #include "chrome/browser/sync/profile_sync_service_factory.h" | 81 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 82 #include "chrome/browser/sync/sync_ui_util.h" | 82 #include "chrome/browser/sync/sync_ui_util.h" |
| 83 #include "chrome/browser/tab_contents/background_contents.h" | 83 #include "chrome/browser/tab_contents/background_contents.h" |
| 84 #include "chrome/browser/tab_contents/retargeting_details.h" | 84 #include "chrome/browser/tab_contents/retargeting_details.h" |
| 85 #include "chrome/browser/tab_contents/tab_util.h" | 85 #include "chrome/browser/tab_contents/tab_util.h" |
| 86 #include "chrome/browser/themes/theme_service.h" | 86 #include "chrome/browser/themes/theme_service.h" |
| 87 #include "chrome/browser/themes/theme_service_factory.h" | 87 #include "chrome/browser/themes/theme_service_factory.h" |
| 88 #include "chrome/browser/translate/translate_tab_helper.h" |
| 88 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.h" | 89 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.h" |
| 89 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h" | 90 #include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h" |
| 90 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | 91 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
| 91 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 92 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 92 #include "chrome/browser/ui/browser_command_controller.h" | 93 #include "chrome/browser/ui/browser_command_controller.h" |
| 93 #include "chrome/browser/ui/browser_commands.h" | 94 #include "chrome/browser/ui/browser_commands.h" |
| 94 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" | 95 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" |
| 95 #include "chrome/browser/ui/browser_dialogs.h" | 96 #include "chrome/browser/ui/browser_dialogs.h" |
| 96 #include "chrome/browser/ui/browser_finder.h" | 97 #include "chrome/browser/ui/browser_finder.h" |
| 97 #include "chrome/browser/ui/browser_instant_controller.h" | 98 #include "chrome/browser/ui/browser_instant_controller.h" |
| (...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1752 // Browser, ZoomObserver implementation: | 1753 // Browser, ZoomObserver implementation: |
| 1753 | 1754 |
| 1754 void Browser::OnZoomChanged(content::WebContents* source, | 1755 void Browser::OnZoomChanged(content::WebContents* source, |
| 1755 bool can_show_bubble) { | 1756 bool can_show_bubble) { |
| 1756 if (source == tab_strip_model_->GetActiveWebContents()) { | 1757 if (source == tab_strip_model_->GetActiveWebContents()) { |
| 1757 // Only show the zoom bubble for zoom changes in the active window. | 1758 // Only show the zoom bubble for zoom changes in the active window. |
| 1758 window_->ZoomChangedForActiveTab(can_show_bubble && window_->IsActive()); | 1759 window_->ZoomChangedForActiveTab(can_show_bubble && window_->IsActive()); |
| 1759 } | 1760 } |
| 1760 } | 1761 } |
| 1761 | 1762 |
| 1763 void Browser::OnTranslateEnabledChanged(content::WebContents* source) { |
| 1764 if (source == tab_strip_model_->GetActiveWebContents()) |
| 1765 window_->UpdateToolbar(source); |
| 1766 } |
| 1767 |
| 1762 /////////////////////////////////////////////////////////////////////////////// | 1768 /////////////////////////////////////////////////////////////////////////////// |
| 1763 // Browser, ui::SelectFileDialog::Listener implementation: | 1769 // Browser, ui::SelectFileDialog::Listener implementation: |
| 1764 | 1770 |
| 1765 void Browser::FileSelected(const base::FilePath& path, int index, | 1771 void Browser::FileSelected(const base::FilePath& path, int index, |
| 1766 void* params) { | 1772 void* params) { |
| 1767 FileSelectedWithExtraInfo(ui::SelectedFileInfo(path, path), index, params); | 1773 FileSelectedWithExtraInfo(ui::SelectedFileInfo(path, path), index, params); |
| 1768 } | 1774 } |
| 1769 | 1775 |
| 1770 void Browser::FileSelectedWithExtraInfo(const ui::SelectedFileInfo& file_info, | 1776 void Browser::FileSelectedWithExtraInfo(const ui::SelectedFileInfo& file_info, |
| 1771 int index, | 1777 int index, |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2080 // WebContents... | 2086 // WebContents... |
| 2081 web_contents->SetDelegate(delegate); | 2087 web_contents->SetDelegate(delegate); |
| 2082 | 2088 |
| 2083 // ...and all the helpers. | 2089 // ...and all the helpers. |
| 2084 BookmarkTabHelper::FromWebContents(web_contents)->set_delegate(delegate); | 2090 BookmarkTabHelper::FromWebContents(web_contents)->set_delegate(delegate); |
| 2085 WebContentsModalDialogManager::FromWebContents(web_contents)-> | 2091 WebContentsModalDialogManager::FromWebContents(web_contents)-> |
| 2086 SetDelegate(delegate); | 2092 SetDelegate(delegate); |
| 2087 CoreTabHelper::FromWebContents(web_contents)->set_delegate(delegate); | 2093 CoreTabHelper::FromWebContents(web_contents)->set_delegate(delegate); |
| 2088 SearchEngineTabHelper::FromWebContents(web_contents)->set_delegate(delegate); | 2094 SearchEngineTabHelper::FromWebContents(web_contents)->set_delegate(delegate); |
| 2089 ZoomController::FromWebContents(web_contents)->set_observer(delegate); | 2095 ZoomController::FromWebContents(web_contents)->set_observer(delegate); |
| 2096 TranslateTabHelper* translate_tab_helper = |
| 2097 TranslateTabHelper::FromWebContents(web_contents); |
| 2098 translate_tab_helper->language_state().set_observer(delegate); |
| 2090 } | 2099 } |
| 2091 | 2100 |
| 2092 void Browser::CloseFrame() { | 2101 void Browser::CloseFrame() { |
| 2093 window_->Close(); | 2102 window_->Close(); |
| 2094 } | 2103 } |
| 2095 | 2104 |
| 2096 void Browser::TabDetachedAtImpl(content::WebContents* contents, | 2105 void Browser::TabDetachedAtImpl(content::WebContents* contents, |
| 2097 int index, | 2106 int index, |
| 2098 DetachType type) { | 2107 DetachType type) { |
| 2099 if (type == DETACH_TYPE_DETACH) { | 2108 if (type == DETACH_TYPE_DETACH) { |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2279 if (contents && !allow_js_access) { | 2288 if (contents && !allow_js_access) { |
| 2280 contents->web_contents()->GetController().LoadURL( | 2289 contents->web_contents()->GetController().LoadURL( |
| 2281 target_url, | 2290 target_url, |
| 2282 content::Referrer(), | 2291 content::Referrer(), |
| 2283 content::PAGE_TRANSITION_LINK, | 2292 content::PAGE_TRANSITION_LINK, |
| 2284 std::string()); // No extra headers. | 2293 std::string()); // No extra headers. |
| 2285 } | 2294 } |
| 2286 | 2295 |
| 2287 return contents != NULL; | 2296 return contents != NULL; |
| 2288 } | 2297 } |
| OLD | NEW |