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

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

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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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_gtk.h" 5 #include "ui/gfx/native_theme_gtk.h"
6 6
7 #include <gtk/gtk.h>
8
7 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h"
11 #include "ui/gfx/skia_utils_gtk.h"
8 12
9 namespace gfx { 13 namespace gfx {
10 14
11 // static 15 // static
12 const NativeTheme* NativeTheme::instance() { 16 const NativeTheme* NativeTheme::instance() {
13 return NativeThemeGtk::instance(); 17 return NativeThemeGtk::instance();
14 } 18 }
15 19
16 // static 20 // static
17 const NativeThemeGtk* NativeThemeGtk::instance() { 21 const NativeThemeGtk* NativeThemeGtk::instance() {
18 CR_DEFINE_STATIC_LOCAL(NativeThemeGtk, s_native_theme, ()); 22 CR_DEFINE_STATIC_LOCAL(NativeThemeGtk, s_native_theme, ());
19 return &s_native_theme; 23 return &s_native_theme;
20 } 24 }
21 25
26 SkColor NativeThemeGtk::GetSystemColor(ColorId color_id) const {
27 switch (color_id) {
28 case kDialogBackgroundColorId:
29 return gfx::GdkColorToSkColor(
30 gtk_widget_get_default_style()->bg[GTK_STATE_NORMAL]);
31 default:
32 NOTREACHED() << "Invalid color_id: " << color_id;
33 break;
34 }
35 return kColorYouShouldNeverSee;
36 }
37
22 NativeThemeGtk::NativeThemeGtk() { 38 NativeThemeGtk::NativeThemeGtk() {
23 } 39 }
24 40
25 NativeThemeGtk::~NativeThemeGtk() { 41 NativeThemeGtk::~NativeThemeGtk() {
26 } 42 }
27 43
28 } // namespace gfx 44 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698