| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 #include "chrome/browser/ui/browser_navigator.h" | 105 #include "chrome/browser/ui/browser_navigator.h" |
| 106 #include "chrome/browser/ui/browser_tab_contents.h" | 106 #include "chrome/browser/ui/browser_tab_contents.h" |
| 107 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" | 107 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" |
| 108 #include "chrome/browser/ui/browser_tab_strip_model_delegate.h" | 108 #include "chrome/browser/ui/browser_tab_strip_model_delegate.h" |
| 109 #include "chrome/browser/ui/browser_tabstrip.h" | 109 #include "chrome/browser/ui/browser_tabstrip.h" |
| 110 #include "chrome/browser/ui/browser_toolbar_model_delegate.h" | 110 #include "chrome/browser/ui/browser_toolbar_model_delegate.h" |
| 111 #include "chrome/browser/ui/browser_ui_prefs.h" | 111 #include "chrome/browser/ui/browser_ui_prefs.h" |
| 112 #include "chrome/browser/ui/browser_window.h" | 112 #include "chrome/browser/ui/browser_window.h" |
| 113 #include "chrome/browser/ui/chrome_pages.h" | 113 #include "chrome/browser/ui/chrome_pages.h" |
| 114 #include "chrome/browser/ui/chrome_select_file_policy.h" | 114 #include "chrome/browser/ui/chrome_select_file_policy.h" |
| 115 #include "chrome/browser/ui/constrained_window_tab_helper.h" | |
| 116 #include "chrome/browser/ui/extensions/shell_window.h" | 115 #include "chrome/browser/ui/extensions/shell_window.h" |
| 117 #include "chrome/browser/ui/find_bar/find_bar.h" | 116 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 118 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 117 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 119 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 118 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 120 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 119 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
| 121 #include "chrome/browser/ui/global_error/global_error.h" | 120 #include "chrome/browser/ui/global_error/global_error.h" |
| 122 #include "chrome/browser/ui/global_error/global_error_service.h" | 121 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 123 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 122 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 124 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" | 123 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" |
| 125 #include "chrome/browser/ui/media_stream_infobar_delegate.h" | 124 #include "chrome/browser/ui/media_stream_infobar_delegate.h" |
| 126 #include "chrome/browser/ui/omnibox/location_bar.h" | 125 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 127 #include "chrome/browser/ui/search/search.h" | 126 #include "chrome/browser/ui/search/search.h" |
| 128 #include "chrome/browser/ui/search/search_delegate.h" | 127 #include "chrome/browser/ui/search/search_delegate.h" |
| 129 #include "chrome/browser/ui/search/search_model.h" | 128 #include "chrome/browser/ui/search/search_model.h" |
| 130 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" | 129 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" |
| 131 #include "chrome/browser/ui/singleton_tabs.h" | 130 #include "chrome/browser/ui/singleton_tabs.h" |
| 132 #include "chrome/browser/ui/status_bubble.h" | 131 #include "chrome/browser/ui/status_bubble.h" |
| 133 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" | 132 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" |
| 134 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 133 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 135 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 134 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
| 136 #include "chrome/browser/ui/tabs/dock_info.h" | 135 #include "chrome/browser/ui/tabs/dock_info.h" |
| 137 #include "chrome/browser/ui/tabs/tab_menu_model.h" | 136 #include "chrome/browser/ui/tabs/tab_menu_model.h" |
| 138 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 137 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 139 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" | 138 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" |
| 140 #include "chrome/browser/ui/unload_controller.h" | 139 #include "chrome/browser/ui/unload_controller.h" |
| 141 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 140 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
| 141 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" |
| 142 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 142 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 143 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 143 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 144 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 144 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
| 145 #include "chrome/browser/ui/zoom/zoom_controller.h" | 145 #include "chrome/browser/ui/zoom/zoom_controller.h" |
| 146 #include "chrome/browser/upgrade_detector.h" | 146 #include "chrome/browser/upgrade_detector.h" |
| 147 #include "chrome/browser/web_applications/web_app.h" | 147 #include "chrome/browser/web_applications/web_app.h" |
| 148 #include "chrome/common/chrome_constants.h" | 148 #include "chrome/common/chrome_constants.h" |
| 149 #include "chrome/common/chrome_notification_types.h" | 149 #include "chrome/common/chrome_notification_types.h" |
| 150 #include "chrome/common/chrome_switches.h" | 150 #include "chrome/common/chrome_switches.h" |
| 151 #include "chrome/common/custom_handlers/protocol_handler.h" | 151 #include "chrome/common/custom_handlers/protocol_handler.h" |
| (...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1823 | 1823 |
| 1824 /////////////////////////////////////////////////////////////////////////////// | 1824 /////////////////////////////////////////////////////////////////////////////// |
| 1825 // Browser, SearchEngineTabHelperDelegate implementation: | 1825 // Browser, SearchEngineTabHelperDelegate implementation: |
| 1826 | 1826 |
| 1827 void Browser::ConfirmAddSearchProvider(TemplateURL* template_url, | 1827 void Browser::ConfirmAddSearchProvider(TemplateURL* template_url, |
| 1828 Profile* profile) { | 1828 Profile* profile) { |
| 1829 window()->ConfirmAddSearchProvider(template_url, profile); | 1829 window()->ConfirmAddSearchProvider(template_url, profile); |
| 1830 } | 1830 } |
| 1831 | 1831 |
| 1832 /////////////////////////////////////////////////////////////////////////////// | 1832 /////////////////////////////////////////////////////////////////////////////// |
| 1833 // Browser, ConstrainedWindowTabHelperDelegate implementation: | 1833 // Browser, WebContentsModalDialogManagerDelegate implementation: |
| 1834 | 1834 |
| 1835 void Browser::SetTabContentBlocked(content::WebContents* web_contents, | 1835 void Browser::SetWebContentsBlocked(content::WebContents* web_contents, |
| 1836 bool blocked) { | 1836 bool blocked) { |
| 1837 int index = tab_strip_model_->GetIndexOfWebContents(web_contents); | 1837 int index = tab_strip_model_->GetIndexOfWebContents(web_contents); |
| 1838 if (index == TabStripModel::kNoTab) { | 1838 if (index == TabStripModel::kNoTab) { |
| 1839 NOTREACHED(); | 1839 NOTREACHED(); |
| 1840 return; | 1840 return; |
| 1841 } | 1841 } |
| 1842 tab_strip_model_->SetTabBlocked(index, blocked); | 1842 tab_strip_model_->SetTabBlocked(index, blocked); |
| 1843 if (!blocked && tab_strip_model_->GetActiveWebContents() == web_contents) | 1843 if (!blocked && tab_strip_model_->GetActiveWebContents() == web_contents) |
| 1844 web_contents->Focus(); | 1844 web_contents->Focus(); |
| 1845 } | 1845 } |
| 1846 | 1846 |
| 1847 bool Browser::GetConstrainedWindowTopCenter(gfx::Point* point) { | 1847 bool Browser::GetDialogTopCenter(gfx::Point* point) { |
| 1848 int y = 0; | 1848 int y = 0; |
| 1849 if (window_->GetConstrainedWindowTopY(&y)) { | 1849 if (window_->GetConstrainedWindowTopY(&y)) { |
| 1850 *point = gfx::Point(window_->GetBounds().width() / 2, y); | 1850 *point = gfx::Point(window_->GetBounds().width() / 2, y); |
| 1851 return true; | 1851 return true; |
| 1852 } | 1852 } |
| 1853 | 1853 |
| 1854 return false; | 1854 return false; |
| 1855 } | 1855 } |
| 1856 | 1856 |
| 1857 /////////////////////////////////////////////////////////////////////////////// | 1857 /////////////////////////////////////////////////////////////////////////////// |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2230 // Browser, Assorted utility functions (private): | 2230 // Browser, Assorted utility functions (private): |
| 2231 | 2231 |
| 2232 void Browser::SetAsDelegate(WebContents* web_contents, Browser* delegate) { | 2232 void Browser::SetAsDelegate(WebContents* web_contents, Browser* delegate) { |
| 2233 // WebContents... | 2233 // WebContents... |
| 2234 web_contents->SetDelegate(delegate); | 2234 web_contents->SetDelegate(delegate); |
| 2235 | 2235 |
| 2236 // ...and all the helpers. | 2236 // ...and all the helpers. |
| 2237 BlockedContentTabHelper::FromWebContents(web_contents)-> | 2237 BlockedContentTabHelper::FromWebContents(web_contents)-> |
| 2238 set_delegate(delegate); | 2238 set_delegate(delegate); |
| 2239 BookmarkTabHelper::FromWebContents(web_contents)->set_delegate(delegate); | 2239 BookmarkTabHelper::FromWebContents(web_contents)->set_delegate(delegate); |
| 2240 ConstrainedWindowTabHelper::FromWebContents(web_contents)-> | 2240 WebContentsModalDialogManager::FromWebContents(web_contents)-> |
| 2241 set_delegate(delegate); | 2241 set_delegate(delegate); |
| 2242 CoreTabHelper::FromWebContents(web_contents)->set_delegate(delegate); | 2242 CoreTabHelper::FromWebContents(web_contents)->set_delegate(delegate); |
| 2243 SearchEngineTabHelper::FromWebContents(web_contents)->set_delegate(delegate); | 2243 SearchEngineTabHelper::FromWebContents(web_contents)->set_delegate(delegate); |
| 2244 ZoomController::FromWebContents(web_contents)->set_observer(delegate); | 2244 ZoomController::FromWebContents(web_contents)->set_observer(delegate); |
| 2245 } | 2245 } |
| 2246 | 2246 |
| 2247 void Browser::CloseFrame() { | 2247 void Browser::CloseFrame() { |
| 2248 window_->Close(); | 2248 window_->Close(); |
| 2249 } | 2249 } |
| 2250 | 2250 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2441 if (contents && !allow_js_access) { | 2441 if (contents && !allow_js_access) { |
| 2442 contents->web_contents()->GetController().LoadURL( | 2442 contents->web_contents()->GetController().LoadURL( |
| 2443 target_url, | 2443 target_url, |
| 2444 content::Referrer(), | 2444 content::Referrer(), |
| 2445 content::PAGE_TRANSITION_LINK, | 2445 content::PAGE_TRANSITION_LINK, |
| 2446 std::string()); // No extra headers. | 2446 std::string()); // No extra headers. |
| 2447 } | 2447 } |
| 2448 | 2448 |
| 2449 return contents != NULL; | 2449 return contents != NULL; |
| 2450 } | 2450 } |
| OLD | NEW |