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

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

Issue 9151011: Revert 116894 - Factor more colors into NativeTheme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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"
9 #include "grit/gfx_resources.h" 8 #include "grit/gfx_resources.h"
10 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
11 #include "ui/gfx/size.h" 10 #include "ui/gfx/size.h"
12 #include "ui/gfx/skbitmap_operations.h" 11 #include "ui/gfx/skbitmap_operations.h"
13 12
14 namespace { 13 namespace {
15 14
16 const SkColor kMenuBackgroundColor = SkColorSetRGB(0xed, 0xed, 0xed); 15 const SkColor kMenuBackgroundColor = SkColorSetRGB(0xed, 0xed, 0xed);
17 16
18 // Theme colors returned by GetSystemColor().
19 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128);
20 // Dialogs:
21 const SkColor kDialogBackgroundColor = SkColorSetRGB(200, 200, 200);
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);
36
37 } // namespace 17 } // namespace
38 18
39 namespace gfx { 19 namespace gfx {
40 20
41 // static 21 // static
42 const NativeTheme* NativeTheme::instance() { 22 const NativeTheme* NativeTheme::instance() {
43 return NativeThemeAura::instance(); 23 return NativeThemeAura::instance();
44 } 24 }
45 25
46 // static 26 // static
47 const NativeThemeAura* NativeThemeAura::instance() { 27 const NativeThemeAura* NativeThemeAura::instance() {
48 CR_DEFINE_STATIC_LOCAL(NativeThemeAura, s_native_theme, ()); 28 CR_DEFINE_STATIC_LOCAL(NativeThemeAura, s_native_theme, ());
49 return &s_native_theme; 29 return &s_native_theme;
50 } 30 }
51 31
52 NativeThemeAura::NativeThemeAura() { 32 NativeThemeAura::NativeThemeAura() {
53 } 33 }
54 34
55 NativeThemeAura::~NativeThemeAura() { 35 NativeThemeAura::~NativeThemeAura() {
56 } 36 }
57 37
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 default:
92 NOTREACHED() << "Invalid color_id: " << color_id;
93 break;
94 }
95
96 // Return InvalidColor
97 return kInvalidColorIdColor;
98 }
99
100 void NativeThemeAura::PaintMenuPopupBackground( 38 void NativeThemeAura::PaintMenuPopupBackground(
101 SkCanvas* canvas, 39 SkCanvas* canvas,
102 State state, 40 State state,
103 const gfx::Rect& rect, 41 const gfx::Rect& rect,
104 const MenuListExtraParams& menu_list) const { 42 const MenuListExtraParams& menu_list) const {
105 canvas->drawColor(kMenuBackgroundColor, SkXfermode::kSrc_Mode); 43 canvas->drawColor(kMenuBackgroundColor, SkXfermode::kSrc_Mode);
106 } 44 }
107 45
108 void NativeThemeAura::PaintScrollbarTrack( 46 void NativeThemeAura::PaintScrollbarTrack(
109 SkCanvas* canvas, 47 SkCanvas* canvas,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 SkBitmapOperations::CreateTransposedBtmap(*vertical_bitmap); 168 SkBitmapOperations::CreateTransposedBtmap(*vertical_bitmap);
231 SkBitmap* horizontal_bitmap = new SkBitmap(transposed_bitmap); 169 SkBitmap* horizontal_bitmap = new SkBitmap(transposed_bitmap);
232 170
233 horizontal_bitmaps_[resource_id] = horizontal_bitmap; 171 horizontal_bitmaps_[resource_id] = horizontal_bitmap;
234 return horizontal_bitmap; 172 return horizontal_bitmap;
235 } 173 }
236 return NULL; 174 return NULL;
237 } 175 }
238 176
239 } // namespace gfx 177 } // 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