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

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: Moar bugfix (thanks trybots!!) 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
« no previous file with comments | « chrome/browser/safe_browsing/ui_manager_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 551ada3ac45d64cc90a63fc26bbeeeb96eb6e219..feffd8a7bd8646d6cfef4dd845ab90c6d0f97656 100644
--- a/chrome/browser/ssl/chrome_security_state_model_client.cc
+++ b/chrome/browser/ssl/chrome_security_state_model_client.cc
@@ -154,6 +154,23 @@ void AddConnectionExplanation(
description_replacements, nullptr))));
}
+// 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(
@@ -296,9 +313,16 @@ 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) {
*state = SecurityStateModel::VisibleSecurityState();
+ // Connection security information is still being initialized, but malware
+ // status might already be known.
+ CheckSafeBrowsingStatus(entry, web_contents_, state);
return;
}
@@ -326,16 +350,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);
}
« no previous file with comments | « chrome/browser/safe_browsing/ui_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698