Index: chrome/browser/ui/browser.cc |
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc |
index 55977078765483dd87126a25ccd3adea3216aec1..ace1d801536b18fedf3f03eaa6138050ddd0d1af 100644 |
--- a/chrome/browser/ui/browser.cc |
+++ b/chrome/browser/ui/browser.cc |
@@ -77,7 +77,6 @@ |
#include "chrome/browser/sessions/session_tab_helper.h" |
#include "chrome/browser/sessions/tab_restore_service.h" |
#include "chrome/browser/sessions/tab_restore_service_factory.h" |
-#include "chrome/browser/ssl/security_state_model.h" |
#include "chrome/browser/sync/profile_sync_service.h" |
#include "chrome/browser/sync/profile_sync_service_factory.h" |
#include "chrome/browser/sync/sync_ui_util.h" |
@@ -255,28 +254,6 @@ |
switches::kEnableFastUnload); |
} |
-// Note: This is a lossy operation. Not all of the policies that can be |
-// expressed by a SecurityLevel (a //chrome concept) can be expressed by |
-// a content::SecurityStyle. |
-content::SecurityStyle SecurityLevelToSecurityStyle( |
- SecurityStateModel::SecurityLevel security_level) { |
- switch (security_level) { |
- case SecurityStateModel::NONE: |
- return content::SECURITY_STYLE_UNAUTHENTICATED; |
- case SecurityStateModel::SECURITY_WARNING: |
- case SecurityStateModel::SECURITY_POLICY_WARNING: |
- return content::SECURITY_STYLE_WARNING; |
- case SecurityStateModel::EV_SECURE: |
- case SecurityStateModel::SECURE: |
- return content::SECURITY_STYLE_AUTHENTICATED; |
- case SecurityStateModel::SECURITY_ERROR: |
- return content::SECURITY_STYLE_AUTHENTICATION_BROKEN; |
- } |
- |
- NOTREACHED(); |
- return content::SECURITY_STYLE_UNKNOWN; |
-} |
- |
} // namespace |
//////////////////////////////////////////////////////////////////////////////// |
@@ -1319,18 +1296,14 @@ |
content::SecurityStyle Browser::GetSecurityStyle( |
WebContents* web_contents, |
content::SecurityStyleExplanations* security_style_explanations) { |
- SecurityStateModel* model = SecurityStateModel::FromWebContents(web_contents); |
- DCHECK(model); |
- const SecurityStateModel::SecurityInfo& security_info = |
- model->security_info(); |
- |
- const content::SecurityStyle security_style = |
- SecurityLevelToSecurityStyle(security_info.security_level); |
+ connection_security::SecurityInfo security_info; |
+ connection_security::GetSecurityInfoForWebContents(web_contents, |
+ &security_info); |
security_style_explanations->ran_insecure_content_style = |
- SecurityStateModel::kRanInsecureContentStyle; |
+ connection_security::kRanInsecureContentStyle; |
security_style_explanations->displayed_insecure_content_style = |
- SecurityStateModel::kDisplayedInsecureContentStyle; |
+ connection_security::kDisplayedInsecureContentStyle; |
// Check if the page is HTTP; if so, no explanations are needed. Note |
// that SECURITY_STYLE_UNAUTHENTICATED does not necessarily mean that |
@@ -1341,19 +1314,20 @@ |
// algorithms with the same UI treatment as HTTP pages). |
security_style_explanations->scheme_is_cryptographic = |
security_info.scheme_is_cryptographic; |
- if (!security_info.scheme_is_cryptographic) { |
- return security_style; |
+ if (!security_info.scheme_is_cryptographic || |
+ security_info.security_style == content::SECURITY_STYLE_UNKNOWN) { |
+ return security_info.security_style; |
} |
if (security_info.sha1_deprecation_status == |
- SecurityStateModel::DEPRECATED_SHA1_BROKEN) { |
+ connection_security::DEPRECATED_SHA1_BROKEN) { |
security_style_explanations->broken_explanations.push_back( |
content::SecurityStyleExplanation( |
l10n_util::GetStringUTF8(IDS_BROKEN_SHA1), |
l10n_util::GetStringUTF8(IDS_BROKEN_SHA1_DESCRIPTION), |
security_info.cert_id)); |
} else if (security_info.sha1_deprecation_status == |
- SecurityStateModel::DEPRECATED_SHA1_WARNING) { |
+ connection_security::DEPRECATED_SHA1_WARNING) { |
security_style_explanations->warning_explanations.push_back( |
content::SecurityStyleExplanation( |
l10n_util::GetStringUTF8(IDS_WARNING_SHA1), |
@@ -1363,14 +1337,14 @@ |
security_style_explanations->ran_insecure_content = |
security_info.mixed_content_status == |
- SecurityStateModel::RAN_MIXED_CONTENT || |
+ connection_security::RAN_MIXED_CONTENT || |
security_info.mixed_content_status == |
- SecurityStateModel::RAN_AND_DISPLAYED_MIXED_CONTENT; |
+ connection_security::RAN_AND_DISPLAYED_MIXED_CONTENT; |
security_style_explanations->displayed_insecure_content = |
security_info.mixed_content_status == |
- SecurityStateModel::DISPLAYED_MIXED_CONTENT || |
+ connection_security::DISPLAYED_MIXED_CONTENT || |
security_info.mixed_content_status == |
- SecurityStateModel::RAN_AND_DISPLAYED_MIXED_CONTENT; |
+ connection_security::RAN_AND_DISPLAYED_MIXED_CONTENT; |
if (net::IsCertStatusError(security_info.cert_status)) { |
base::string16 error_string = base::UTF8ToUTF16(net::ErrorToString( |
@@ -1391,7 +1365,7 @@ |
// deprecated SHA1, then add an explanation that the certificate is |
// valid. |
if (security_info.sha1_deprecation_status == |
- SecurityStateModel::NO_DEPRECATED_SHA1) { |
+ connection_security::NO_DEPRECATED_SHA1) { |
security_style_explanations->secure_explanations.push_back( |
content::SecurityStyleExplanation( |
l10n_util::GetStringUTF8(IDS_VALID_SERVER_CERTIFICATE), |
@@ -1401,7 +1375,7 @@ |
} |
} |
- return security_style; |
+ return security_info.security_style; |
} |
void Browser::ShowCertificateViewerInDevTools( |
@@ -1510,17 +1484,10 @@ |
hosted_app_controller_->UpdateLocationBarVisibility(true); |
} |
-void Browser::VisibleSSLStateChanged(WebContents* source) { |
+void Browser::VisibleSSLStateChanged(const WebContents* source) { |
// When the current tab's SSL state changes, we need to update the URL |
// bar to reflect the new state. |
DCHECK(source); |
- |
- // Notify the model that the security state has changed, so that the |
- // URL bar updates with up-to-date data computed by the model. |
- SecurityStateModel* model = SecurityStateModel::FromWebContents(source); |
- DCHECK(model); |
- model->SecurityStateChanged(); |
- |
if (tab_strip_model_->GetActiveWebContents() == source) |
UpdateToolbar(false); |
} |