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

Side by Side Diff: ui/base/theme_provider.h

Issue 1492423003: Rejigger ThemeService: move exposure of ThemeProvider interface to a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix that unittest Created 5 years 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
« no previous file with comments | « ui/base/default_theme_provider_mac.mm ('k') | no next file » | 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) 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 #ifndef UI_BASE_THEME_PROVIDER_H_ 5 #ifndef UI_BASE_THEME_PROVIDER_H_
6 #define UI_BASE_THEME_PROVIDER_H_ 6 #define UI_BASE_THEME_PROVIDER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "third_party/skia/include/core/SkColor.h" 9 #include "third_party/skia/include/core/SkColor.h"
10 #include "ui/base/layout.h" 10 #include "ui/base/layout.h"
(...skipping 29 matching lines...) Expand all
40 // 40 //
41 // ThemeProvider is an abstract class that defines the API that should be 41 // ThemeProvider is an abstract class that defines the API that should be
42 // implemented to provide bitmaps and color information for a given theme. 42 // implemented to provide bitmaps and color information for a given theme.
43 // 43 //
44 //////////////////////////////////////////////////////////////////////////////// 44 ////////////////////////////////////////////////////////////////////////////////
45 45
46 class UI_BASE_EXPORT ThemeProvider { 46 class UI_BASE_EXPORT ThemeProvider {
47 public: 47 public:
48 virtual ~ThemeProvider(); 48 virtual ~ThemeProvider();
49 49
50 // Whether we're using the system theme (which may or may not be the
51 // same as the default theme).
52 virtual bool UsingSystemTheme() const = 0;
53
54 // Get the image specified by |id|. An implementation of ThemeProvider should 50 // Get the image specified by |id|. An implementation of ThemeProvider should
55 // have its own source of ids (e.g. an enum, or external resource bundle). 51 // have its own source of ids (e.g. an enum, or external resource bundle).
56 virtual gfx::ImageSkia* GetImageSkiaNamed(int id) const = 0; 52 virtual gfx::ImageSkia* GetImageSkiaNamed(int id) const = 0;
57 53
58 // Get the color specified by |id|. 54 // Get the color specified by |id|.
59 virtual SkColor GetColor(int id) const = 0; 55 virtual SkColor GetColor(int id) const = 0;
60 56
61 // Get the property (e.g. an alignment expressed in an enum, or a width or 57 // Get the property (e.g. an alignment expressed in an enum, or a width or
62 // height) specified by |id|. 58 // height) specified by |id|.
63 virtual int GetDisplayProperty(int id) const = 0; 59 virtual int GetDisplayProperty(int id) const = 0;
64 60
65 // Whether we should use the native system frame (typically Aero glass) or 61 // Whether we should use the native system frame (typically Aero glass) or
66 // a custom frame. 62 // a custom frame.
67 virtual bool ShouldUseNativeFrame() const = 0; 63 virtual bool ShouldUseNativeFrame() const = 0;
68 64
69 // Whether or not we have a certain image. Used for when the default theme 65 // Whether or not we have a certain image. Used for when the default theme
70 // doesn't provide a certain image, but custom themes might (badges, etc). 66 // doesn't provide a certain image, but custom themes might (badges, etc).
71 virtual bool HasCustomImage(int id) const = 0; 67 virtual bool HasCustomImage(int id) const = 0;
72 68
73 // Reads the image data from the theme file into the specified vector. Only 69 // Reads the image data from the theme file into the specified vector. Only
74 // valid for un-themed resources and the themed IDR_THEME_NTP_* in most 70 // valid for un-themed resources and the themed IDR_THEME_NTP_* in most
75 // implementations of ThemeProvider. Returns NULL on error. 71 // implementations of ThemeProvider. Returns NULL on error.
76 virtual base::RefCountedMemory* GetRawData( 72 virtual base::RefCountedMemory* GetRawData(
77 int id, 73 int id,
78 ui::ScaleFactor scale_factor) const = 0; 74 ui::ScaleFactor scale_factor) const = 0;
79 75
80 #if defined(OS_MACOSX) 76 #if defined(OS_MACOSX)
77 // Whether we're using the system theme (which may or may not be the
78 // same as the default theme).
79 // TODO(estade): this should probably just be part of ThemeService and not
80 // ThemeProvider, but it's used in many places on OSX.
81 virtual bool UsingSystemTheme() const = 0;
82
81 // Gets the NSImage with the specified |id|. 83 // Gets the NSImage with the specified |id|.
82 virtual NSImage* GetNSImageNamed(int id) const = 0; 84 virtual NSImage* GetNSImageNamed(int id) const = 0;
83 85
84 // Gets the NSImage that GetNSImageNamed (above) would return, but returns it 86 // Gets the NSImage that GetNSImageNamed (above) would return, but returns it
85 // as a pattern color. 87 // as a pattern color.
86 virtual NSColor* GetNSImageColorNamed(int id) const = 0; 88 virtual NSColor* GetNSImageColorNamed(int id) const = 0;
87 89
88 // Gets the NSColor with the specified |id|. 90 // Gets the NSColor with the specified |id|.
89 virtual NSColor* GetNSColor(int id) const = 0; 91 virtual NSColor* GetNSColor(int id) const = 0;
90 92
91 // Gets the NSColor for tinting with the specified |id|. 93 // Gets the NSColor for tinting with the specified |id|.
92 virtual NSColor* GetNSColorTint(int id) const = 0; 94 virtual NSColor* GetNSColorTint(int id) const = 0;
93 95
94 // Gets the NSGradient with the specified |id|. 96 // Gets the NSGradient with the specified |id|.
95 virtual NSGradient* GetNSGradient(int id) const = 0; 97 virtual NSGradient* GetNSGradient(int id) const = 0;
96 #endif 98 #endif
97 }; 99 };
98 100
99 } // namespace ui 101 } // namespace ui
100 102
101 #endif // UI_BASE_THEME_PROVIDER_H_ 103 #endif // UI_BASE_THEME_PROVIDER_H_
OLDNEW
« no previous file with comments | « ui/base/default_theme_provider_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698