Index: chrome/browser/ui/cocoa/location_bar/save_credit_card_decoration.mm |
diff --git a/chrome/browser/ui/cocoa/location_bar/save_credit_card_decoration.mm b/chrome/browser/ui/cocoa/location_bar/save_credit_card_decoration.mm |
index 708ddc6a7dd7e788456c4c1619122168f954e0eb..85d5a0bb7030b1f839e86d91b8e9dfab5612840f 100644 |
--- a/chrome/browser/ui/cocoa/location_bar/save_credit_card_decoration.mm |
+++ b/chrome/browser/ui/cocoa/location_bar/save_credit_card_decoration.mm |
@@ -8,19 +8,37 @@ |
#include "chrome/browser/command_updater.h" |
#include "chrome/grit/generated_resources.h" |
#include "ui/base/l10n/l10n_util_mac.h" |
+#include "ui/base/material_design/material_design_controller.h" |
+#include "ui/gfx/color_palette.h" |
#include "ui/gfx/image/image_skia_util_mac.h" |
#include "ui/gfx/paint_vector_icon.h" |
#include "ui/gfx/vector_icons_public.h" |
SaveCreditCardDecoration::SaveCreditCardDecoration( |
CommandUpdater* command_updater) |
- : command_updater_(command_updater) { |
- SetImage(NSImageFromImageSkia(gfx::CreateVectorIcon( |
- gfx::VectorIconId::CREDIT_CARD, 16, SkColorSetRGB(0x96, 0x96, 0x96)))); |
+ : command_updater_(command_updater), |
+ icon_initialized_(false) { |
} |
SaveCreditCardDecoration::~SaveCreditCardDecoration() {} |
+void SaveCreditCardDecoration::SetIcon(bool locationBarIsDark) { |
+ if (icon_initialized_) |
Avi (use Gerrit)
2016/03/15 16:03:06
What happens if they change themes? This bool lock
shrike
2016/03/15 17:54:56
Thank you for catching this.
I have been testing
Avi (use Gerrit)
2016/03/15 20:01:33
Thanks for checking.
|
+ return; |
+ |
+ SkColor theColor = gfx::kPlaceholderColor; |
+ if (ui::MaterialDesignController::IsModeMaterial()) { |
+ theColor = locationBarIsDark ? SK_ColorWHITE : gfx::kChromeIconGrey; |
+ } else { |
+ theColor = SkColorSetRGB(0x96, 0x96, 0x96); |
+ } |
+ |
+ SetImage(NSImageFromImageSkia(gfx::CreateVectorIcon( |
+ gfx::VectorIconId::CREDIT_CARD, 16, theColor))); |
+ |
+ icon_initialized_ = true; |
+} |
+ |
NSPoint SaveCreditCardDecoration::GetBubblePointInFrame(NSRect frame) { |
const NSRect draw_frame = GetDrawRectInFrame(frame); |
return NSMakePoint(NSMidX(draw_frame), NSMaxY(draw_frame)); |