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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 #include "chrome/browser/profiles/profile_destroyer.h" | 72 #include "chrome/browser/profiles/profile_destroyer.h" |
73 #include "chrome/browser/profiles/profile_metrics.h" | 73 #include "chrome/browser/profiles/profile_metrics.h" |
74 #include "chrome/browser/profiles/profiles_state.h" | 74 #include "chrome/browser/profiles/profiles_state.h" |
75 #include "chrome/browser/repost_form_warning_controller.h" | 75 #include "chrome/browser/repost_form_warning_controller.h" |
76 #include "chrome/browser/search/search.h" | 76 #include "chrome/browser/search/search.h" |
77 #include "chrome/browser/sessions/session_restore.h" | 77 #include "chrome/browser/sessions/session_restore.h" |
78 #include "chrome/browser/sessions/session_service.h" | 78 #include "chrome/browser/sessions/session_service.h" |
79 #include "chrome/browser/sessions/session_service_factory.h" | 79 #include "chrome/browser/sessions/session_service_factory.h" |
80 #include "chrome/browser/sessions/session_tab_helper.h" | 80 #include "chrome/browser/sessions/session_tab_helper.h" |
81 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 81 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
82 #include "chrome/browser/ssl/chrome_security_state_model_client.h" | 82 #include "chrome/browser/ssl/security_state_tab_helper.h" |
83 #include "chrome/browser/sync/profile_sync_service_factory.h" | 83 #include "chrome/browser/sync/profile_sync_service_factory.h" |
84 #include "chrome/browser/sync/sync_ui_util.h" | 84 #include "chrome/browser/sync/sync_ui_util.h" |
85 #include "chrome/browser/tab_contents/retargeting_details.h" | 85 #include "chrome/browser/tab_contents/retargeting_details.h" |
86 #include "chrome/browser/tab_contents/tab_util.h" | 86 #include "chrome/browser/tab_contents/tab_util.h" |
87 #include "chrome/browser/task_manager/web_contents_tags.h" | 87 #include "chrome/browser/task_manager/web_contents_tags.h" |
88 #include "chrome/browser/themes/theme_service.h" | 88 #include "chrome/browser/themes/theme_service.h" |
89 #include "chrome/browser/themes/theme_service_factory.h" | 89 #include "chrome/browser/themes/theme_service_factory.h" |
90 #include "chrome/browser/translate/chrome_translate_client.h" | 90 #include "chrome/browser/translate/chrome_translate_client.h" |
91 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" | 91 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" |
92 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | 92 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 #include "components/bookmarks/browser/bookmark_model.h" | 160 #include "components/bookmarks/browser/bookmark_model.h" |
161 #include "components/bookmarks/browser/bookmark_utils.h" | 161 #include "components/bookmarks/browser/bookmark_utils.h" |
162 #include "components/bookmarks/common/bookmark_pref_names.h" | 162 #include "components/bookmarks/common/bookmark_pref_names.h" |
163 #include "components/browser_sync/profile_sync_service.h" | 163 #include "components/browser_sync/profile_sync_service.h" |
164 #include "components/bubble/bubble_controller.h" | 164 #include "components/bubble/bubble_controller.h" |
165 #include "components/content_settings/core/browser/host_content_settings_map.h" | 165 #include "components/content_settings/core/browser/host_content_settings_map.h" |
166 #include "components/favicon/content/content_favicon_driver.h" | 166 #include "components/favicon/content/content_favicon_driver.h" |
167 #include "components/history/core/browser/top_sites.h" | 167 #include "components/history/core/browser/top_sites.h" |
168 #include "components/prefs/pref_service.h" | 168 #include "components/prefs/pref_service.h" |
169 #include "components/search/search.h" | 169 #include "components/search/search.h" |
170 #include "components/security_state/security_state_model.h" | 170 #include "components/security_state/content/content_utils.h" |
| 171 #include "components/security_state/core/security_state.h" |
171 #include "components/sessions/core/session_types.h" | 172 #include "components/sessions/core/session_types.h" |
172 #include "components/sessions/core/tab_restore_service.h" | 173 #include "components/sessions/core/tab_restore_service.h" |
173 #include "components/startup_metric_utils/browser/startup_metric_utils.h" | 174 #include "components/startup_metric_utils/browser/startup_metric_utils.h" |
174 #include "components/toolbar/toolbar_model_impl.h" | 175 #include "components/toolbar/toolbar_model_impl.h" |
175 #include "components/translate/core/browser/language_state.h" | 176 #include "components/translate/core/browser/language_state.h" |
176 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 177 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
177 #include "components/zoom/zoom_controller.h" | 178 #include "components/zoom/zoom_controller.h" |
178 #include "content/public/browser/devtools_agent_host.h" | 179 #include "content/public/browser/devtools_agent_host.h" |
179 #include "content/public/browser/interstitial_page.h" | 180 #include "content/public/browser/interstitial_page.h" |
180 #include "content/public/browser/invalidate_type.h" | 181 #include "content/public/browser/invalidate_type.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 using content::NativeWebKeyboardEvent; | 236 using content::NativeWebKeyboardEvent; |
236 using content::NavigationController; | 237 using content::NavigationController; |
237 using content::NavigationEntry; | 238 using content::NavigationEntry; |
238 using content::OpenURLParams; | 239 using content::OpenURLParams; |
239 using content::PluginService; | 240 using content::PluginService; |
240 using content::Referrer; | 241 using content::Referrer; |
241 using content::RenderWidgetHostView; | 242 using content::RenderWidgetHostView; |
242 using content::SiteInstance; | 243 using content::SiteInstance; |
243 using content::WebContents; | 244 using content::WebContents; |
244 using extensions::Extension; | 245 using extensions::Extension; |
245 using security_state::SecurityStateModel; | |
246 using ui::WebDialogDelegate; | 246 using ui::WebDialogDelegate; |
247 using web_modal::WebContentsModalDialogManager; | 247 using web_modal::WebContentsModalDialogManager; |
248 using blink::WebWindowFeatures; | 248 using blink::WebWindowFeatures; |
249 | 249 |
250 /////////////////////////////////////////////////////////////////////////////// | 250 /////////////////////////////////////////////////////////////////////////////// |
251 | 251 |
252 namespace { | 252 namespace { |
253 | 253 |
254 // How long we wait before updating the browser chrome while loading a page. | 254 // How long we wait before updating the browser chrome while loading a page. |
255 const int kUIUpdateCoalescingTimeMS = 200; | 255 const int kUIUpdateCoalescingTimeMS = 200; |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 if ((operations_allowed & blink::WebDragOperationLink) && | 1272 if ((operations_allowed & blink::WebDragOperationLink) && |
1273 chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser(this)) { | 1273 chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser(this)) { |
1274 return false; | 1274 return false; |
1275 } | 1275 } |
1276 return true; | 1276 return true; |
1277 } | 1277 } |
1278 | 1278 |
1279 blink::WebSecurityStyle Browser::GetSecurityStyle( | 1279 blink::WebSecurityStyle Browser::GetSecurityStyle( |
1280 WebContents* web_contents, | 1280 WebContents* web_contents, |
1281 content::SecurityStyleExplanations* security_style_explanations) { | 1281 content::SecurityStyleExplanations* security_style_explanations) { |
1282 ChromeSecurityStateModelClient* model_client = | 1282 SecurityStateTabHelper* helper = |
1283 ChromeSecurityStateModelClient::FromWebContents(web_contents); | 1283 SecurityStateTabHelper::FromWebContents(web_contents); |
1284 DCHECK(model_client); | 1284 DCHECK(helper); |
1285 security_state::SecurityStateModel::SecurityInfo security_info; | 1285 security_state::SecurityInfo security_info; |
1286 model_client->GetSecurityInfo(&security_info); | 1286 helper->GetSecurityInfo(&security_info); |
1287 return model_client->GetSecurityStyle(security_info, | 1287 return security_state::GetSecurityStyle(security_info, |
1288 security_style_explanations); | 1288 security_style_explanations); |
1289 } | 1289 } |
1290 | 1290 |
1291 void Browser::ShowCertificateViewerInDevTools( | 1291 void Browser::ShowCertificateViewerInDevTools( |
1292 content::WebContents* web_contents, | 1292 content::WebContents* web_contents, |
1293 scoped_refptr<net::X509Certificate> certificate) { | 1293 scoped_refptr<net::X509Certificate> certificate) { |
1294 DevToolsWindow* devtools_window = | 1294 DevToolsWindow* devtools_window = |
1295 DevToolsWindow::GetInstanceForInspectedWebContents(web_contents); | 1295 DevToolsWindow::GetInstanceForInspectedWebContents(web_contents); |
1296 if (devtools_window) | 1296 if (devtools_window) |
1297 devtools_window->ShowCertificateViewer(certificate); | 1297 devtools_window->ShowCertificateViewer(certificate); |
1298 } | 1298 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1424 hosted_app_controller_->UpdateLocationBarVisibility(true); | 1424 hosted_app_controller_->UpdateLocationBarVisibility(true); |
1425 } | 1425 } |
1426 | 1426 |
1427 void Browser::VisibleSecurityStateChanged(WebContents* source) { | 1427 void Browser::VisibleSecurityStateChanged(WebContents* source) { |
1428 // When the current tab's security state changes, we need to update the URL | 1428 // When the current tab's security state changes, we need to update the URL |
1429 // bar to reflect the new state. | 1429 // bar to reflect the new state. |
1430 DCHECK(source); | 1430 DCHECK(source); |
1431 if (tab_strip_model_->GetActiveWebContents() == source) | 1431 if (tab_strip_model_->GetActiveWebContents() == source) |
1432 UpdateToolbar(false); | 1432 UpdateToolbar(false); |
1433 | 1433 |
1434 ChromeSecurityStateModelClient* security_model = | 1434 SecurityStateTabHelper* helper = |
1435 ChromeSecurityStateModelClient::FromWebContents(source); | 1435 SecurityStateTabHelper::FromWebContents(source); |
1436 security_model->VisibleSecurityStateChanged(); | 1436 helper->VisibleSecurityStateChanged(); |
1437 } | 1437 } |
1438 | 1438 |
1439 void Browser::AddNewContents(WebContents* source, | 1439 void Browser::AddNewContents(WebContents* source, |
1440 WebContents* new_contents, | 1440 WebContents* new_contents, |
1441 WindowOpenDisposition disposition, | 1441 WindowOpenDisposition disposition, |
1442 const gfx::Rect& initial_rect, | 1442 const gfx::Rect& initial_rect, |
1443 bool user_gesture, | 1443 bool user_gesture, |
1444 bool* was_blocked) { | 1444 bool* was_blocked) { |
1445 chrome::AddWebContents(this, source, new_contents, disposition, initial_rect, | 1445 chrome::AddWebContents(this, source, new_contents, disposition, initial_rect, |
1446 user_gesture, was_blocked); | 1446 user_gesture, was_blocked); |
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2583 if (contents && !allow_js_access) { | 2583 if (contents && !allow_js_access) { |
2584 contents->web_contents()->GetController().LoadURL( | 2584 contents->web_contents()->GetController().LoadURL( |
2585 target_url, | 2585 target_url, |
2586 content::Referrer(), | 2586 content::Referrer(), |
2587 ui::PAGE_TRANSITION_LINK, | 2587 ui::PAGE_TRANSITION_LINK, |
2588 std::string()); // No extra headers. | 2588 std::string()); // No extra headers. |
2589 } | 2589 } |
2590 | 2590 |
2591 return contents != NULL; | 2591 return contents != NULL; |
2592 } | 2592 } |
OLD | NEW |