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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 #include "chrome/browser/ui/status_bubble.h" | 124 #include "chrome/browser/ui/status_bubble.h" |
125 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" | 125 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" |
126 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 126 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
127 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 127 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
128 #include "chrome/browser/ui/tabs/dock_info.h" | 128 #include "chrome/browser/ui/tabs/dock_info.h" |
129 #include "chrome/browser/ui/tabs/tab_menu_model.h" | 129 #include "chrome/browser/ui/tabs/tab_menu_model.h" |
130 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 130 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
131 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" | 131 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" |
132 #include "chrome/browser/ui/unload_controller.h" | 132 #include "chrome/browser/ui/unload_controller.h" |
133 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 133 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
134 #include "chrome/browser/ui/web_contents_modal_dialog_manager.h" | |
135 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 134 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
136 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 135 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
137 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 136 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
138 #include "chrome/browser/ui/zoom/zoom_controller.h" | 137 #include "chrome/browser/ui/zoom/zoom_controller.h" |
139 #include "chrome/browser/upgrade_detector.h" | 138 #include "chrome/browser/upgrade_detector.h" |
140 #include "chrome/browser/web_applications/web_app.h" | 139 #include "chrome/browser/web_applications/web_app.h" |
141 #include "chrome/common/chrome_constants.h" | 140 #include "chrome/common/chrome_constants.h" |
142 #include "chrome/common/chrome_notification_types.h" | 141 #include "chrome/common/chrome_notification_types.h" |
143 #include "chrome/common/chrome_switches.h" | 142 #include "chrome/common/chrome_switches.h" |
144 #include "chrome/common/custom_handlers/protocol_handler.h" | 143 #include "chrome/common/custom_handlers/protocol_handler.h" |
145 #include "chrome/common/extensions/background_info.h" | 144 #include "chrome/common/extensions/background_info.h" |
146 #include "chrome/common/extensions/extension.h" | 145 #include "chrome/common/extensions/extension.h" |
147 #include "chrome/common/extensions/extension_constants.h" | 146 #include "chrome/common/extensions/extension_constants.h" |
148 #include "chrome/common/pref_names.h" | 147 #include "chrome/common/pref_names.h" |
149 #include "chrome/common/profiling.h" | 148 #include "chrome/common/profiling.h" |
150 #include "chrome/common/search_types.h" | 149 #include "chrome/common/search_types.h" |
151 #include "chrome/common/startup_metric_utils.h" | 150 #include "chrome/common/startup_metric_utils.h" |
152 #include "chrome/common/url_constants.h" | 151 #include "chrome/common/url_constants.h" |
153 #include "chrome/common/web_apps.h" | 152 #include "chrome/common/web_apps.h" |
| 153 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
154 #include "content/public/browser/color_chooser.h" | 154 #include "content/public/browser/color_chooser.h" |
155 #include "content/public/browser/devtools_manager.h" | 155 #include "content/public/browser/devtools_manager.h" |
156 #include "content/public/browser/download_item.h" | 156 #include "content/public/browser/download_item.h" |
157 #include "content/public/browser/download_manager.h" | 157 #include "content/public/browser/download_manager.h" |
158 #include "content/public/browser/interstitial_page.h" | 158 #include "content/public/browser/interstitial_page.h" |
159 #include "content/public/browser/invalidate_type.h" | 159 #include "content/public/browser/invalidate_type.h" |
160 #include "content/public/browser/navigation_controller.h" | 160 #include "content/public/browser/navigation_controller.h" |
161 #include "content/public/browser/navigation_entry.h" | 161 #include "content/public/browser/navigation_entry.h" |
162 #include "content/public/browser/notification_details.h" | 162 #include "content/public/browser/notification_details.h" |
163 #include "content/public/browser/notification_service.h" | 163 #include "content/public/browser/notification_service.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 using content::NavigationController; | 212 using content::NavigationController; |
213 using content::NavigationEntry; | 213 using content::NavigationEntry; |
214 using content::OpenURLParams; | 214 using content::OpenURLParams; |
215 using content::PluginService; | 215 using content::PluginService; |
216 using content::Referrer; | 216 using content::Referrer; |
217 using content::SiteInstance; | 217 using content::SiteInstance; |
218 using content::UserMetricsAction; | 218 using content::UserMetricsAction; |
219 using content::WebContents; | 219 using content::WebContents; |
220 using extensions::Extension; | 220 using extensions::Extension; |
221 using ui::WebDialogDelegate; | 221 using ui::WebDialogDelegate; |
| 222 using web_modal::WebContentsModalDialogManager; |
222 | 223 |
223 /////////////////////////////////////////////////////////////////////////////// | 224 /////////////////////////////////////////////////////////////////////////////// |
224 | 225 |
225 namespace { | 226 namespace { |
226 | 227 |
227 // The URL to be loaded to display the "Report a broken page" form. | 228 // The URL to be loaded to display the "Report a broken page" form. |
228 const char kBrokenPageUrl[] = | 229 const char kBrokenPageUrl[] = |
229 "https://www.google.com/support/chrome/bin/request.py?contact_type=" | 230 "https://www.google.com/support/chrome/bin/request.py?contact_type=" |
230 "broken_website&format=inproduct&p.page_title=$1&p.page_url=$2"; | 231 "broken_website&format=inproduct&p.page_title=$1&p.page_url=$2"; |
231 | 232 |
(...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 | 1669 |
1669 /////////////////////////////////////////////////////////////////////////////// | 1670 /////////////////////////////////////////////////////////////////////////////// |
1670 // Browser, SearchEngineTabHelperDelegate implementation: | 1671 // Browser, SearchEngineTabHelperDelegate implementation: |
1671 | 1672 |
1672 void Browser::ConfirmAddSearchProvider(TemplateURL* template_url, | 1673 void Browser::ConfirmAddSearchProvider(TemplateURL* template_url, |
1673 Profile* profile) { | 1674 Profile* profile) { |
1674 window()->ConfirmAddSearchProvider(template_url, profile); | 1675 window()->ConfirmAddSearchProvider(template_url, profile); |
1675 } | 1676 } |
1676 | 1677 |
1677 /////////////////////////////////////////////////////////////////////////////// | 1678 /////////////////////////////////////////////////////////////////////////////// |
1678 // Browser, WebContentsModalDialogManagerDelegate implementation: | 1679 // Browser, web_modal::WebContentsModalDialogManagerDelegate implementation: |
1679 | 1680 |
1680 void Browser::SetWebContentsBlocked(content::WebContents* web_contents, | 1681 void Browser::SetWebContentsBlocked(content::WebContents* web_contents, |
1681 bool blocked) { | 1682 bool blocked) { |
| 1683 ChromeModalDialogManagerDelegate::SetWebContentsBlocked(web_contents, |
| 1684 blocked); |
1682 int index = tab_strip_model_->GetIndexOfWebContents(web_contents); | 1685 int index = tab_strip_model_->GetIndexOfWebContents(web_contents); |
1683 if (index == TabStripModel::kNoTab) { | 1686 if (index == TabStripModel::kNoTab) { |
1684 NOTREACHED(); | 1687 NOTREACHED(); |
1685 return; | 1688 return; |
1686 } | 1689 } |
1687 tab_strip_model_->SetTabBlocked(index, blocked); | 1690 tab_strip_model_->SetTabBlocked(index, blocked); |
1688 if (!blocked && tab_strip_model_->GetActiveWebContents() == web_contents) | 1691 if (!blocked && tab_strip_model_->GetActiveWebContents() == web_contents) |
1689 web_contents->GetView()->Focus(); | 1692 web_contents->GetView()->Focus(); |
1690 } | 1693 } |
1691 | 1694 |
1692 WebContentsModalDialogHost* Browser::GetWebContentsModalDialogHost() { | 1695 web_modal::WebContentsModalDialogHost* |
| 1696 Browser::GetWebContentsModalDialogHost() { |
1693 return window_->GetWebContentsModalDialogHost(); | 1697 return window_->GetWebContentsModalDialogHost(); |
1694 } | 1698 } |
1695 | 1699 |
1696 /////////////////////////////////////////////////////////////////////////////// | 1700 /////////////////////////////////////////////////////////////////////////////// |
1697 // Browser, BlockedContentTabHelperDelegate implementation: | 1701 // Browser, BlockedContentTabHelperDelegate implementation: |
1698 | 1702 |
1699 content::WebContents* Browser::GetConstrainingWebContents( | 1703 content::WebContents* Browser::GetConstrainingWebContents( |
1700 content::WebContents* source) { | 1704 content::WebContents* source) { |
1701 return source; | 1705 return source; |
1702 } | 1706 } |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2263 if (contents && !allow_js_access) { | 2267 if (contents && !allow_js_access) { |
2264 contents->web_contents()->GetController().LoadURL( | 2268 contents->web_contents()->GetController().LoadURL( |
2265 target_url, | 2269 target_url, |
2266 content::Referrer(), | 2270 content::Referrer(), |
2267 content::PAGE_TRANSITION_LINK, | 2271 content::PAGE_TRANSITION_LINK, |
2268 std::string()); // No extra headers. | 2272 std::string()); // No extra headers. |
2269 } | 2273 } |
2270 | 2274 |
2271 return contents != NULL; | 2275 return contents != NULL; |
2272 } | 2276 } |
OLD | NEW |