Chromium Code Reviews| OLD | NEW |
|---|---|
| 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); |
| 16 | 17 |
| 18 // Theme colors returned by GetSystemColor(). | |
| 19 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); | |
| 20 // Dialogs: | |
| 21 const SkColor kDefaultDialogBackgroundColor = SkColorSetRGB(200, 200, 200); | |
|
benrg
2012/01/06 19:38:01
Change kDefault* to kAura* or just k* since these
Emmanuel Saint-loubert-Bié
2012/01/06 21:51:07
Done.
| |
| 22 // FocusableBorder: | |
| 23 const SkColor kDefaultFocusedBorderColor = SkColorSetRGB(0x4D, 0x90, 0xFE); | |
| 24 const SkColor kDefaultUnfocusedBorderColor = SkColorSetRGB(0xD9, 0xD9, 0xD9); | |
| 25 // TextButton: | |
| 26 const SkColor kDefaultTextButtonBackgroundColor = | |
| 27 SkColorSetRGB(0xDE, 0xDE, 0xDE); | |
| 28 const SkColor kDefaultTextButtonEnabledColor = SkColorSetRGB(0x44, 0x44, 0x44); | |
| 29 const SkColor kDefaultTextButtonDisabledColor = SkColorSetRGB(0x99, 0x99, 0x99); | |
| 30 const SkColor kDefaultTextButtonHighlightColor = SkColorSetRGB(0, 0, 0); | |
| 31 const SkColor kDefaultTextButtonHoverColor = kDefaultTextButtonEnabledColor; | |
| 32 // MenuItem: | |
| 33 const SkColor kDefaultEnabledMenuItemForegroundColor = SK_ColorBLACK; | |
| 34 const SkColor kDefaultDisabledMenuItemForegroundColor = | |
| 35 SkColorSetRGB(0x80, 0x80, 0x80); | |
| 36 const SkColor kDefaultFocusedMenuItemBackgroundColor = | |
| 37 SkColorSetRGB(0xDC, 0xE4, 0xFA); | |
|
benrg
2012/01/06 19:38:01
These are the ChromeOS values. The !defined(OS_CHR
Emmanuel Saint-loubert-Bié
2012/01/06 21:51:07
I hesitated and I think we should start with the c
| |
| 38 | |
| 17 } // namespace | 39 } // namespace |
| 18 | 40 |
| 19 namespace gfx { | 41 namespace gfx { |
| 20 | 42 |
| 21 // static | 43 // static |
| 22 const NativeTheme* NativeTheme::instance() { | 44 const NativeTheme* NativeTheme::instance() { |
| 23 return NativeThemeAura::instance(); | 45 return NativeThemeAura::instance(); |
| 24 } | 46 } |
| 25 | 47 |
| 26 // static | 48 // static |
| 27 const NativeThemeAura* NativeThemeAura::instance() { | 49 const NativeThemeAura* NativeThemeAura::instance() { |
| 28 CR_DEFINE_STATIC_LOCAL(NativeThemeAura, s_native_theme, ()); | 50 CR_DEFINE_STATIC_LOCAL(NativeThemeAura, s_native_theme, ()); |
| 29 return &s_native_theme; | 51 return &s_native_theme; |
| 30 } | 52 } |
| 31 | 53 |
| 32 NativeThemeAura::NativeThemeAura() { | 54 NativeThemeAura::NativeThemeAura() { |
| 33 } | 55 } |
| 34 | 56 |
| 35 NativeThemeAura::~NativeThemeAura() { | 57 NativeThemeAura::~NativeThemeAura() { |
| 36 } | 58 } |
| 37 | 59 |
| 60 SkColor NativeThemeAura::GetSystemColor(ColorId color_id) const { | |
| 61 // This implementation returns hardcoded colors. | |
| 62 switch (color_id) { | |
| 63 | |
| 64 // Dialogs | |
| 65 case kColorId_DialogBackground: | |
| 66 return kDefaultDialogBackgroundColor; | |
| 67 | |
| 68 // FocusableBorder | |
| 69 case kColorId_FocusedBorderColor: | |
| 70 return kDefaultFocusedBorderColor; | |
| 71 case kColorId_UnfocusedBorderColor: | |
| 72 return kDefaultUnfocusedBorderColor; | |
| 73 | |
| 74 // TextButton | |
| 75 case kColorId_TextButtonBackgroundColor: | |
| 76 return kDefaultTextButtonBackgroundColor; | |
| 77 case kColorId_TextButtonEnabledColor: | |
| 78 return kDefaultTextButtonEnabledColor; | |
| 79 case kColorId_TextButtonDisabledColor: | |
| 80 return kDefaultTextButtonDisabledColor; | |
| 81 case kColorId_TextButtonHighlightColor: | |
| 82 return kDefaultTextButtonHighlightColor; | |
| 83 case kColorId_TextButtonHoverColor: | |
| 84 return kDefaultTextButtonHoverColor; | |
| 85 | |
| 86 // MenuItem | |
| 87 case kColorId_EnabledMenuItemForegroundColor: | |
| 88 return kDefaultEnabledMenuItemForegroundColor; | |
| 89 case kColorId_DisabledMenuItemForegroundColor: | |
| 90 return kDefaultDisabledMenuItemForegroundColor; | |
| 91 case kColorId_FocusedMenuItemBackgroundColor: | |
| 92 return kDefaultFocusedMenuItemBackgroundColor; | |
| 93 default: | |
| 94 NOTREACHED() << "Invalid color_id: " << color_id; | |
| 95 break; | |
| 96 } | |
| 97 | |
| 98 // Return InvalidColor | |
| 99 return kInvalidColorIdColor; | |
| 100 } | |
| 101 | |
| 38 void NativeThemeAura::PaintMenuPopupBackground( | 102 void NativeThemeAura::PaintMenuPopupBackground( |
| 39 SkCanvas* canvas, | 103 SkCanvas* canvas, |
| 40 State state, | 104 State state, |
| 41 const gfx::Rect& rect, | 105 const gfx::Rect& rect, |
| 42 const MenuListExtraParams& menu_list) const { | 106 const MenuListExtraParams& menu_list) const { |
| 43 canvas->drawColor(kMenuBackgroundColor, SkXfermode::kSrc_Mode); | 107 canvas->drawColor(kMenuBackgroundColor, SkXfermode::kSrc_Mode); |
| 44 } | 108 } |
| 45 | 109 |
| 46 void NativeThemeAura::PaintScrollbarTrack( | 110 void NativeThemeAura::PaintScrollbarTrack( |
| 47 SkCanvas* canvas, | 111 SkCanvas* canvas, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 SkBitmapOperations::CreateTransposedBtmap(*vertical_bitmap); | 232 SkBitmapOperations::CreateTransposedBtmap(*vertical_bitmap); |
| 169 SkBitmap* horizontal_bitmap = new SkBitmap(transposed_bitmap); | 233 SkBitmap* horizontal_bitmap = new SkBitmap(transposed_bitmap); |
| 170 | 234 |
| 171 horizontal_bitmaps_[resource_id] = horizontal_bitmap; | 235 horizontal_bitmaps_[resource_id] = horizontal_bitmap; |
| 172 return horizontal_bitmap; | 236 return horizontal_bitmap; |
| 173 } | 237 } |
| 174 return NULL; | 238 return NULL; |
| 175 } | 239 } |
| 176 | 240 |
| 177 } // namespace gfx | 241 } // namespace gfx |
| OLD | NEW |