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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.mm

Issue 2644903004: Move around more vector icons. (Closed)
Patch Set: fix comment Created 3 years, 11 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/cocoa/autofill/autofill_popup_view_cocoa.h" 5 #import "chrome/browser/ui/cocoa/autofill/autofill_popup_view_cocoa.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" 11 #include "chrome/browser/ui/autofill/autofill_popup_controller.h"
12 #include "chrome/browser/ui/autofill/autofill_popup_layout_model.h" 12 #include "chrome/browser/ui/autofill/autofill_popup_layout_model.h"
13 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h" 13 #include "chrome/browser/ui/cocoa/autofill/autofill_popup_view_bridge.h"
14 #include "components/autofill/core/browser/popup_item_ids.h" 14 #include "components/autofill/core/browser/popup_item_ids.h"
15 #include "components/autofill/core/browser/suggestion.h" 15 #include "components/autofill/core/browser/suggestion.h"
16 #include "components/toolbar/vector_icons.h"
16 #include "skia/ext/skia_utils_mac.h" 17 #include "skia/ext/skia_utils_mac.h"
17 #include "third_party/skia/include/core/SkColor.h" 18 #include "third_party/skia/include/core/SkColor.h"
18 #include "ui/base/cocoa/window_size_constants.h" 19 #include "ui/base/cocoa/window_size_constants.h"
19 #include "ui/base/resource/resource_bundle.h" 20 #include "ui/base/resource/resource_bundle.h"
20 #include "ui/gfx/color_palette.h" 21 #include "ui/gfx/color_palette.h"
21 #include "ui/gfx/font_list.h" 22 #include "ui/gfx/font_list.h"
22 #include "ui/gfx/geometry/point.h" 23 #include "ui/gfx/geometry/point.h"
23 #include "ui/gfx/geometry/rect.h" 24 #include "ui/gfx/geometry/rect.h"
24 #include "ui/gfx/image/image.h" 25 #include "ui/gfx/image/image.h"
25 #include "ui/gfx/image/image_skia_util_mac.h" 26 #include "ui/gfx/image/image_skia_util_mac.h"
26 #include "ui/gfx/paint_vector_icon.h" 27 #include "ui/gfx/paint_vector_icon.h"
27 #include "ui/gfx/vector_icons_public.h"
28 #include "ui/native_theme/native_theme.h" 28 #include "ui/native_theme/native_theme.h"
29 #include "ui/native_theme/native_theme_mac.h" 29 #include "ui/native_theme/native_theme_mac.h"
30 30
31 using autofill::AutofillPopupView; 31 using autofill::AutofillPopupView;
32 using autofill::AutofillPopupLayoutModel; 32 using autofill::AutofillPopupLayoutModel;
33 33
34 @interface AutofillPopupViewCocoa () 34 @interface AutofillPopupViewCocoa ()
35 35
36 #pragma mark - 36 #pragma mark -
37 #pragma mark Private methods 37 #pragma mark Private methods
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 - (NSImage*)iconAtIndex:(size_t)index { 284 - (NSImage*)iconAtIndex:(size_t)index {
285 const int kHttpWarningIconWidth = 16; 285 const int kHttpWarningIconWidth = 16;
286 const base::string16& icon = controller_->GetSuggestionAt(index).icon; 286 const base::string16& icon = controller_->GetSuggestionAt(index).icon;
287 if (icon.empty()) 287 if (icon.empty())
288 return nil; 288 return nil;
289 289
290 // For the Form-Not-Secure warning about password/credit card fields on HTTP 290 // For the Form-Not-Secure warning about password/credit card fields on HTTP
291 // pages, reuse the omnibox vector icons. 291 // pages, reuse the omnibox vector icons.
292 if (icon == base::ASCIIToUTF16("httpWarning")) { 292 if (icon == base::ASCIIToUTF16("httpWarning")) {
293 return NSImageFromImageSkiaWithColorSpace( 293 return NSImageFromImageSkiaWithColorSpace(
294 gfx::CreateVectorIcon(gfx::VectorIconId::LOCATION_BAR_HTTP, 294 gfx::CreateVectorIcon(toolbar::kHttpIcon, kHttpWarningIconWidth,
295 kHttpWarningIconWidth, gfx::kChromeIconGrey), 295 gfx::kChromeIconGrey),
296 base::mac::GetSRGBColorSpace()); 296 base::mac::GetSRGBColorSpace());
297 } 297 }
298 298
299 if (icon == base::ASCIIToUTF16("httpsInvalid")) { 299 if (icon == base::ASCIIToUTF16("httpsInvalid")) {
300 return NSImageFromImageSkiaWithColorSpace( 300 return NSImageFromImageSkiaWithColorSpace(
301 gfx::CreateVectorIcon(gfx::VectorIconId::LOCATION_BAR_HTTPS_INVALID, 301 gfx::CreateVectorIcon(toolbar::kHttpsInvalidIcon, kHttpWarningIconWidth,
302 kHttpWarningIconWidth, gfx::kGoogleRed700), 302 gfx::kGoogleRed700),
303 base::mac::GetSRGBColorSpace()); 303 base::mac::GetSRGBColorSpace());
304 } 304 }
305 305
306 int iconId = delegate_->GetIconResourceID(icon); 306 int iconId = delegate_->GetIconResourceID(icon);
307 DCHECK_NE(-1, iconId); 307 DCHECK_NE(-1, iconId);
308 308
309 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 309 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
310 return rb.GetNativeImageNamed(iconId).ToNSImage(); 310 return rb.GetNativeImageNamed(iconId).ToNSImage();
311 } 311 }
312 312
313 @end 313 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/bookmarks/bookmark_utils.cc ('k') | chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698