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

Unified Diff: chrome/browser/ui/cocoa/location_bar/save_credit_card_decoration.mm

Issue 1718563002: Convert location bar decorations to Material Design (Mac). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@md_toolbar
Patch Set: Fix issue from browser test. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
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..8e31c08c906ee3aa322d768ccc8efd05f7de48a8 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,6 +8,8 @@
#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"
@@ -15,12 +17,22 @@
SaveCreditCardDecoration::SaveCreditCardDecoration(
CommandUpdater* command_updater)
: command_updater_(command_updater) {
- SetImage(NSImageFromImageSkia(gfx::CreateVectorIcon(
- gfx::VectorIconId::CREDIT_CARD, 16, SkColorSetRGB(0x96, 0x96, 0x96))));
}
SaveCreditCardDecoration::~SaveCreditCardDecoration() {}
+void SaveCreditCardDecoration::SetIcon(bool locationBarIsDark) {
+ 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)));
+}
+
NSPoint SaveCreditCardDecoration::GetBubblePointInFrame(NSRect frame) {
const NSRect draw_frame = GetDrawRectInFrame(frame);
return NSMakePoint(NSMidX(draw_frame), NSMaxY(draw_frame));

Powered by Google App Engine
This is Rietveld 408576698