diff options
Diffstat (limited to 'chrome/browser/ui')
12 files changed, 92 insertions, 213 deletions
diff --git a/chrome/browser/ui/android/toolbar/toolbar_model_android.cc b/chrome/browser/ui/android/toolbar/toolbar_model_android.cc index d7437c3..2ce0ed4 100644 --- a/chrome/browser/ui/android/toolbar/toolbar_model_android.cc +++ b/chrome/browser/ui/android/toolbar/toolbar_model_android.cc @@ -70,16 +70,6 @@ jlong Init(JNIEnv* env, jobject obj, jobject delegate) { return reinterpret_cast<intptr_t>(toolbar_model); } -// static -jint GetSecurityLevelForWebContents(JNIEnv* env, - jclass jcaller, - jobject jweb_contents) { - content::WebContents* web_contents = - content::WebContents::FromJavaWebContents(jweb_contents); - DCHECK(web_contents); - return ToolbarModelImpl::GetSecurityLevelForWebContents(web_contents); -} - // Temporary method to allow us to surface a SHA-1 deprecation string on Android // in M42. This duplicates a subset of the logic from // ToolbarModelImpl::GetSecurityLevelForWebContents() and diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm index ea1395a..8d7c1b2 100644 --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm @@ -435,7 +435,7 @@ void LocationBarViewMac::Layout() { selected_keyword_decoration_->SetKeyword(short_name, is_extension_keyword); selected_keyword_decoration_->SetImage(GetKeywordImage(keyword)); } else if ((GetToolbarModel()->GetSecurityLevel(false) == - ToolbarModel::EV_SECURE)) { + ConnectionSecurityHelper::EV_SECURE)) { // Switch from location icon to show the EV bubble instead. location_icon_decoration_->SetVisible(false); ev_bubble_decoration_->SetVisible(true); diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm index 006a7aa..7d296dd 100644 --- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm +++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm @@ -512,23 +512,24 @@ void OmniboxViewMac::ApplyTextAttributes(const base::string16& display_text, // TODO(shess): GTK has this as a member var, figure out why. // [Could it be to not change if no change? If so, I'm guessing // AppKit may already handle that.] - const ToolbarModel::SecurityLevel security_level = + const ConnectionSecurityHelper::SecurityLevel security_level = controller()->GetToolbarModel()->GetSecurityLevel(false); // Emphasize the scheme for security UI display purposes (if necessary). if (!model()->user_input_in_progress() && model()->CurrentTextIsURL() && - scheme.is_nonempty() && (security_level != ToolbarModel::NONE)) { + scheme.is_nonempty() && + (security_level != ConnectionSecurityHelper::NONE)) { NSColor* color; - if (security_level == ToolbarModel::EV_SECURE || - security_level == ToolbarModel::SECURE) { + if (security_level == ConnectionSecurityHelper::EV_SECURE || + security_level == ConnectionSecurityHelper::SECURE) { color = SecureSchemeColor(); - } else if (security_level == ToolbarModel::SECURITY_ERROR) { + } else if (security_level == ConnectionSecurityHelper::SECURITY_ERROR) { color = SecurityErrorSchemeColor(); // Add a strikethrough through the scheme. [as addAttribute:NSStrikethroughStyleAttributeName value:[NSNumber numberWithInt:NSUnderlineStyleSingle] range:ComponentToNSRange(scheme)]; - } else if (security_level == ToolbarModel::SECURITY_WARNING) { + } else if (security_level == ConnectionSecurityHelper::SECURITY_WARNING) { color = BaseTextColor(); } else { NOTREACHED(); diff --git a/chrome/browser/ui/toolbar/test_toolbar_model.cc b/chrome/browser/ui/toolbar/test_toolbar_model.cc index 17e71f1..b345a1b 100644 --- a/chrome/browser/ui/toolbar/test_toolbar_model.cc +++ b/chrome/browser/ui/toolbar/test_toolbar_model.cc @@ -9,9 +9,10 @@ TestToolbarModel::TestToolbarModel() : ToolbarModel(), perform_search_term_replacement_(false), - security_level_(NONE), + security_level_(ConnectionSecurityHelper::NONE), icon_(IDR_LOCATION_BAR_HTTP), - should_display_url_(true) {} + should_display_url_(true) { +} TestToolbarModel::~TestToolbarModel() {} @@ -36,7 +37,7 @@ bool TestToolbarModel::WouldPerformSearchTermReplacement( return perform_search_term_replacement_; } -ToolbarModel::SecurityLevel TestToolbarModel::GetSecurityLevel( +ConnectionSecurityHelper::SecurityLevel TestToolbarModel::GetSecurityLevel( bool ignore_editing) const { return security_level_; } @@ -45,12 +46,15 @@ int TestToolbarModel::GetIcon() const { return icon_; } -int TestToolbarModel::GetIconForSecurityLevel(SecurityLevel level) const { +int TestToolbarModel::GetIconForSecurityLevel( + ConnectionSecurityHelper::SecurityLevel level) const { return icon_; } base::string16 TestToolbarModel::GetEVCertName() const { - return (security_level_ == EV_SECURE) ? ev_cert_name_ : base::string16(); + return (security_level_ == ConnectionSecurityHelper::EV_SECURE) + ? ev_cert_name_ + : base::string16(); } bool TestToolbarModel::ShouldDisplayURL() const { diff --git a/chrome/browser/ui/toolbar/test_toolbar_model.h b/chrome/browser/ui/toolbar/test_toolbar_model.h index 614ddc5..d604a80 100644 --- a/chrome/browser/ui/toolbar/test_toolbar_model.h +++ b/chrome/browser/ui/toolbar/test_toolbar_model.h @@ -21,9 +21,11 @@ class TestToolbarModel : public ToolbarModel { base::string16 GetCorpusNameForMobile() const override; GURL GetURL() const override; bool WouldPerformSearchTermReplacement(bool ignore_editing) const override; - SecurityLevel GetSecurityLevel(bool ignore_editing) const override; + ConnectionSecurityHelper::SecurityLevel GetSecurityLevel( + bool ignore_editing) const override; int GetIcon() const override; - int GetIconForSecurityLevel(SecurityLevel level) const override; + int GetIconForSecurityLevel( + ConnectionSecurityHelper::SecurityLevel level) const override; base::string16 GetEVCertName() const override; bool ShouldDisplayURL() const override; @@ -33,7 +35,8 @@ class TestToolbarModel : public ToolbarModel { bool perform_search_term_replacement) { perform_search_term_replacement_ = perform_search_term_replacement; } - void set_security_level(SecurityLevel security_level) { + void set_security_level( + ConnectionSecurityHelper::SecurityLevel security_level) { security_level_ = security_level; } void set_icon(int icon) { icon_ = icon; } @@ -48,7 +51,7 @@ class TestToolbarModel : public ToolbarModel { base::string16 text_; GURL url_; bool perform_search_term_replacement_; - SecurityLevel security_level_; + ConnectionSecurityHelper::SecurityLevel security_level_; int icon_; base::string16 ev_cert_name_; bool should_display_url_; diff --git a/chrome/browser/ui/toolbar/toolbar_model.h b/chrome/browser/ui/toolbar/toolbar_model.h index 735b755..cdc7043 100644 --- a/chrome/browser/ui/toolbar/toolbar_model.h +++ b/chrome/browser/ui/toolbar/toolbar_model.h @@ -9,6 +9,7 @@ #include "base/basictypes.h" #include "base/strings/string16.h" +#include "chrome/browser/ssl/connection_security_helper.h" #include "url/gurl.h" namespace net { @@ -20,37 +21,6 @@ class X509Certificate; // from the navigation controller returned by GetNavigationController(). class ToolbarModel { public: - // TODO(wtc): unify ToolbarModel::SecurityLevel with SecurityStyle. We - // don't need two sets of security UI levels. SECURITY_STYLE_AUTHENTICATED - // needs to be refined into three levels: warning, standard, and EV. - // - // A Java counterpart will be generated for this enum. - // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.ui.toolbar - // GENERATED_JAVA_CLASS_NAME_OVERRIDE: ToolbarModelSecurityLevel - enum SecurityLevel { - // HTTP/no URL/user is editing - NONE = 0, - - // HTTPS with valid EV cert - EV_SECURE = 1, - - // HTTPS (non-EV) - SECURE = 2, - - // HTTPS, but unable to check certificate revocation status or with insecure - // content on the page - SECURITY_WARNING = 3, - - // HTTPS, but the certificate verification chain is anchored on a - // certificate that was installed by the system administrator - SECURITY_POLICY_WARNING = 4, - - // Attempted HTTPS and failed, page not authenticated - SECURITY_ERROR = 5, - - NUM_SECURITY_LEVELS = 6, - }; - virtual ~ToolbarModel(); // Returns the text to be displayed in the toolbar for the current page. @@ -93,7 +63,8 @@ class ToolbarModel { // |ignore_editing| is true, the result reflects the underlying state of the // page without regard to any user edits that may be in progress in the // omnibox. - virtual SecurityLevel GetSecurityLevel(bool ignore_editing) const = 0; + virtual ConnectionSecurityHelper::SecurityLevel GetSecurityLevel( + bool ignore_editing) const = 0; // Returns the resource_id of the icon to show to the left of the address, // based on the current URL. When search term replacement is active, this @@ -103,7 +74,8 @@ class ToolbarModel { // As |GetIcon()|, but returns the icon only taking into account the security // |level| given, ignoring search term replacement state. - virtual int GetIconForSecurityLevel(SecurityLevel level) const = 0; + virtual int GetIconForSecurityLevel( + ConnectionSecurityHelper::SecurityLevel level) const = 0; // Returns the name of the EV cert holder. This returns an empty string if // the security level is not EV_SECURE. diff --git a/chrome/browser/ui/toolbar/toolbar_model_impl.cc b/chrome/browser/ui/toolbar/toolbar_model_impl.cc index 2bf97bf..1f5491c 100644 --- a/chrome/browser/ui/toolbar/toolbar_model_impl.cc +++ b/chrome/browser/ui/toolbar/toolbar_model_impl.cc @@ -4,8 +4,6 @@ #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" -#include "base/command_line.h" -#include "base/metrics/field_trial.h" #include "base/prefs/pref_service.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" @@ -14,10 +12,8 @@ #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/ssl_error_info.h" +#include "chrome/browser/ssl/connection_security_helper.h" #include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" -#include "chrome/common/chrome_constants.h" -#include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" #include "chrome/grit/generated_resources.h" @@ -39,41 +35,10 @@ #include "net/ssl/ssl_connection_status_flags.h" #include "ui/base/l10n/l10n_util.h" -#if defined(OS_CHROMEOS) -#include "chrome/browser/chromeos/policy/policy_cert_service.h" -#include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" -#endif - using content::NavigationController; using content::NavigationEntry; -using content::SSLStatus; using content::WebContents; -namespace { - -ToolbarModel::SecurityLevel GetSecurityLevelForNonSecureFieldTrial() { - std::string choice = base::CommandLine::ForCurrentProcess()-> - GetSwitchValueASCII(switches::kMarkNonSecureAs); - if (choice == switches::kMarkNonSecureAsNeutral) - return ToolbarModel::NONE; - if (choice == switches::kMarkNonSecureAsDubious) - return ToolbarModel::SECURITY_WARNING; - if (choice == switches::kMarkNonSecureAsNonSecure) - return ToolbarModel::SECURITY_ERROR; - - std::string group = base::FieldTrialList::FindFullName("MarkNonSecureAs"); - if (group == switches::kMarkNonSecureAsNeutral) - return ToolbarModel::NONE; - if (group == switches::kMarkNonSecureAsDubious) - return ToolbarModel::SECURITY_WARNING; - if (group == switches::kMarkNonSecureAsNonSecure) - return ToolbarModel::SECURITY_ERROR; - - return ToolbarModel::NONE; -} - -} // namespace - ToolbarModelImpl::ToolbarModelImpl(ToolbarModelDelegate* delegate) : delegate_(delegate) { } @@ -81,78 +46,6 @@ ToolbarModelImpl::ToolbarModelImpl(ToolbarModelDelegate* delegate) ToolbarModelImpl::~ToolbarModelImpl() { } -// static -ToolbarModel::SecurityLevel ToolbarModelImpl::GetSecurityLevelForWebContents( - content::WebContents* web_contents) { - if (!web_contents) - return NONE; - - NavigationEntry* entry = web_contents->GetController().GetVisibleEntry(); - if (!entry) - return NONE; - - const SSLStatus& ssl = entry->GetSSL(); - switch (ssl.security_style) { - case content::SECURITY_STYLE_UNKNOWN: - return NONE; - - case content::SECURITY_STYLE_UNAUTHENTICATED: { - const GURL& url = entry->GetURL(); - if (url.SchemeIs("http") || url.SchemeIs("ftp")) - return GetSecurityLevelForNonSecureFieldTrial(); - return NONE; - } - - case content::SECURITY_STYLE_AUTHENTICATION_BROKEN: - return SECURITY_ERROR; - - case content::SECURITY_STYLE_AUTHENTICATED: { -#if defined(OS_CHROMEOS) - policy::PolicyCertService* service = - policy::PolicyCertServiceFactory::GetForProfile( - Profile::FromBrowserContext(web_contents->GetBrowserContext())); - if (service && service->UsedPolicyCertificates()) - return SECURITY_POLICY_WARNING; -#endif - if (!!(ssl.content_status & SSLStatus::DISPLAYED_INSECURE_CONTENT)) - return SECURITY_WARNING; - scoped_refptr<net::X509Certificate> cert; - if (content::CertStore::GetInstance()->RetrieveCert(ssl.cert_id, &cert) && - (ssl.cert_status & net::CERT_STATUS_SHA1_SIGNATURE_PRESENT)) { - // The internal representation of the dates for UI treatment of SHA-1. - // See http://crbug.com/401365 for details - static const int64_t kJanuary2017 = INT64_C(13127702400000000); - // kJanuary2016 needs to be kept in sync with - // ToolbarModelAndroid::IsDeprecatedSHA1Present(). - static const int64_t kJanuary2016 = INT64_C(13096080000000000); - if (cert->valid_expiry() >= - base::Time::FromInternalValue(kJanuary2017)) { - return SECURITY_ERROR; - } - if (cert->valid_expiry() >= - base::Time::FromInternalValue(kJanuary2016)) { - return SECURITY_WARNING; - } - } - if (net::IsCertStatusError(ssl.cert_status)) { - DCHECK(net::IsCertStatusMinorError(ssl.cert_status)); - return SECURITY_WARNING; - } - if (net::SSLConnectionStatusToVersion(ssl.connection_status) == - net::SSL_CONNECTION_VERSION_SSL3) { - // SSLv3 will be removed in the future. - return SECURITY_WARNING; - } - if ((ssl.cert_status & net::CERT_STATUS_IS_EV) && cert.get()) - return EV_SECURE; - return SECURE; - } - default: - NOTREACHED(); - return NONE; - } -} - // ToolbarModelImpl Implementation. base::string16 ToolbarModelImpl::GetText() const { base::string16 search_terms(GetSearchTerms(false)); @@ -216,11 +109,13 @@ bool ToolbarModelImpl::WouldPerformSearchTermReplacement( return !GetSearchTerms(ignore_editing).empty(); } -ToolbarModel::SecurityLevel ToolbarModelImpl::GetSecurityLevel( +ConnectionSecurityHelper::SecurityLevel ToolbarModelImpl::GetSecurityLevel( bool ignore_editing) const { // When editing, assume no security style. - return (input_in_progress() && !ignore_editing) ? - NONE : GetSecurityLevelForWebContents(delegate_->GetActiveWebContents()); + return (input_in_progress() && !ignore_editing) + ? ConnectionSecurityHelper::NONE + : ConnectionSecurityHelper::GetSecurityLevelForWebContents( + delegate_->GetActiveWebContents()); } int ToolbarModelImpl::GetIcon() const { @@ -230,21 +125,28 @@ int ToolbarModelImpl::GetIcon() const { return GetIconForSecurityLevel(GetSecurityLevel(false)); } -int ToolbarModelImpl::GetIconForSecurityLevel(SecurityLevel level) const { - static int icon_ids[NUM_SECURITY_LEVELS] = { - IDR_LOCATION_BAR_HTTP, - IDR_OMNIBOX_HTTPS_VALID, - IDR_OMNIBOX_HTTPS_VALID, - IDR_OMNIBOX_HTTPS_WARNING, - IDR_OMNIBOX_HTTPS_POLICY_WARNING, - IDR_OMNIBOX_HTTPS_INVALID, - }; - DCHECK(arraysize(icon_ids) == NUM_SECURITY_LEVELS); - return icon_ids[level]; +int ToolbarModelImpl::GetIconForSecurityLevel( + ConnectionSecurityHelper::SecurityLevel level) const { + switch (level) { + case ConnectionSecurityHelper::NONE: + return IDR_LOCATION_BAR_HTTP; + case ConnectionSecurityHelper::EV_SECURE: + case ConnectionSecurityHelper::SECURE: + return IDR_OMNIBOX_HTTPS_VALID; + case ConnectionSecurityHelper::SECURITY_WARNING: + return IDR_OMNIBOX_HTTPS_WARNING; + case ConnectionSecurityHelper::SECURITY_POLICY_WARNING: + return IDR_OMNIBOX_HTTPS_POLICY_WARNING; + case ConnectionSecurityHelper::SECURITY_ERROR: + return IDR_OMNIBOX_HTTPS_INVALID; + } + + NOTREACHED(); + return IDR_LOCATION_BAR_HTTP; } base::string16 ToolbarModelImpl::GetEVCertName() const { - if (GetSecurityLevel(false) != EV_SECURE) + if (GetSecurityLevel(false) != ConnectionSecurityHelper::EV_SECURE) return base::string16(); // Note: Navigation controller and active entry are guaranteed non-NULL or @@ -337,7 +239,10 @@ base::string16 ToolbarModelImpl::GetSearchTerms(bool ignore_editing) const { // Otherwise, extract search terms for HTTPS pages that do not have a security // error. - ToolbarModel::SecurityLevel security_level = GetSecurityLevel(ignore_editing); - return ((security_level == NONE) || (security_level == SECURITY_ERROR)) ? - base::string16() : search_terms; + ConnectionSecurityHelper::SecurityLevel security_level = + GetSecurityLevel(ignore_editing); + return ((security_level == ConnectionSecurityHelper::NONE) || + (security_level == ConnectionSecurityHelper::SECURITY_ERROR)) + ? base::string16() + : search_terms; } diff --git a/chrome/browser/ui/toolbar/toolbar_model_impl.h b/chrome/browser/ui/toolbar/toolbar_model_impl.h index 0291cf3..0bea045 100644 --- a/chrome/browser/ui/toolbar/toolbar_model_impl.h +++ b/chrome/browser/ui/toolbar/toolbar_model_impl.h @@ -33,9 +33,6 @@ class ToolbarModelImpl : public ToolbarModel { explicit ToolbarModelImpl(ToolbarModelDelegate* delegate); ~ToolbarModelImpl() override; - static SecurityLevel GetSecurityLevelForWebContents( - content::WebContents* web_contents); - private: // ToolbarModel: base::string16 GetText() const override; @@ -43,9 +40,11 @@ class ToolbarModelImpl : public ToolbarModel { base::string16 GetCorpusNameForMobile() const override; GURL GetURL() const override; bool WouldPerformSearchTermReplacement(bool ignore_editing) const override; - SecurityLevel GetSecurityLevel(bool ignore_editing) const override; + ConnectionSecurityHelper::SecurityLevel GetSecurityLevel( + bool ignore_editing) const override; int GetIcon() const override; - int GetIconForSecurityLevel(SecurityLevel level) const override; + int GetIconForSecurityLevel( + ConnectionSecurityHelper::SecurityLevel level) const override; base::string16 GetEVCertName() const override; bool ShouldDisplayURL() const override; diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc index 9a8e18a..3f57927 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -211,9 +211,10 @@ void LocationBarView::Init() { location_height - bubble_vertical_padding)); const SkColor background_color = - GetColor(ToolbarModel::NONE, LocationBarView::BACKGROUND); + GetColor(ConnectionSecurityHelper::NONE, LocationBarView::BACKGROUND); ev_bubble_view_ = new EVBubbleView( - bubble_font_list, GetColor(ToolbarModel::EV_SECURE, SECURITY_TEXT), + bubble_font_list, + GetColor(ConnectionSecurityHelper::EV_SECURE, SECURITY_TEXT), background_color, this); ev_bubble_view_->set_drag_controller(this); AddChildView(ev_bubble_view_); @@ -239,7 +240,7 @@ void LocationBarView::Init() { ime_inline_autocomplete_view_->SetVisible(false); AddChildView(ime_inline_autocomplete_view_); - const SkColor text_color = GetColor(ToolbarModel::NONE, TEXT); + const SkColor text_color = GetColor(ConnectionSecurityHelper::NONE, TEXT); selected_keyword_view_ = new SelectedKeywordView( bubble_font_list, text_color, background_color, profile()); AddChildView(selected_keyword_view_); @@ -248,13 +249,13 @@ void LocationBarView::Init() { suggested_text_view_->SetHorizontalAlignment(gfx::ALIGN_LEFT); suggested_text_view_->SetAutoColorReadabilityEnabled(false); suggested_text_view_->SetEnabledColor(GetColor( - ToolbarModel::NONE, LocationBarView::DEEMPHASIZED_TEXT)); + ConnectionSecurityHelper::NONE, LocationBarView::DEEMPHASIZED_TEXT)); suggested_text_view_->SetVisible(false); AddChildView(suggested_text_view_); keyword_hint_view_ = new KeywordHintView( - profile(), font_list, - GetColor(ToolbarModel::NONE, LocationBarView::DEEMPHASIZED_TEXT), + profile(), font_list, GetColor(ConnectionSecurityHelper::NONE, + LocationBarView::DEEMPHASIZED_TEXT), background_color); AddChildView(keyword_hint_view_); @@ -313,8 +314,9 @@ bool LocationBarView::IsInitialized() const { return omnibox_view_ != NULL; } -SkColor LocationBarView::GetColor(ToolbarModel::SecurityLevel security_level, - ColorKind kind) const { +SkColor LocationBarView::GetColor( + ConnectionSecurityHelper::SecurityLevel security_level, + ColorKind kind) const { const ui::NativeTheme* native_theme = GetNativeTheme(); switch (kind) { case BACKGROUND: @@ -338,17 +340,17 @@ SkColor LocationBarView::GetColor(ToolbarModel::SecurityLevel security_level, case SECURITY_TEXT: { SkColor color; switch (security_level) { - case ToolbarModel::EV_SECURE: - case ToolbarModel::SECURE: + case ConnectionSecurityHelper::EV_SECURE: + case ConnectionSecurityHelper::SECURE: color = SkColorSetRGB(7, 149, 0); break; - case ToolbarModel::SECURITY_WARNING: - case ToolbarModel::SECURITY_POLICY_WARNING: + case ConnectionSecurityHelper::SECURITY_WARNING: + case ConnectionSecurityHelper::SECURITY_POLICY_WARNING: return GetColor(security_level, DEEMPHASIZED_TEXT); break; - case ToolbarModel::SECURITY_ERROR: + case ConnectionSecurityHelper::SECURITY_ERROR: color = SkColorSetRGB(162, 0, 0); break; @@ -998,8 +1000,8 @@ bool LocationBarView::ShouldShowKeywordBubble() const { } bool LocationBarView::ShouldShowEVBubble() const { - return - (GetToolbarModel()->GetSecurityLevel(false) == ToolbarModel::EV_SECURE); + return (GetToolbarModel()->GetSecurityLevel(false) == + ConnectionSecurityHelper::EV_SECURE); } //////////////////////////////////////////////////////////////////////////////// @@ -1220,7 +1222,7 @@ void LocationBarView::OnPaint(gfx::Canvas* canvas) { // the omnibox background, so we can't just blindly fill our entire bounds. gfx::Rect bounds(GetContentsBounds()); bounds.Inset(GetHorizontalEdgeThickness(), vertical_edge_thickness()); - SkColor color(GetColor(ToolbarModel::NONE, BACKGROUND)); + SkColor color(GetColor(ConnectionSecurityHelper::NONE, BACKGROUND)); if (is_popup_mode_) { canvas->FillRect(bounds, color); } else { diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h index 403388f..11eb05c 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.h +++ b/chrome/browser/ui/views/location_bar/location_bar_view.h @@ -146,7 +146,7 @@ class LocationBarView : public LocationBar, // Returns the appropriate color for the desired kind, based on the user's // system theme. - SkColor GetColor(ToolbarModel::SecurityLevel security_level, + SkColor GetColor(ConnectionSecurityHelper::SecurityLevel security_level, ColorKind kind) const; // Returns the delegate. diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc index b5a2347..56b09d1 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc @@ -137,7 +137,7 @@ OmniboxViewViews::OmniboxViewViews(OmniboxEditController* controller, const gfx::FontList& font_list) : OmniboxView(profile, controller, command_updater), popup_window_mode_(popup_window_mode), - security_level_(ToolbarModel::NONE), + security_level_(ConnectionSecurityHelper::NONE), saved_selection_for_focus_change_(gfx::Range::InvalidRange()), ime_composing_before_change_(false), delete_at_end_pressed_(false), @@ -223,7 +223,8 @@ void OmniboxViewViews::ResetTabState(content::WebContents* web_contents) { } void OmniboxViewViews::Update() { - const ToolbarModel::SecurityLevel old_security_level = security_level_; + const ConnectionSecurityHelper::SecurityLevel old_security_level = + security_level_; security_level_ = controller()->GetToolbarModel()->GetSecurityLevel(false); if (model()->UpdatePermanentText()) { // Something visibly changed. Re-enable URL replacement. @@ -325,7 +326,7 @@ void OmniboxViewViews::OnNativeThemeChanged(const ui::NativeTheme* theme) { views::Textfield::OnNativeThemeChanged(theme); if (location_bar_view_) { SetBackgroundColor(location_bar_view_->GetColor( - ToolbarModel::NONE, LocationBarView::BACKGROUND)); + ConnectionSecurityHelper::NONE, LocationBarView::BACKGROUND)); } EmphasizeURLComponents(); } @@ -631,10 +632,12 @@ void OmniboxViewViews::EmphasizeURLComponents() { // may have incorrectly identified a qualifier as a scheme. SetStyle(gfx::DIAGONAL_STRIKE, false); if (!model()->user_input_in_progress() && model()->CurrentTextIsURL() && - scheme.is_nonempty() && (security_level_ != ToolbarModel::NONE)) { + scheme.is_nonempty() && + (security_level_ != ConnectionSecurityHelper::NONE)) { SkColor security_color = location_bar_view_->GetColor( security_level_, LocationBarView::SECURITY_TEXT); - const bool strike = (security_level_ == ToolbarModel::SECURITY_ERROR); + const bool strike = + (security_level_ == ConnectionSecurityHelper::SECURITY_ERROR); const gfx::Range scheme_range(scheme.begin, scheme.end()); ApplyColor(security_color, scheme_range); ApplyStyle(gfx::DIAGONAL_STRIKE, strike, scheme_range); diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.h b/chrome/browser/ui/views/omnibox/omnibox_view_views.h index a469a3f..8a32350 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.h +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.h @@ -193,7 +193,7 @@ class OmniboxViewViews scoped_ptr<OmniboxPopupView> popup_view_; - ToolbarModel::SecurityLevel security_level_; + ConnectionSecurityHelper::SecurityLevel security_level_; // Selection persisted across temporary text changes, like popup suggestions. gfx::Range saved_temporary_selection_; |