Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 2448943002: Refactor SecurityStateModel/Clients for simplicity and reusability. (Closed)
Patch Set: refactor -> SecurityStateTabHelper. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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_model.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 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 if ((operations_allowed & blink::WebDragOperationLink) && 1273 if ((operations_allowed & blink::WebDragOperationLink) &&
1273 chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser(this)) { 1274 chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser(this)) {
1274 return false; 1275 return false;
1275 } 1276 }
1276 return true; 1277 return true;
1277 } 1278 }
1278 1279
1279 blink::WebSecurityStyle Browser::GetSecurityStyle( 1280 blink::WebSecurityStyle Browser::GetSecurityStyle(
1280 WebContents* web_contents, 1281 WebContents* web_contents,
1281 content::SecurityStyleExplanations* security_style_explanations) { 1282 content::SecurityStyleExplanations* security_style_explanations) {
1282 ChromeSecurityStateModelClient* model_client = 1283 SecurityStateTabHelper* helper =
1283 ChromeSecurityStateModelClient::FromWebContents(web_contents); 1284 SecurityStateTabHelper::FromWebContents(web_contents);
1284 DCHECK(model_client); 1285 DCHECK(helper);
1285 security_state::SecurityStateModel::SecurityInfo security_info; 1286 security_state::SecurityStateModel::SecurityInfo security_info;
1286 model_client->GetSecurityInfo(&security_info); 1287 helper->GetSecurityInfo(&security_info);
1287 return model_client->GetSecurityStyle(security_info, 1288 return security_state_content_utils::GetSecurityStyle(
1288 security_style_explanations); 1289 security_info, security_style_explanations);
1289 } 1290 }
1290 1291
1291 void Browser::ShowCertificateViewerInDevTools( 1292 void Browser::ShowCertificateViewerInDevTools(
1292 content::WebContents* web_contents, 1293 content::WebContents* web_contents,
1293 scoped_refptr<net::X509Certificate> certificate) { 1294 scoped_refptr<net::X509Certificate> certificate) {
1294 DevToolsWindow* devtools_window = 1295 DevToolsWindow* devtools_window =
1295 DevToolsWindow::GetInstanceForInspectedWebContents(web_contents); 1296 DevToolsWindow::GetInstanceForInspectedWebContents(web_contents);
1296 if (devtools_window) 1297 if (devtools_window)
1297 devtools_window->ShowCertificateViewer(certificate); 1298 devtools_window->ShowCertificateViewer(certificate);
1298 } 1299 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 hosted_app_controller_->UpdateLocationBarVisibility(true); 1425 hosted_app_controller_->UpdateLocationBarVisibility(true);
1425 } 1426 }
1426 1427
1427 void Browser::VisibleSecurityStateChanged(WebContents* source) { 1428 void Browser::VisibleSecurityStateChanged(WebContents* source) {
1428 // When the current tab's security state changes, we need to update the URL 1429 // When the current tab's security state changes, we need to update the URL
1429 // bar to reflect the new state. 1430 // bar to reflect the new state.
1430 DCHECK(source); 1431 DCHECK(source);
1431 if (tab_strip_model_->GetActiveWebContents() == source) 1432 if (tab_strip_model_->GetActiveWebContents() == source)
1432 UpdateToolbar(false); 1433 UpdateToolbar(false);
1433 1434
1434 ChromeSecurityStateModelClient* security_model = 1435 SecurityStateTabHelper* helper =
1435 ChromeSecurityStateModelClient::FromWebContents(source); 1436 SecurityStateTabHelper::FromWebContents(source);
1436 security_model->VisibleSecurityStateChanged(); 1437 helper->VisibleSecurityStateChanged();
1437 } 1438 }
1438 1439
1439 void Browser::AddNewContents(WebContents* source, 1440 void Browser::AddNewContents(WebContents* source,
1440 WebContents* new_contents, 1441 WebContents* new_contents,
1441 WindowOpenDisposition disposition, 1442 WindowOpenDisposition disposition,
1442 const gfx::Rect& initial_rect, 1443 const gfx::Rect& initial_rect,
1443 bool user_gesture, 1444 bool user_gesture,
1444 bool* was_blocked) { 1445 bool* was_blocked) {
1445 chrome::AddWebContents(this, source, new_contents, disposition, initial_rect, 1446 chrome::AddWebContents(this, source, new_contents, disposition, initial_rect,
1446 user_gesture, was_blocked); 1447 user_gesture, was_blocked);
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 if (contents && !allow_js_access) { 2584 if (contents && !allow_js_access) {
2584 contents->web_contents()->GetController().LoadURL( 2585 contents->web_contents()->GetController().LoadURL(
2585 target_url, 2586 target_url,
2586 content::Referrer(), 2587 content::Referrer(),
2587 ui::PAGE_TRANSITION_LINK, 2588 ui::PAGE_TRANSITION_LINK,
2588 std::string()); // No extra headers. 2589 std::string()); // No extra headers.
2589 } 2590 }
2590 2591
2591 return contents != NULL; 2592 return contents != NULL;
2592 } 2593 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698