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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/star_decoration.mm

Issue 1787023003: Change star decoration to blue under MD (Mac). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | 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) 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/location_bar/star_decoration.h" 5 #import "chrome/browser/ui/cocoa/location_bar/star_decoration.h"
6 6
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/command_updater.h" 8 #include "chrome/browser/command_updater.h"
9 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" 9 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h"
10 #import "chrome/browser/ui/cocoa/themed_window.h" 10 #import "chrome/browser/ui/cocoa/themed_window.h"
11 #include "chrome/grit/generated_resources.h" 11 #include "chrome/grit/generated_resources.h"
12 #include "grit/components_strings.h" 12 #include "grit/components_strings.h"
13 #include "grit/theme_resources.h" 13 #include "grit/theme_resources.h"
14 #include "ui/base/l10n/l10n_util_mac.h" 14 #include "ui/base/l10n/l10n_util_mac.h"
15 #include "ui/base/material_design/material_design_controller.h" 15 #include "ui/base/material_design/material_design_controller.h"
16 #include "ui/gfx/color_palette.h"
16 #include "ui/gfx/image/image_skia_util_mac.h" 17 #include "ui/gfx/image/image_skia_util_mac.h"
17 #include "ui/gfx/paint_vector_icon.h" 18 #include "ui/gfx/paint_vector_icon.h"
18 #include "ui/gfx/vector_icons_public.h" 19 #include "ui/gfx/vector_icons_public.h"
19 20
20 namespace { 21 namespace {
21 22
22 // The info-bubble point should look like it points to the point 23 // The info-bubble point should look like it points to the point
23 // between the star's lower tips. The popup should be where the 24 // between the star's lower tips. The popup should be where the
24 // Omnibox popup ends up (2px below field). Determined via Pixie.app 25 // Omnibox popup ends up (2px below field). Determined via Pixie.app
25 // magnification. 26 // magnification.
(...skipping 12 matching lines...) Expand all
38 39
39 void StarDecoration::SetStarred(bool starred, bool locationBarIsDark) { 40 void StarDecoration::SetStarred(bool starred, bool locationBarIsDark) {
40 starred_ = starred; 41 starred_ = starred;
41 const int image_id = starred ? IDR_STAR_LIT : IDR_STAR; 42 const int image_id = starred ? IDR_STAR_LIT : IDR_STAR;
42 const int tip_id = starred ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR; 43 const int tip_id = starred ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR;
43 if (ui::MaterialDesignController::IsModeMaterial()) { 44 if (ui::MaterialDesignController::IsModeMaterial()) {
44 NSImage* theImage; 45 NSImage* theImage;
45 gfx::VectorIconId iconId = starred_ ? 46 gfx::VectorIconId iconId = starred_ ?
46 gfx::VectorIconId::LOCATION_BAR_STAR_ACTIVE : 47 gfx::VectorIconId::LOCATION_BAR_STAR_ACTIVE :
47 gfx::VectorIconId::LOCATION_BAR_STAR; 48 gfx::VectorIconId::LOCATION_BAR_STAR;
49 SkColor starColor = gfx::kPlaceholderColor;
48 if (locationBarIsDark) { 50 if (locationBarIsDark) {
49 theImage = NSImageFromImageSkia(gfx::CreateVectorIcon( 51 starColor = SK_ColorWHITE;
50 iconId, 16, SK_ColorWHITE)); 52 } else if (starred_) {
53 starColor = gfx::kGoogleBlue500;
51 } else { 54 } else {
52 theImage = NSImageFromImageSkia(gfx::CreateVectorIcon( 55 starColor = gfx::kChromeIconGrey;
53 iconId, 16, SkColorSetARGB(0xFF, 0x5A, 0x5A, 0x5A)));
54 } 56 }
57 theImage = NSImageFromImageSkia(gfx::CreateVectorIcon(
58 iconId, 16, starColor));
55 SetImage(theImage); 59 SetImage(theImage);
56 } else { 60 } else {
57 SetImage(OmniboxViewMac::ImageForResource(image_id)); 61 SetImage(OmniboxViewMac::ImageForResource(image_id));
58 } 62 }
59 tooltip_.reset([l10n_util::GetNSStringWithFixup(tip_id) retain]); 63 tooltip_.reset([l10n_util::GetNSStringWithFixup(tip_id) retain]);
60 } 64 }
61 65
62 NSPoint StarDecoration::GetBubblePointInFrame(NSRect frame) { 66 NSPoint StarDecoration::GetBubblePointInFrame(NSRect frame) {
63 const NSRect draw_frame = GetDrawRectInFrame(frame); 67 const NSRect draw_frame = GetDrawRectInFrame(frame);
64 return NSMakePoint(NSMidX(draw_frame), 68 return NSMakePoint(NSMidX(draw_frame),
65 NSMaxY(draw_frame) - kStarPointYOffset); 69 NSMaxY(draw_frame) - kStarPointYOffset);
66 } 70 }
67 71
68 bool StarDecoration::AcceptsMousePress() { 72 bool StarDecoration::AcceptsMousePress() {
69 return true; 73 return true;
70 } 74 }
71 75
72 bool StarDecoration::OnMousePressed(NSRect frame, NSPoint location) { 76 bool StarDecoration::OnMousePressed(NSRect frame, NSPoint location) {
73 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE); 77 command_updater_->ExecuteCommand(IDC_BOOKMARK_PAGE);
74 return true; 78 return true;
75 } 79 }
76 80
77 NSString* StarDecoration::GetToolTip() { 81 NSString* StarDecoration::GetToolTip() {
78 return tooltip_.get(); 82 return tooltip_.get();
79 } 83 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698