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

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: comments, style tweaks 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
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 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 blink::WebDragOperationsMask operations_allowed) { 1297 blink::WebDragOperationsMask operations_allowed) {
1298 // Disallow drag-and-drop navigation for Settings windows which do not support 1298 // Disallow drag-and-drop navigation for Settings windows which do not support
1299 // external navigation. 1299 // external navigation.
1300 if ((operations_allowed & blink::WebDragOperationLink) && 1300 if ((operations_allowed & blink::WebDragOperationLink) &&
1301 chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser(this)) { 1301 chrome::SettingsWindowManager::GetInstance()->IsSettingsBrowser(this)) {
1302 return false; 1302 return false;
1303 } 1303 }
1304 return true; 1304 return true;
1305 } 1305 }
1306 1306
1307 content::SecurityStyle Browser::GetSecurityStyle(WebContents* web_contents) { 1307 content::SecurityStyle Browser::GetSecurityStyle(
1308 return connection_security::GetSecurityStyleForWebContents(web_contents); 1308 WebContents* web_contents,
1309 content::SecurityStyleExplanation* security_style_explanation) {
1310 connection_security::SecurityInfo security_info;
1311 connection_security::GetSecurityInfoForWebContents(web_contents,
1312 &security_info);
1313
1314 if (security_info.security_style == content::SECURITY_STYLE_UNKNOWN)
1315 return security_info.security_style;
1316
1317 if (security_info.sha1_deprecation_status ==
1318 connection_security::DEPRECATED_SHA1_BROKEN) {
1319 security_style_explanation->broken_explanations.push_back(
1320 content::SecurityStyleProperty(
1321 l10n_util::GetStringUTF8(IDS_BROKEN_SHA1),
1322 l10n_util::GetStringUTF8(IDS_BROKEN_SHA1_DESCRIPTION)));
1323 } else if (security_info.sha1_deprecation_status ==
1324 connection_security::DEPRECATED_SHA1_WARNING) {
1325 security_style_explanation->warning_explanations.push_back(
1326 content::SecurityStyleProperty(
1327 l10n_util::GetStringUTF8(IDS_WARNING_SHA1),
1328 l10n_util::GetStringUTF8(IDS_WARNING_SHA1_DESCRIPTION)));
1329 }
1330
1331 if (security_info.mixed_content_status ==
1332 connection_security::RAN_MIXED_CONTENT) {
1333 security_style_explanation->broken_explanations.push_back(
1334 content::SecurityStyleProperty(
1335 l10n_util::GetStringUTF8(IDS_ACTIVE_MIXED_CONTENT),
1336 l10n_util::GetStringUTF8(IDS_ACTIVE_MIXED_CONTENT_DESCRIPTION)));
1337 } else if (security_info.mixed_content_status ==
1338 connection_security::DISPLAYED_MIXED_CONTENT) {
1339 security_style_explanation->warning_explanations.push_back(
1340 content::SecurityStyleProperty(
1341 l10n_util::GetStringUTF8(IDS_PASSIVE_MIXED_CONTENT),
1342 l10n_util::GetStringUTF8(IDS_PASSIVE_MIXED_CONTENT_DESCRIPTION)));
1343 }
1344
1345 if (net::IsCertStatusError(security_info.cert_status)) {
1346 base::string16 error_string = base::UTF8ToUTF16(net::ErrorToString(
1347 net::MapCertStatusToNetError(security_info.cert_status)));
1348
1349 content::SecurityStyleProperty explanation(
1350 l10n_util::GetStringUTF8(IDS_CERTIFICATE_CHAIN_ERROR),
1351 l10n_util::GetStringFUTF8(
1352 IDS_CERTIFICATE_CHAIN_ERROR_DESCRIPTION_FORMAT,
1353 error_string)
1354
1355 if (net::IsCertStatusMinorError(security_info.cert_status)) {
Peter Kasting 2015/06/16 06:29:11 Nit: No {}
estark 2015/06/16 15:32:35 Done.
1356 security_style_explanation->warning_explanations.push_back(explanation);
1357 } else {
1358 security_style_explanation->broken_explanations.push_back(explanation);
1359 }
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

Powered by Google App Engine
This is Rietveld 408576698