Chromium Code Reviews| Index: chrome/browser/ui/toolbar/toolbar_model_impl.cc |
| diff --git a/chrome/browser/ui/toolbar/toolbar_model_impl.cc b/chrome/browser/ui/toolbar/toolbar_model_impl.cc |
| index 6f2c5426d247e77bf1e0c3b93f1f6073b77d20e7..4c129789235442af9d149c82825bec4f82178dfa 100644 |
| --- a/chrome/browser/ui/toolbar/toolbar_model_impl.cc |
| +++ b/chrome/browser/ui/toolbar/toolbar_model_impl.cc |
| @@ -10,7 +10,7 @@ |
| #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/search/search.h" |
| -#include "chrome/browser/ssl/connection_security.h" |
| +#include "chrome/browser/ssl/security_state_model.h" |
| #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" |
| #include "chrome/common/pref_names.h" |
| #include "chrome/common/url_constants.h" |
| @@ -109,13 +109,19 @@ bool ToolbarModelImpl::WouldPerformSearchTermReplacement( |
| return !GetSearchTerms(ignore_editing).empty(); |
| } |
| -connection_security::SecurityLevel ToolbarModelImpl::GetSecurityLevel( |
| +SecurityStateModel::SecurityLevel ToolbarModelImpl::GetSecurityLevel( |
| bool ignore_editing) const { |
| - // When editing, assume no security style. |
| - return (input_in_progress() && !ignore_editing) |
| - ? connection_security::NONE |
| - : connection_security::GetSecurityLevelForWebContents( |
| - delegate_->GetActiveWebContents()); |
| + SecurityStateModel* model(nullptr); |
|
Peter Kasting
2015/09/03 18:25:53
Nit: Chromium code generally uses = instead of ()
estark
2015/09/03 22:11:57
Done.
|
| + if (delegate_->GetActiveWebContents()) { |
| + model = |
| + SecurityStateModel::FromWebContents(delegate_->GetActiveWebContents()); |
| + } |
|
Peter Kasting
2015/09/03 18:25:53
Nit: Simpler:
WebContents* web_contents = deleg
estark
2015/09/03 22:11:57
Done.
|
| + |
| + // When editing, or if there is no available security model, assume no |
| + // security style. |
|
Peter Kasting
2015/09/03 18:25:53
Nit: Is it worth commenting about when there might
estark
2015/09/03 22:11:58
Done.
|
| + return ((input_in_progress() && !ignore_editing) || !model) |
| + ? SecurityStateModel::NONE |
| + : model->security_info().security_level; |
| } |
| int ToolbarModelImpl::GetIcon() const { |
| @@ -126,19 +132,19 @@ int ToolbarModelImpl::GetIcon() const { |
| } |
| int ToolbarModelImpl::GetIconForSecurityLevel( |
| - connection_security::SecurityLevel level) const { |
| + SecurityStateModel::SecurityLevel level) const { |
| switch (level) { |
| - case connection_security::NONE: |
| + case SecurityStateModel::NONE: |
| return IDR_LOCATION_BAR_HTTP; |
| - case connection_security::EV_SECURE: |
| - case connection_security::SECURE: |
| + case SecurityStateModel::EV_SECURE: |
| + case SecurityStateModel::SECURE: |
| return IDR_OMNIBOX_HTTPS_VALID; |
| - case connection_security::SECURITY_WARNING: |
| + case SecurityStateModel::SECURITY_WARNING: |
| // Surface Dubious as Neutral. |
| return IDR_LOCATION_BAR_HTTP; |
| - case connection_security::SECURITY_POLICY_WARNING: |
| + case SecurityStateModel::SECURITY_POLICY_WARNING: |
| return IDR_OMNIBOX_HTTPS_POLICY_WARNING; |
| - case connection_security::SECURITY_ERROR: |
| + case SecurityStateModel::SECURITY_ERROR: |
| return IDR_OMNIBOX_HTTPS_INVALID; |
| } |
| @@ -147,7 +153,7 @@ int ToolbarModelImpl::GetIconForSecurityLevel( |
| } |
| base::string16 ToolbarModelImpl::GetEVCertName() const { |
| - if (GetSecurityLevel(false) != connection_security::EV_SECURE) |
| + if (GetSecurityLevel(false) != SecurityStateModel::EV_SECURE) |
| return base::string16(); |
| // Note: Navigation controller and active entry are guaranteed non-NULL or |
| @@ -240,10 +246,10 @@ base::string16 ToolbarModelImpl::GetSearchTerms(bool ignore_editing) const { |
| // Otherwise, extract search terms for HTTPS pages that do not have a security |
| // error. |
| - connection_security::SecurityLevel security_level = |
| + SecurityStateModel::SecurityLevel security_level = |
| GetSecurityLevel(ignore_editing); |
| - return ((security_level == connection_security::NONE) || |
| - (security_level == connection_security::SECURITY_ERROR)) |
| + return ((security_level == SecurityStateModel::NONE) || |
| + (security_level == SecurityStateModel::SECURITY_ERROR)) |
| ? base::string16() |
| : search_terms; |
| } |