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

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

Issue 1181293003: Expand SecurityStyleChanged interfaces to include explanations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add CONTENT_EXPORT Created 5 years, 6 months 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
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 #include "content/public/browser/interstitial_page.h" 173 #include "content/public/browser/interstitial_page.h"
174 #include "content/public/browser/invalidate_type.h" 174 #include "content/public/browser/invalidate_type.h"
175 #include "content/public/browser/navigation_controller.h" 175 #include "content/public/browser/navigation_controller.h"
176 #include "content/public/browser/navigation_entry.h" 176 #include "content/public/browser/navigation_entry.h"
177 #include "content/public/browser/notification_details.h" 177 #include "content/public/browser/notification_details.h"
178 #include "content/public/browser/notification_service.h" 178 #include "content/public/browser/notification_service.h"
179 #include "content/public/browser/plugin_service.h" 179 #include "content/public/browser/plugin_service.h"
180 #include "content/public/browser/render_process_host.h" 180 #include "content/public/browser/render_process_host.h"
181 #include "content/public/browser/render_view_host.h" 181 #include "content/public/browser/render_view_host.h"
182 #include "content/public/browser/render_widget_host_view.h" 182 #include "content/public/browser/render_widget_host_view.h"
183 #include "content/public/browser/security_style_explanation.h"
184 #include "content/public/browser/security_style_explanations.h"
183 #include "content/public/browser/site_instance.h" 185 #include "content/public/browser/site_instance.h"
184 #include "content/public/browser/user_metrics.h" 186 #include "content/public/browser/user_metrics.h"
185 #include "content/public/browser/web_contents.h" 187 #include "content/public/browser/web_contents.h"
186 #include "content/public/common/content_switches.h" 188 #include "content/public/common/content_switches.h"
187 #include "content/public/common/page_zoom.h" 189 #include "content/public/common/page_zoom.h"
188 #include "content/public/common/renderer_preferences.h" 190 #include "content/public/common/renderer_preferences.h"
189 #include "content/public/common/webplugininfo.h" 191 #include "content/public/common/webplugininfo.h"
190 #include "extensions/browser/extension_prefs.h" 192 #include "extensions/browser/extension_prefs.h"
191 #include "extensions/browser/extension_registry.h" 193 #include "extensions/browser/extension_registry.h"
192 #include "extensions/browser/extension_system.h" 194 #include "extensions/browser/extension_system.h"
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 blink::WebDragOperationsMask operations_allowed) { 1299 blink::WebDragOperationsMask operations_allowed) {
1298 // Disallow drag-and-drop navigation for Settings windows which do not support 1300 // Disallow drag-and-drop navigation for Settings windows which do not support
1299 // external navigation. 1301 // external navigation.
1300 if ((operations_allowed & blink::WebDragOperationLink) && 1302 if ((operations_allowed & blink::WebDragOperationLink) &&
1301 chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser(this)) { 1303 chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser(this)) {
1302 return false; 1304 return false;
1303 } 1305 }
1304 return true; 1306 return true;
1305 } 1307 }
1306 1308
1307 content::SecurityStyle Browser::GetSecurityStyle(WebContents* web_contents) { 1309 content::SecurityStyle Browser::GetSecurityStyle(
1308 return connection_security::GetSecurityStyleForWebContents(web_contents); 1310 WebContents* web_contents,
1311 content::SecurityStyleExplanations* security_style_explanations) {
1312 connection_security::SecurityInfo security_info;
1313 connection_security::GetSecurityInfoForWebContents(web_contents,
1314 &security_info);
1315
1316 if (security_info.security_style == content::SECURITY_STYLE_UNKNOWN)
1317 return security_info.security_style;
1318
1319 if (security_info.sha1_deprecation_status ==
1320 connection_security::DEPRECATED_SHA1_BROKEN) {
1321 security_style_explanations->broken_explanations.push_back(
1322 content::SecurityStyleExplanation(
1323 l10n_util::GetStringUTF8(IDS_BROKEN_SHA1),
1324 l10n_util::GetStringUTF8(IDS_BROKEN_SHA1_DESCRIPTION)));
1325 } else if (security_info.sha1_deprecation_status ==
1326 connection_security::DEPRECATED_SHA1_WARNING) {
1327 security_style_explanations->warning_explanations.push_back(
1328 content::SecurityStyleExplanation(
1329 l10n_util::GetStringUTF8(IDS_WARNING_SHA1),
1330 l10n_util::GetStringUTF8(IDS_WARNING_SHA1_DESCRIPTION)));
1331 }
1332
1333 if (security_info.mixed_content_status ==
1334 connection_security::RAN_MIXED_CONTENT) {
1335 security_style_explanations->broken_explanations.push_back(
1336 content::SecurityStyleExplanation(
1337 l10n_util::GetStringUTF8(IDS_ACTIVE_MIXED_CONTENT),
1338 l10n_util::GetStringUTF8(IDS_ACTIVE_MIXED_CONTENT_DESCRIPTION)));
1339 } else if (security_info.mixed_content_status ==
1340 connection_security::DISPLAYED_MIXED_CONTENT) {
1341 security_style_explanations->warning_explanations.push_back(
1342 content::SecurityStyleExplanation(
1343 l10n_util::GetStringUTF8(IDS_PASSIVE_MIXED_CONTENT),
1344 l10n_util::GetStringUTF8(IDS_PASSIVE_MIXED_CONTENT_DESCRIPTION)));
1345 }
1346
1347 if (net::IsCertStatusError(security_info.cert_status)) {
1348 base::string16 error_string = base::UTF8ToUTF16(net::ErrorToString(
1349 net::MapCertStatusToNetError(security_info.cert_status)));
1350
1351 content::SecurityStyleExplanation explanation(
1352 l10n_util::GetStringUTF8(IDS_CERTIFICATE_CHAIN_ERROR),
1353 l10n_util::GetStringFUTF8(
1354 IDS_CERTIFICATE_CHAIN_ERROR_DESCRIPTION_FORMAT, error_string));
1355
1356 if (net::IsCertStatusMinorError(security_info.cert_status))
1357 security_style_explanations->warning_explanations.push_back(explanation);
1358 else
1359 security_style_explanations->broken_explanations.push_back(explanation);
1360 }
1361
1362 return security_info.security_style;
1309 } 1363 }
1310 1364
1311 bool Browser::IsMouseLocked() const { 1365 bool Browser::IsMouseLocked() const {
1312 return exclusive_access_manager_->mouse_lock_controller()->IsMouseLocked(); 1366 return exclusive_access_manager_->mouse_lock_controller()->IsMouseLocked();
1313 } 1367 }
1314 1368
1315 void Browser::OnWindowDidShow() { 1369 void Browser::OnWindowDidShow() {
1316 if (window_has_shown_) 1370 if (window_has_shown_)
1317 return; 1371 return;
1318 window_has_shown_ = true; 1372 window_has_shown_ = true;
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
2624 if (contents && !allow_js_access) { 2678 if (contents && !allow_js_access) {
2625 contents->web_contents()->GetController().LoadURL( 2679 contents->web_contents()->GetController().LoadURL(
2626 target_url, 2680 target_url,
2627 content::Referrer(), 2681 content::Referrer(),
2628 ui::PAGE_TRANSITION_LINK, 2682 ui::PAGE_TRANSITION_LINK,
2629 std::string()); // No extra headers. 2683 std::string()); // No extra headers.
2630 } 2684 }
2631 2685
2632 return contents != NULL; 2686 return contents != NULL;
2633 } 2687 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698