Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: chrome/browser/cocoa/location_bar_view_mac.mm

Issue 216031: Add EV certificate text to the Mac location bar... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/cocoa/location_bar_view_mac.h" 5 #import "chrome/browser/cocoa/location_bar_view_mac.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 25 matching lines...) Expand all
36 // Make sure the TemplateURL still exists. 36 // Make sure the TemplateURL still exists.
37 // TODO(sky): Once LocationBarView adds a listener to the TemplateURLModel 37 // TODO(sky): Once LocationBarView adds a listener to the TemplateURLModel
38 // to track changes to the model, this should become a DCHECK. 38 // to track changes to the model, this should become a DCHECK.
39 const TemplateURL* template_url = 39 const TemplateURL* template_url =
40 profile->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword); 40 profile->GetTemplateURLModel()->GetTemplateURLForKeyword(keyword);
41 if (template_url) 41 if (template_url)
42 return template_url->AdjustedShortNameForLocaleDirection(); 42 return template_url->AdjustedShortNameForLocaleDirection();
43 return std::wstring(); 43 return std::wstring();
44 } 44 }
45 45
46 // Values for the green text color displayed for EV certificates, based
47 // on the values for kEvTextColor in location_bar_view_gtk.cc.
48 static const CGFloat kEvTextColorRedComponent = 0.0;
49 static const CGFloat kEvTextColorGreenComponent = 0.59;
50 static const CGFloat kEvTextColorBlueComponent = 0.08;
51
46 } // namespace 52 } // namespace
47 53
48 LocationBarViewMac::LocationBarViewMac( 54 LocationBarViewMac::LocationBarViewMac(
49 AutocompleteTextField* field, 55 AutocompleteTextField* field,
50 const BubblePositioner* bubble_positioner, 56 const BubblePositioner* bubble_positioner,
51 CommandUpdater* command_updater, 57 CommandUpdater* command_updater,
52 ToolbarModel* toolbar_model, 58 ToolbarModel* toolbar_model,
53 Profile* profile) 59 Profile* profile)
54 : edit_view_(new AutocompleteEditViewMac(this, bubble_positioner, 60 : edit_view_(new AutocompleteEditViewMac(this, bubble_positioner,
55 toolbar_model, profile, command_updater, field)), 61 toolbar_model, profile, command_updater, field)),
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 SkBitmap* skiaBitmap = ResourceBundle::GetSharedInstance(). 266 SkBitmap* skiaBitmap = ResourceBundle::GetSharedInstance().
261 GetBitmapNamed(IDR_LOCATION_BAR_KEYWORD_HINT_TAB); 267 GetBitmapNamed(IDR_LOCATION_BAR_KEYWORD_HINT_TAB);
262 if (skiaBitmap) { 268 if (skiaBitmap) {
263 tab_button_image_.reset([gfx::SkBitmapToNSImage(*skiaBitmap) retain]); 269 tab_button_image_.reset([gfx::SkBitmapToNSImage(*skiaBitmap) retain]);
264 } 270 }
265 } 271 }
266 return tab_button_image_; 272 return tab_button_image_;
267 } 273 }
268 274
269 void LocationBarViewMac::SetSecurityIcon(ToolbarModel::Icon security_icon) { 275 void LocationBarViewMac::SetSecurityIcon(ToolbarModel::Icon security_icon) {
276 std::wstring info_text, info_tooltip;
277 ToolbarModel::InfoTextType info_text_type =
278 toolbar_model_->GetInfoText(&info_text, &info_tooltip);
279 NSColor* color = nil;
280 NSString* icon_label = nil;
281 if (info_text_type == ToolbarModel::INFO_EV_TEXT) {
282 icon_label = base::SysWideToNSString(info_text);
283 color =
284 [NSColor colorWithCalibratedRed:kEvTextColorRedComponent
285 green:kEvTextColorGreenComponent
286 blue:kEvTextColorBlueComponent
287 alpha:1.0];
288 }
289
270 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 290 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
271 AutocompleteTextFieldCell* cell = [field_ autocompleteTextFieldCell]; 291 AutocompleteTextFieldCell* cell = [field_ autocompleteTextFieldCell];
272 switch (security_icon) { 292 switch (security_icon) {
273 case ToolbarModel::LOCK_ICON: 293 case ToolbarModel::LOCK_ICON:
274 [cell setHintIcon:rb.GetNSImageNamed(IDR_LOCK)]; 294 [cell setHintIcon:rb.GetNSImageNamed(IDR_LOCK)
295 label:icon_label
296 color:color];
275 break; 297 break;
276 case ToolbarModel::WARNING_ICON: 298 case ToolbarModel::WARNING_ICON:
277 [cell setHintIcon:rb.GetNSImageNamed(IDR_WARNING)]; 299 [cell setHintIcon:rb.GetNSImageNamed(IDR_WARNING)
300 label:icon_label
301 color:color];
278 break; 302 break;
279 case ToolbarModel::NO_ICON: 303 case ToolbarModel::NO_ICON:
280 [cell setHintIcon:nil]; 304 [cell setHintIcon:nil label:nil color:nil];
281 break; 305 break;
282 default: 306 default:
283 NOTREACHED(); 307 NOTREACHED();
284 break; 308 break;
285 } 309 }
286 [field_ resetFieldEditorFrameIfNeeded]; 310 [field_ resetFieldEditorFrameIfNeeded];
287 } 311 }
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698