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

Unified Diff: chrome/browser/ssl/chrome_security_state_model_client.cc

Issue 2275123004: Downgrade security state while displaying an SB interstitial (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dangerstate
Patch Set: Added tests Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ssl/chrome_security_state_model_client.cc
diff --git a/chrome/browser/ssl/chrome_security_state_model_client.cc b/chrome/browser/ssl/chrome_security_state_model_client.cc
index 09e2b7074adcf364be28234d1258684573b7a6b7..9c75e5391be6d20c0529089da7db18722e9dcbb3 100644
--- a/chrome/browser/ssl/chrome_security_state_model_client.cc
+++ b/chrome/browser/ssl/chrome_security_state_model_client.cc
@@ -81,6 +81,23 @@ content::SecurityStyle SecurityLevelToSecurityStyle(
return content::SECURITY_STYLE_UNKNOWN;
}
+// Check to see whether the security state should be downgraded to reflect
+// a Safe Browsing verdict.
+void CheckSafeBrowsingStatus(content::NavigationEntry* entry,
+ content::WebContents* web_contents,
+ SecurityStateModel::VisibleSecurityState* state) {
+ safe_browsing::SafeBrowsingService* sb_service =
+ g_browser_process->safe_browsing_service();
+ if (!sb_service)
+ return;
+ scoped_refptr<SafeBrowsingUIManager> sb_ui_manager = sb_service->ui_manager();
+ if (sb_ui_manager->IsUrlWhitelistedOrPendingForWebContents(
+ entry->GetURL(), false, entry, web_contents, false)) {
+ state->fails_malware_check = true;
+ state->initial_security_level = SecurityStateModel::SECURITY_ERROR;
+ }
+}
+
} // namespace
ChromeSecurityStateModelClient::ChromeSecurityStateModelClient(
@@ -229,9 +246,14 @@ void ChromeSecurityStateModelClient::GetVisibleSecurityState(
SecurityStateModel::VisibleSecurityState* state) {
content::NavigationEntry* entry =
web_contents_->GetController().GetVisibleEntry();
- if (!entry ||
- entry->GetSSL().security_style == content::SECURITY_STYLE_UNKNOWN) {
+ if (!entry) {
+ *state = SecurityStateModel::VisibleSecurityState();
+ return;
+ }
+
+ if (entry->GetSSL().security_style == content::SECURITY_STYLE_UNKNOWN) {
estark 2016/08/25 06:54:06 nit: could you add a comment around here along the
felt 2016/08/25 15:17:27 Done.
*state = SecurityStateModel::VisibleSecurityState();
+ CheckSafeBrowsingStatus(entry, web_contents_, state);
return;
}
@@ -259,16 +281,5 @@ void ChromeSecurityStateModelClient::GetVisibleSecurityState(
state->ran_content_with_cert_errors =
!!(ssl.content_status & content::SSLStatus::RAN_CONTENT_WITH_CERT_ERRORS);
- // Check to see whether the security state should be downgraded to reflect
- // a Safe Browsing verdict.
- safe_browsing::SafeBrowsingService* sb_service =
- g_browser_process->safe_browsing_service();
- if (!sb_service)
- return;
- scoped_refptr<SafeBrowsingUIManager> sb_ui_manager = sb_service->ui_manager();
- if (sb_ui_manager->IsUrlWhitelistedForWebContents(entry->GetURL(), false,
- entry, web_contents_)) {
- state->fails_malware_check = true;
- state->initial_security_level = SecurityStateModel::SECURITY_ERROR;
- }
+ CheckSafeBrowsingStatus(entry, web_contents_, state);
}
« chrome/browser/safe_browsing/ui_manager.cc ('K') | « chrome/browser/safe_browsing/ui_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698