Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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). TODO(estade): this should probably just be part | |
|
pkotwicz
2015/12/04 23:16:50
Nit: TODO on new line
Evan Stade
2015/12/09 00:57:11
Done.
| |
| 79 // of ThemeService and not ThemeProvider, but it's used in many places on OSX. | |
| 80 virtual bool UsingSystemTheme() const = 0; | |
| 81 | |
| 81 // Gets the NSImage with the specified |id|. | 82 // Gets the NSImage with the specified |id|. |
| 82 virtual NSImage* GetNSImageNamed(int id) const = 0; | 83 virtual NSImage* GetNSImageNamed(int id) const = 0; |
| 83 | 84 |
| 84 // Gets the NSImage that GetNSImageNamed (above) would return, but returns it | 85 // Gets the NSImage that GetNSImageNamed (above) would return, but returns it |
| 85 // as a pattern color. | 86 // as a pattern color. |
| 86 virtual NSColor* GetNSImageColorNamed(int id) const = 0; | 87 virtual NSColor* GetNSImageColorNamed(int id) const = 0; |
| 87 | 88 |
| 88 // Gets the NSColor with the specified |id|. | 89 // Gets the NSColor with the specified |id|. |
| 89 virtual NSColor* GetNSColor(int id) const = 0; | 90 virtual NSColor* GetNSColor(int id) const = 0; |
| 90 | 91 |
| 91 // Gets the NSColor for tinting with the specified |id|. | 92 // Gets the NSColor for tinting with the specified |id|. |
| 92 virtual NSColor* GetNSColorTint(int id) const = 0; | 93 virtual NSColor* GetNSColorTint(int id) const = 0; |
| 93 | 94 |
| 94 // Gets the NSGradient with the specified |id|. | 95 // Gets the NSGradient with the specified |id|. |
| 95 virtual NSGradient* GetNSGradient(int id) const = 0; | 96 virtual NSGradient* GetNSGradient(int id) const = 0; |
| 96 #endif | 97 #endif |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 } // namespace ui | 100 } // namespace ui |
| 100 | 101 |
| 101 #endif // UI_BASE_THEME_PROVIDER_H_ | 102 #endif // UI_BASE_THEME_PROVIDER_H_ |
| OLD | NEW |