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

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

Issue 1680773006: Implement Material Design for Mac toolbar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@md_master
Patch Set: Change button hover and pressed styles. 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/star_decoration.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/star_decoration.mm b/chrome/browser/ui/cocoa/location_bar/star_decoration.mm
index 48109d3f273d5d4ac6a26a66a6b17ad3de733c40..d1937f9323d2fa1bbba6efb7603d49419e46ed1c 100644
--- a/chrome/browser/ui/cocoa/location_bar/star_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/star_decoration.mm
@@ -7,10 +7,15 @@
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/command_updater.h"
#import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
+#import "chrome/browser/ui/cocoa/themed_window.h"
#include "chrome/grit/generated_resources.h"
#include "grit/components_strings.h"
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util_mac.h"
+#include "ui/base/material_design/material_design_controller.h"
+#include "ui/gfx/image/image_skia_util_mac.h"
+#include "ui/gfx/paint_vector_icon.h"
+#include "ui/gfx/vector_icons_public.h"
namespace {
@@ -25,17 +30,32 @@ const CGFloat kStarPointYOffset = 2.0;
StarDecoration::StarDecoration(CommandUpdater* command_updater)
: command_updater_(command_updater) {
SetVisible(true);
- SetStarred(false);
+ SetStarred(false, false);
}
StarDecoration::~StarDecoration() {
}
-void StarDecoration::SetStarred(bool starred) {
+void StarDecoration::SetStarred(bool starred, bool locationBarIsDark) {
starred_ = starred;
const int image_id = starred ? IDR_STAR_LIT : IDR_STAR;
const int tip_id = starred ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR;
- SetImage(OmniboxViewMac::ImageForResource(image_id));
+ if (ui::MaterialDesignController::IsModeMaterial()) {
+ NSImage* theImage;
+ gfx::VectorIconId iconId = starred_ ?
+ gfx::VectorIconId::LOCATION_BAR_STAR_ACTIVE :
+ gfx::VectorIconId::LOCATION_BAR_STAR;
+ if (locationBarIsDark) {
+ theImage = NSImageFromImageSkia(gfx::CreateVectorIcon(
+ iconId, 16, SK_ColorWHITE));
+ } else {
+ theImage = NSImageFromImageSkia(gfx::CreateVectorIcon(
+ iconId, 16, SkColorSetARGB(0xFF, 0x5A, 0x5A, 0x5A)));
+ }
+ SetImage(theImage);
+ } else {
+ SetImage(OmniboxViewMac::ImageForResource(image_id));
+ }
tooltip_.reset([l10n_util::GetNSStringWithFixup(tip_id) retain]);
}
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/star_decoration.h ('k') | chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698