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

Side by Side Diff: ui/gfx/native_theme_aura.cc

Issue 9101004: Factor more colors into NativeTheme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 8 years, 11 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/gfx/native_theme_aura.h ('k') | ui/gfx/native_theme_base.h » ('j') | 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) 2011 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/gfx/native_theme_aura.h" 5 #include "ui/gfx/native_theme_aura.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h"
8 #include "grit/gfx_resources.h" 9 #include "grit/gfx_resources.h"
9 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/gfx/size.h" 11 #include "ui/gfx/size.h"
11 #include "ui/gfx/skbitmap_operations.h" 12 #include "ui/gfx/skbitmap_operations.h"
12 13
13 namespace { 14 namespace {
14 15
15 const SkColor kMenuBackgroundColor = SkColorSetRGB(0xed, 0xed, 0xed); 16 const SkColor kMenuBackgroundColor = SkColorSetRGB(0xED, 0xED, 0xED);
17
18 // Theme colors returned by GetSystemColor().
19 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128);
20 // Dialogs:
21 const SkColor kDialogBackgroundColor = SK_ColorWHITE;
22 // FocusableBorder:
23 const SkColor kFocusedBorderColor = SkColorSetRGB(0x4D, 0x90, 0xFE);
24 const SkColor kUnfocusedBorderColor = SkColorSetRGB(0xD9, 0xD9, 0xD9);
25 // TextButton:
26 const SkColor kTextButtonBackgroundColor = SkColorSetRGB(0xDE, 0xDE, 0xDE);
27 const SkColor kTextButtonEnabledColor = SkColorSetRGB(0x44, 0x44, 0x44);
28 const SkColor kTextButtonDisabledColor = SkColorSetRGB(0x99, 0x99, 0x99);
29 const SkColor kTextButtonHighlightColor = SkColorSetRGB(0, 0, 0);
30 const SkColor kTextButtonHoverColor = kTextButtonEnabledColor;
31 // MenuItem:
32 const SkColor kEnabledMenuItemForegroundColor = SK_ColorBLACK;
33 const SkColor kDisabledMenuItemForegroundColor =
34 SkColorSetRGB(0x80, 0x80, 0x80);
35 const SkColor kFocusedMenuItemBackgroundColor = SkColorSetRGB(0xDC, 0xE4, 0xFA);
16 36
17 } // namespace 37 } // namespace
18 38
19 namespace gfx { 39 namespace gfx {
20 40
21 // static 41 // static
22 const NativeTheme* NativeTheme::instance() { 42 const NativeTheme* NativeTheme::instance() {
23 return NativeThemeAura::instance(); 43 return NativeThemeAura::instance();
24 } 44 }
25 45
26 // static 46 // static
27 const NativeThemeAura* NativeThemeAura::instance() { 47 const NativeThemeAura* NativeThemeAura::instance() {
28 CR_DEFINE_STATIC_LOCAL(NativeThemeAura, s_native_theme, ()); 48 CR_DEFINE_STATIC_LOCAL(NativeThemeAura, s_native_theme, ());
29 return &s_native_theme; 49 return &s_native_theme;
30 } 50 }
31 51
32 NativeThemeAura::NativeThemeAura() { 52 NativeThemeAura::NativeThemeAura() {
33 } 53 }
34 54
35 NativeThemeAura::~NativeThemeAura() { 55 NativeThemeAura::~NativeThemeAura() {
36 } 56 }
37 57
58 SkColor NativeThemeAura::GetSystemColor(ColorId color_id) const {
59 // This implementation returns hardcoded colors.
60 switch (color_id) {
61
62 // Dialogs
63 case kColorId_DialogBackground:
64 return kDialogBackgroundColor;
65
66 // FocusableBorder
67 case kColorId_FocusedBorderColor:
68 return kFocusedBorderColor;
69 case kColorId_UnfocusedBorderColor:
70 return kUnfocusedBorderColor;
71
72 // TextButton
73 case kColorId_TextButtonBackgroundColor:
74 return kTextButtonBackgroundColor;
75 case kColorId_TextButtonEnabledColor:
76 return kTextButtonEnabledColor;
77 case kColorId_TextButtonDisabledColor:
78 return kTextButtonDisabledColor;
79 case kColorId_TextButtonHighlightColor:
80 return kTextButtonHighlightColor;
81 case kColorId_TextButtonHoverColor:
82 return kTextButtonHoverColor;
83
84 // MenuItem
85 case kColorId_EnabledMenuItemForegroundColor:
86 return kEnabledMenuItemForegroundColor;
87 case kColorId_DisabledMenuItemForegroundColor:
88 return kDisabledMenuItemForegroundColor;
89 case kColorId_FocusedMenuItemBackgroundColor:
90 return kFocusedMenuItemBackgroundColor;
91
92 default:
93 NOTREACHED() << "Invalid color_id: " << color_id;
94 break;
95 }
96
97 // Return InvalidColor
98 return kInvalidColorIdColor;
99 }
100
38 void NativeThemeAura::PaintMenuPopupBackground( 101 void NativeThemeAura::PaintMenuPopupBackground(
39 SkCanvas* canvas, 102 SkCanvas* canvas,
40 State state, 103 State state,
41 const gfx::Rect& rect, 104 const gfx::Rect& rect,
42 const MenuListExtraParams& menu_list) const { 105 const MenuListExtraParams& menu_list) const {
43 canvas->drawColor(kMenuBackgroundColor, SkXfermode::kSrc_Mode); 106 canvas->drawColor(kMenuBackgroundColor, SkXfermode::kSrc_Mode);
44 } 107 }
45 108
46 void NativeThemeAura::PaintScrollbarTrack( 109 void NativeThemeAura::PaintScrollbarTrack(
47 SkCanvas* canvas, 110 SkCanvas* canvas,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 SkBitmapOperations::CreateTransposedBtmap(*vertical_bitmap); 231 SkBitmapOperations::CreateTransposedBtmap(*vertical_bitmap);
169 SkBitmap* horizontal_bitmap = new SkBitmap(transposed_bitmap); 232 SkBitmap* horizontal_bitmap = new SkBitmap(transposed_bitmap);
170 233
171 horizontal_bitmaps_[resource_id] = horizontal_bitmap; 234 horizontal_bitmaps_[resource_id] = horizontal_bitmap;
172 return horizontal_bitmap; 235 return horizontal_bitmap;
173 } 236 }
174 return NULL; 237 return NULL;
175 } 238 }
176 239
177 } // namespace gfx 240 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/native_theme_aura.h ('k') | ui/gfx/native_theme_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698