Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / base / theme_provider.h
blobeeab83d796cec946111e04a1a112a835362bbe46
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
3 // found in the LICENSE file.
5 #ifndef UI_BASE_THEME_PROVIDER_H_
6 #define UI_BASE_THEME_PROVIDER_H_
8 #include "base/basictypes.h"
9 #include "third_party/skia/include/core/SkColor.h"
10 #include "ui/base/layout.h"
11 #include "ui/base/ui_base_export.h"
13 #if defined(OS_MACOSX)
14 #ifdef __OBJC__
15 @class NSColor;
16 @class NSGradient;
17 @class NSImage;
18 #else
19 class NSColor;
20 class NSGradient;
21 class NSImage;
22 #endif // __OBJC__
23 #endif // OS_*
25 class SkBitmap;
27 namespace base {
28 class RefCountedMemory;
31 namespace gfx {
32 class ImageSkia;
35 namespace ui {
37 ////////////////////////////////////////////////////////////////////////////////
39 // ThemeProvider
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.
44 ////////////////////////////////////////////////////////////////////////////////
46 class UI_BASE_EXPORT ThemeProvider {
47 public:
48 virtual ~ThemeProvider();
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;
54 // 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).
56 virtual gfx::ImageSkia* GetImageSkiaNamed(int id) const = 0;
58 // Get the color specified by |id|.
59 virtual SkColor GetColor(int id) const = 0;
61 // Get the property (e.g. an alignment expressed in an enum, or a width or
62 // height) specified by |id|.
63 virtual int GetDisplayProperty(int id) const = 0;
65 // Whether we should use the native system frame (typically Aero glass) or
66 // a custom frame.
67 virtual bool ShouldUseNativeFrame() const = 0;
69 // 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).
71 virtual bool HasCustomImage(int id) const = 0;
73 // 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
75 // implementations of ThemeProvider. Returns NULL on error.
76 virtual base::RefCountedMemory* GetRawData(
77 int id,
78 ui::ScaleFactor scale_factor) const = 0;
80 #if defined(OS_MACOSX)
81 // Gets the NSImage with the specified |id|.
82 virtual NSImage* GetNSImageNamed(int id) const = 0;
84 // Gets the NSImage that GetNSImageNamed (above) would return, but returns it
85 // as a pattern color.
86 virtual NSColor* GetNSImageColorNamed(int id) const = 0;
88 // Gets the NSColor with the specified |id|.
89 virtual NSColor* GetNSColor(int id) const = 0;
91 // Gets the NSColor for tinting with the specified |id|.
92 virtual NSColor* GetNSColorTint(int id) const = 0;
94 // Gets the NSGradient with the specified |id|.
95 virtual NSGradient* GetNSGradient(int id) const = 0;
96 #endif
99 } // namespace ui
101 #endif // UI_BASE_THEME_PROVIDER_H_