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

Unified 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: Copyright. 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 side-by-side diff with in-line comments
Download patch
Index: ui/gfx/native_theme_aura.cc
diff --git a/ui/gfx/native_theme_aura.cc b/ui/gfx/native_theme_aura.cc
index 230088807661fb0d3455aee4b8f03068654f6484..86c98d4f4a0355da2184c6b44fbfb83fce0ad7e4 100644
--- a/ui/gfx/native_theme_aura.cc
+++ b/ui/gfx/native_theme_aura.cc
@@ -1,10 +1,11 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/gfx/native_theme_aura.h"
#include "base/basictypes.h"
+#include "base/logging.h"
#include "grit/gfx_resources.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/size.h"
@@ -14,6 +15,27 @@ namespace {
const SkColor kMenuBackgroundColor = SkColorSetRGB(0xed, 0xed, 0xed);
+// Theme colors returned by GetSystemColor().
+const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128);
+// Dialogs:
+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.
+// FocusableBorder:
+const SkColor kDefaultFocusedBorderColor = SkColorSetRGB(0x4D, 0x90, 0xFE);
+const SkColor kDefaultUnfocusedBorderColor = SkColorSetRGB(0xD9, 0xD9, 0xD9);
+// TextButton:
+const SkColor kDefaultTextButtonBackgroundColor =
+ SkColorSetRGB(0xDE, 0xDE, 0xDE);
+const SkColor kDefaultTextButtonEnabledColor = SkColorSetRGB(0x44, 0x44, 0x44);
+const SkColor kDefaultTextButtonDisabledColor = SkColorSetRGB(0x99, 0x99, 0x99);
+const SkColor kDefaultTextButtonHighlightColor = SkColorSetRGB(0, 0, 0);
+const SkColor kDefaultTextButtonHoverColor = kDefaultTextButtonEnabledColor;
+// MenuItem:
+const SkColor kDefaultEnabledMenuItemForegroundColor = SK_ColorBLACK;
+const SkColor kDefaultDisabledMenuItemForegroundColor =
+ SkColorSetRGB(0x80, 0x80, 0x80);
+const SkColor kDefaultFocusedMenuItemBackgroundColor =
+ 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
+
} // namespace
namespace gfx {
@@ -35,6 +57,48 @@ NativeThemeAura::NativeThemeAura() {
NativeThemeAura::~NativeThemeAura() {
}
+SkColor NativeThemeAura::GetSystemColor(ColorId color_id) const {
+ // This implementation returns hardcoded colors.
+ switch (color_id) {
+
+ // Dialogs
+ case kColorId_DialogBackground:
+ return kDefaultDialogBackgroundColor;
+
+ // FocusableBorder
+ case kColorId_FocusedBorderColor:
+ return kDefaultFocusedBorderColor;
+ case kColorId_UnfocusedBorderColor:
+ return kDefaultUnfocusedBorderColor;
+
+ // TextButton
+ case kColorId_TextButtonBackgroundColor:
+ return kDefaultTextButtonBackgroundColor;
+ case kColorId_TextButtonEnabledColor:
+ return kDefaultTextButtonEnabledColor;
+ case kColorId_TextButtonDisabledColor:
+ return kDefaultTextButtonDisabledColor;
+ case kColorId_TextButtonHighlightColor:
+ return kDefaultTextButtonHighlightColor;
+ case kColorId_TextButtonHoverColor:
+ return kDefaultTextButtonHoverColor;
+
+ // MenuItem
+ case kColorId_EnabledMenuItemForegroundColor:
+ return kDefaultEnabledMenuItemForegroundColor;
+ case kColorId_DisabledMenuItemForegroundColor:
+ return kDefaultDisabledMenuItemForegroundColor;
+ case kColorId_FocusedMenuItemBackgroundColor:
+ return kDefaultFocusedMenuItemBackgroundColor;
+ default:
+ NOTREACHED() << "Invalid color_id: " << color_id;
+ break;
+ }
+
+ // Return InvalidColor
+ return kInvalidColorIdColor;
+}
+
void NativeThemeAura::PaintMenuPopupBackground(
SkCanvas* canvas,
State state,

Powered by Google App Engine
This is Rietveld 408576698