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

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

Issue 2375033002: cocoa browser: remove non-MD location bar support (Closed)
Patch Set: Created 4 years, 2 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/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"
(...skipping 19 matching lines...) Expand all
30 SetVisible(true); 30 SetVisible(true);
31 SetStarred(false, false); 31 SetStarred(false, false);
32 } 32 }
33 33
34 StarDecoration::~StarDecoration() { 34 StarDecoration::~StarDecoration() {
35 } 35 }
36 36
37 void StarDecoration::SetStarred(bool starred, bool location_bar_is_dark) { 37 void StarDecoration::SetStarred(bool starred, bool location_bar_is_dark) {
38 starred_ = starred; 38 starred_ = starred;
39 const int tip_id = starred ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR; 39 const int tip_id = starred ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR;
40 if (!ui::MaterialDesignController::IsModeMaterial()) {
41 const int image_id = starred ? IDR_STAR_LIT : IDR_STAR;
42 SetImage(OmniboxViewMac::ImageForResource(image_id));
43 tooltip_.reset([l10n_util::GetNSStringWithFixup(tip_id) retain]);
44 return;
45 }
46 SetImage(GetMaterialIcon(location_bar_is_dark)); 40 SetImage(GetMaterialIcon(location_bar_is_dark));
47 tooltip_.reset([l10n_util::GetNSStringWithFixup(tip_id) retain]); 41 tooltip_.reset([l10n_util::GetNSStringWithFixup(tip_id) retain]);
48 } 42 }
49 43
50 NSPoint StarDecoration::GetBubblePointInFrame(NSRect frame) { 44 NSPoint StarDecoration::GetBubblePointInFrame(NSRect frame) {
51 const NSRect draw_frame = GetDrawRectInFrame(frame); 45 const NSRect draw_frame = GetDrawRectInFrame(frame);
52 return NSMakePoint(NSMidX(draw_frame), 46 return NSMakePoint(NSMidX(draw_frame),
53 NSMaxY(draw_frame) - kStarPointYOffset); 47 NSMaxY(draw_frame) - kStarPointYOffset);
54 } 48 }
55 49
(...skipping 14 matching lines...) Expand all
70 if (location_bar_is_dark) { 64 if (location_bar_is_dark) {
71 return starred_ ? gfx::kGoogleBlue300 : SkColorSetA(SK_ColorWHITE, 0xCC); 65 return starred_ ? gfx::kGoogleBlue300 : SkColorSetA(SK_ColorWHITE, 0xCC);
72 } 66 }
73 return starred_ ? gfx::kGoogleBlue500 : gfx::kChromeIconGrey; 67 return starred_ ? gfx::kGoogleBlue500 : gfx::kChromeIconGrey;
74 } 68 }
75 69
76 gfx::VectorIconId StarDecoration::GetMaterialVectorIconId() const { 70 gfx::VectorIconId StarDecoration::GetMaterialVectorIconId() const {
77 return starred_ ? gfx::VectorIconId::LOCATION_BAR_STAR_ACTIVE 71 return starred_ ? gfx::VectorIconId::LOCATION_BAR_STAR_ACTIVE
78 : gfx::VectorIconId::LOCATION_BAR_STAR; 72 : gfx::VectorIconId::LOCATION_BAR_STAR;
79 } 73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698