OLD | NEW |
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 kSelectedIndicatorSize / 2, paint); | 91 kSelectedIndicatorSize / 2, paint); |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 private: | 95 private: |
96 bool selected_; | 96 bool selected_; |
97 | 97 |
98 DISALLOW_COPY_AND_ASSIGN(RadioButtonImageSource); | 98 DISALLOW_COPY_AND_ASSIGN(RadioButtonImageSource); |
99 }; | 99 }; |
100 | 100 |
101 gfx::ImageSkia* CreateRadioButtonImage(bool selected) { | |
102 RadioButtonImageSource* source = new RadioButtonImageSource(selected); | |
103 return new gfx::ImageSkia(source, source->size()); | |
104 } | |
105 | |
106 class SubmenuArrowImageSource : public gfx::CanvasImageSource { | 101 class SubmenuArrowImageSource : public gfx::CanvasImageSource { |
107 public: | 102 public: |
108 SubmenuArrowImageSource(int image_id) | 103 SubmenuArrowImageSource(int image_id) |
109 : gfx::CanvasImageSource(ui::ResourceBundle::GetSharedInstance(). | 104 : gfx::CanvasImageSource(ui::ResourceBundle::GetSharedInstance(). |
110 GetImageNamed(image_id).ToImageSkia()->size(), false), | 105 GetImageNamed(image_id).ToImageSkia()->size(), false), |
111 image_id_(image_id) {} | 106 image_id_(image_id) {} |
112 virtual ~SubmenuArrowImageSource() {} | 107 virtual ~SubmenuArrowImageSource() {} |
113 | 108 |
114 virtual void Draw(gfx::Canvas* canvas) OVERRIDE { | 109 virtual void Draw(gfx::Canvas* canvas) OVERRIDE { |
115 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 110 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 int image_id = selected ? IDR_MENU_RADIO_SELECTED : IDR_MENU_RADIO_EMPTY; | 161 int image_id = selected ? IDR_MENU_RADIO_SELECTED : IDR_MENU_RADIO_EMPTY; |
167 return ui::ResourceBundle::GetSharedInstance().GetImageNamed(image_id). | 162 return ui::ResourceBundle::GetSharedInstance().GetImageNamed(image_id). |
168 AsImageSkia(); | 163 AsImageSkia(); |
169 } | 164 } |
170 | 165 |
171 gfx::ImageSkia GetSubmenuArrowImage(bool dark_background) { | 166 gfx::ImageSkia GetSubmenuArrowImage(bool dark_background) { |
172 return GetRtlSubmenuArrowImage(base::i18n::IsRTL(), dark_background); | 167 return GetRtlSubmenuArrowImage(base::i18n::IsRTL(), dark_background); |
173 } | 168 } |
174 | 169 |
175 } // namespace views | 170 } // namespace views |
OLD | NEW |