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); |
} |