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

Side by Side Diff: ui/views/controls/menu/menu_image_util.cc

Issue 12079033: mac: Move bookmark hierarchy arrow from a pdf to a png. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rsesek Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/menu/menu_config_views.cc ('k') | 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 #include "ui/views/controls/menu/menu_image_util.h" 5 #include "ui/views/controls/menu/menu_image_util.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "grit/ui_resources.h" 9 #include "grit/ui_resources.h"
10 #include "third_party/skia/include/effects/SkGradientShader.h" 10 #include "third_party/skia/include/effects/SkGradientShader.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 class SubmenuArrowImageSource : public gfx::CanvasImageSource { 107 class SubmenuArrowImageSource : public gfx::CanvasImageSource {
108 public: 108 public:
109 SubmenuArrowImageSource() 109 SubmenuArrowImageSource()
110 : gfx::CanvasImageSource(GetSubmenuArrowSize(), false) { 110 : gfx::CanvasImageSource(GetSubmenuArrowSize(), false) {
111 } 111 }
112 virtual ~SubmenuArrowImageSource() {} 112 virtual ~SubmenuArrowImageSource() {}
113 113
114 virtual void Draw(gfx::Canvas* canvas) OVERRIDE { 114 virtual void Draw(gfx::Canvas* canvas) OVERRIDE {
115 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 115 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
116 const gfx::ImageSkia* r = rb.GetImageNamed(IDR_MENU_ARROW).ToImageSkia(); 116 const gfx::ImageSkia* r =
117 rb.GetImageNamed(IDR_MENU_HIERARCHY_ARROW).ToImageSkia();
117 canvas->Scale(-1, 1); 118 canvas->Scale(-1, 1);
118 canvas->DrawImageInt(*r, - r->width(), 0); 119 canvas->DrawImageInt(*r, - r->width(), 0);
119 } 120 }
120 121
121 private: 122 private:
122 static gfx::Size GetSubmenuArrowSize() { 123 static gfx::Size GetSubmenuArrowSize() {
123 return ui::ResourceBundle::GetSharedInstance() 124 return ui::ResourceBundle::GetSharedInstance()
124 .GetImageNamed(IDR_MENU_ARROW).ToImageSkia()->size(); 125 .GetImageNamed(IDR_MENU_HIERARCHY_ARROW).ToImageSkia()->size();
125 } 126 }
126 127
127 DISALLOW_COPY_AND_ASSIGN(SubmenuArrowImageSource); 128 DISALLOW_COPY_AND_ASSIGN(SubmenuArrowImageSource);
128 }; 129 };
129 130
130 gfx::ImageSkia* GetRtlSubmenuArrowImage() { 131 gfx::ImageSkia* GetRtlSubmenuArrowImage() {
131 static gfx::ImageSkia* kRtlArrow = NULL; 132 static gfx::ImageSkia* kRtlArrow = NULL;
132 if (!kRtlArrow) { 133 if (!kRtlArrow) {
133 SubmenuArrowImageSource* source = new SubmenuArrowImageSource(); 134 SubmenuArrowImageSource* source = new SubmenuArrowImageSource();
134 kRtlArrow = new gfx::ImageSkia(source, source->size()); 135 kRtlArrow = new gfx::ImageSkia(source, source->size());
(...skipping 23 matching lines...) Expand all
158 } 159 }
159 160
160 static const gfx::ImageSkia* kRadioOn = CreateRadioButtonImage(true); 161 static const gfx::ImageSkia* kRadioOn = CreateRadioButtonImage(true);
161 static const gfx::ImageSkia* kRadioOff = CreateRadioButtonImage(false); 162 static const gfx::ImageSkia* kRadioOff = CreateRadioButtonImage(false);
162 163
163 return selected ? kRadioOn : kRadioOff; 164 return selected ? kRadioOn : kRadioOff;
164 } 165 }
165 166
166 const gfx::ImageSkia* GetSubmenuArrowImage() { 167 const gfx::ImageSkia* GetSubmenuArrowImage() {
167 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 168 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
168 return base::i18n::IsRTL() ? GetRtlSubmenuArrowImage() 169 return base::i18n::IsRTL()
169 : rb.GetImageNamed(IDR_MENU_ARROW).ToImageSkia(); 170 ? GetRtlSubmenuArrowImage()
171 : rb.GetImageNamed(IDR_MENU_HIERARCHY_ARROW).ToImageSkia();
170 } 172 }
171 173
172 } // namespace views 174 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_config_views.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698