| 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 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1769 // Browser, ZoomObserver implementation: | 1770 // Browser, ZoomObserver implementation: |
| 1770 | 1771 |
| 1771 void Browser::OnZoomChanged(content::WebContents* source, | 1772 void Browser::OnZoomChanged(content::WebContents* source, |
| 1772 bool can_show_bubble) { | 1773 bool can_show_bubble) { |
| 1773 if (source == tab_strip_model_->GetActiveWebContents()) { | 1774 if (source == tab_strip_model_->GetActiveWebContents()) { |
| 1774 // Only show the zoom bubble for zoom changes in the active window. | 1775 // Only show the zoom bubble for zoom changes in the active window. |
| 1775 window_->ZoomChangedForActiveTab(can_show_bubble && window_->IsActive()); | 1776 window_->ZoomChangedForActiveTab(can_show_bubble && window_->IsActive()); |
| 1776 } | 1777 } |
| 1777 } | 1778 } |
| 1778 | 1779 |
| 1780 void Browser::OnIsTranslateSuggestedChanged(content::WebContents* source) { |
| 1781 if (source == tab_strip_model_->GetActiveWebContents()) |
| 1782 window_->UpdateToolbar(source); |
| 1783 } |
| 1784 |
| 1779 /////////////////////////////////////////////////////////////////////////////// | 1785 /////////////////////////////////////////////////////////////////////////////// |
| 1780 // Browser, ui::SelectFileDialog::Listener implementation: | 1786 // Browser, ui::SelectFileDialog::Listener implementation: |
| 1781 | 1787 |
| 1782 void Browser::FileSelected(const base::FilePath& path, int index, | 1788 void Browser::FileSelected(const base::FilePath& path, int index, |
| 1783 void* params) { | 1789 void* params) { |
| 1784 FileSelectedWithExtraInfo(ui::SelectedFileInfo(path, path), index, params); | 1790 FileSelectedWithExtraInfo(ui::SelectedFileInfo(path, path), index, params); |
| 1785 } | 1791 } |
| 1786 | 1792 |
| 1787 void Browser::FileSelectedWithExtraInfo(const ui::SelectedFileInfo& file_info, | 1793 void Browser::FileSelectedWithExtraInfo(const ui::SelectedFileInfo& file_info, |
| 1788 int index, | 1794 int index, |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2097 // WebContents... | 2103 // WebContents... |
| 2098 web_contents->SetDelegate(delegate); | 2104 web_contents->SetDelegate(delegate); |
| 2099 | 2105 |
| 2100 // ...and all the helpers. | 2106 // ...and all the helpers. |
| 2101 BookmarkTabHelper::FromWebContents(web_contents)->set_delegate(delegate); | 2107 BookmarkTabHelper::FromWebContents(web_contents)->set_delegate(delegate); |
| 2102 WebContentsModalDialogManager::FromWebContents(web_contents)-> | 2108 WebContentsModalDialogManager::FromWebContents(web_contents)-> |
| 2103 SetDelegate(delegate); | 2109 SetDelegate(delegate); |
| 2104 CoreTabHelper::FromWebContents(web_contents)->set_delegate(delegate); | 2110 CoreTabHelper::FromWebContents(web_contents)->set_delegate(delegate); |
| 2105 SearchEngineTabHelper::FromWebContents(web_contents)->set_delegate(delegate); | 2111 SearchEngineTabHelper::FromWebContents(web_contents)->set_delegate(delegate); |
| 2106 ZoomController::FromWebContents(web_contents)->set_observer(delegate); | 2112 ZoomController::FromWebContents(web_contents)->set_observer(delegate); |
| 2113 TranslateTabHelper* translate_tab_helper = |
| 2114 TranslateTabHelper::FromWebContents(web_contents); |
| 2115 translate_tab_helper->language_state().set_observer(delegate); |
| 2107 } | 2116 } |
| 2108 | 2117 |
| 2109 void Browser::CloseFrame() { | 2118 void Browser::CloseFrame() { |
| 2110 window_->Close(); | 2119 window_->Close(); |
| 2111 } | 2120 } |
| 2112 | 2121 |
| 2113 void Browser::TabDetachedAtImpl(content::WebContents* contents, | 2122 void Browser::TabDetachedAtImpl(content::WebContents* contents, |
| 2114 int index, | 2123 int index, |
| 2115 DetachType type) { | 2124 DetachType type) { |
| 2116 if (type == DETACH_TYPE_DETACH) { | 2125 if (type == DETACH_TYPE_DETACH) { |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2295 if (contents && !allow_js_access) { | 2304 if (contents && !allow_js_access) { |
| 2296 contents->web_contents()->GetController().LoadURL( | 2305 contents->web_contents()->GetController().LoadURL( |
| 2297 target_url, | 2306 target_url, |
| 2298 content::Referrer(), | 2307 content::Referrer(), |
| 2299 content::PAGE_TRANSITION_LINK, | 2308 content::PAGE_TRANSITION_LINK, |
| 2300 std::string()); // No extra headers. | 2309 std::string()); // No extra headers. |
| 2301 } | 2310 } |
| 2302 | 2311 |
| 2303 return contents != NULL; | 2312 return contents != NULL; |
| 2304 } | 2313 } |
| OLD | NEW |