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

Unified Diff: ui/gfx/native_theme.h

Issue 8597015: Add a new GetSystemColor method to native theme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move hardcoded colors into constants Created 9 years, 1 month 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
« no previous file with comments | « no previous file | ui/gfx/native_theme_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/native_theme.h
diff --git a/ui/gfx/native_theme.h b/ui/gfx/native_theme.h
index cc9aa35e4049bcdb8eabadaa4158b330415a96f0..4932bbb0682bf15f3f7dae062f7922ae46c59d52 100644
--- a/ui/gfx/native_theme.h
+++ b/ui/gfx/native_theme.h
@@ -14,16 +14,23 @@ class SkCanvas;
namespace gfx {
+namespace {
+// Returned by GetSystemColor() in response to an invalid ColorId.
+const SkColor kColorYouShouldNeverSee = SkColorSetRGB(255, 0, 128);
James Cook 2011/11/19 00:28:14 I wouldn't do this in a header file, even though t
benrg 2011/11/21 18:32:40 It seems silly to add a public method for code tha
+}
+
class Rect;
class Size;
// This class supports drawing UI controls (like buttons, text fields, lists,
// comboboxes, etc) that look like the native UI controls of the underlying
-// platform, such as Windows or Linux.
+// platform, such as Windows or Linux. It also supplies default colors for
+// dialog box backgrounds, etc., which are obtained from the system theme where
+// possible.
//
// The supported control types are listed in the Part enum. These parts can be
-// in any state given by the State enum, where the actual definititon of the
-// state is part-specific.
+// in any state given by the State enum, where the actual definition of the
+// state is part-specific. The supported colors are listed in the ColorId enum.
//
// Some parts require more information than simply the state in order to be
// drawn correctly, and this information is given to the Paint() method via the
@@ -212,6 +219,15 @@ class UI_EXPORT NativeTheme {
unsigned active_color,
unsigned track_color) const;
+ // Colors for GetSystemColor().
+ enum ColorId {
+ kDialogBackgroundColorId
+ // TODO(benrg): move other hardcoded colors here.
+ };
+
+ // Return a color from the system theme.
+ virtual SkColor GetSystemColor(ColorId color_id) const = 0;
+
// Returns a shared instance of the native theme.
// The returned object should not be deleted by the caller. This function
// is not thread safe and should only be called from the UI thread.
« no previous file with comments | « no previous file | ui/gfx/native_theme_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698