diff options
author | hawk@chromium.org <hawk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-09 23:41:56 +0000 |
---|---|---|
committer | hawk@chromium.org <hawk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-09 23:41:56 +0000 |
commit | 3ed662c37a3d881feb5b6578eb2e0e44586b3f1a (patch) | |
tree | 196ba3d53a87ff7b5bdd75068fe5a8ad8135569b /chrome/browser/cocoa/location_bar_view_mac.mm | |
parent | 3552fa6183e31f36f102ca668955676a4e35516e (diff) | |
download | chromium_src-3ed662c37a3d881feb5b6578eb2e0e44586b3f1a.zip chromium_src-3ed662c37a3d881feb5b6578eb2e0e44586b3f1a.tar.gz chromium_src-3ed662c37a3d881feb5b6578eb2e0e44586b3f1a.tar.bz2 |
Add EV certificate text to the Mac location bar
BUG=10910
TEST=EV sites (e.g., http://www.paypal.com and most bank sites) get a green text description next to the lock icon in the location bar, non-EV (and non-SSL) sites do not
Review URL: http://codereview.chromium.org/216031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28627 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/location_bar_view_mac.mm')
-rw-r--r-- | chrome/browser/cocoa/location_bar_view_mac.mm | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/chrome/browser/cocoa/location_bar_view_mac.mm b/chrome/browser/cocoa/location_bar_view_mac.mm index 0701752..f59d90d 100644 --- a/chrome/browser/cocoa/location_bar_view_mac.mm +++ b/chrome/browser/cocoa/location_bar_view_mac.mm @@ -43,6 +43,12 @@ std::wstring GetKeywordName(Profile* profile, const std::wstring& keyword) { return std::wstring(); } +// Values for the green text color displayed for EV certificates, based +// on the values for kEvTextColor in location_bar_view_gtk.cc. +static const CGFloat kEvTextColorRedComponent = 0.0; +static const CGFloat kEvTextColorGreenComponent = 0.59; +static const CGFloat kEvTextColorBlueComponent = 0.08; + } // namespace LocationBarViewMac::LocationBarViewMac( @@ -267,17 +273,35 @@ NSImage* LocationBarViewMac::GetTabButtonImage() { } void LocationBarViewMac::SetSecurityIcon(ToolbarModel::Icon security_icon) { + std::wstring info_text, info_tooltip; + ToolbarModel::InfoTextType info_text_type = + toolbar_model_->GetInfoText(&info_text, &info_tooltip); + NSColor* color = nil; + NSString* icon_label = nil; + if (info_text_type == ToolbarModel::INFO_EV_TEXT) { + icon_label = base::SysWideToNSString(info_text); + color = + [NSColor colorWithCalibratedRed:kEvTextColorRedComponent + green:kEvTextColorGreenComponent + blue:kEvTextColorBlueComponent + alpha:1.0]; + } + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); AutocompleteTextFieldCell* cell = [field_ autocompleteTextFieldCell]; switch (security_icon) { case ToolbarModel::LOCK_ICON: - [cell setHintIcon:rb.GetNSImageNamed(IDR_LOCK)]; + [cell setHintIcon:rb.GetNSImageNamed(IDR_LOCK) + label:icon_label + color:color]; break; case ToolbarModel::WARNING_ICON: - [cell setHintIcon:rb.GetNSImageNamed(IDR_WARNING)]; + [cell setHintIcon:rb.GetNSImageNamed(IDR_WARNING) + label:icon_label + color:color]; break; case ToolbarModel::NO_ICON: - [cell setHintIcon:nil]; + [cell setHintIcon:nil label:nil color:nil]; break; default: NOTREACHED(); |