| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| 11 #include "ui/base/ui_export.h" | 11 #include "ui/base/ui_export.h" |
| 12 | 12 |
| 13 #if defined(OS_MACOSX) | 13 #if defined(OS_MACOSX) |
| 14 #ifdef __OBJC__ | 14 #ifdef __OBJC__ |
| 15 @class NSColor; | 15 @class NSColor; |
| 16 @class NSGradient; | 16 @class NSGradient; |
| 17 @class NSImage; | 17 @class NSImage; |
| 18 #else | 18 #else |
| 19 class NSColor; | 19 class NSColor; |
| 20 class NSGradient; | 20 class NSGradient; |
| 21 class NSImage; | 21 class NSImage; |
| 22 #endif // __OBJC__ | 22 #endif // __OBJC__ |
| 23 #elif !defined(OS_WIN) | 23 #elif !defined(OS_WIN) |
| 24 typedef struct _GdkColor GdkColor; | 24 typedef struct _GdkColor GdkColor; |
| 25 typedef struct _GdkPixbuf GdkPixbuf; | 25 typedef struct _GdkPixbuf GdkPixbuf; |
| 26 #endif // OS_* | 26 #endif // OS_* |
| 27 | 27 |
| 28 class SkBitmap; |
| 29 |
| 30 namespace base { |
| 28 class RefCountedMemory; | 31 class RefCountedMemory; |
| 29 class SkBitmap; | 32 } |
| 30 | 33 |
| 31 namespace ui { | 34 namespace ui { |
| 32 | 35 |
| 33 //////////////////////////////////////////////////////////////////////////////// | 36 //////////////////////////////////////////////////////////////////////////////// |
| 34 // | 37 // |
| 35 // ThemeProvider | 38 // ThemeProvider |
| 36 // | 39 // |
| 37 // ThemeProvider is an abstract class that defines the API that should be | 40 // ThemeProvider is an abstract class that defines the API that should be |
| 38 // implemented to provide bitmaps and color information for a given theme. | 41 // implemented to provide bitmaps and color information for a given theme. |
| 39 // | 42 // |
| (...skipping 18 matching lines...) Expand all Loading... |
| 58 // a custom frame. | 61 // a custom frame. |
| 59 virtual bool ShouldUseNativeFrame() const = 0; | 62 virtual bool ShouldUseNativeFrame() const = 0; |
| 60 | 63 |
| 61 // Whether or not we have a certain image. Used for when the default theme | 64 // Whether or not we have a certain image. Used for when the default theme |
| 62 // doesn't provide a certain image, but custom themes might (badges, etc). | 65 // doesn't provide a certain image, but custom themes might (badges, etc). |
| 63 virtual bool HasCustomImage(int id) const = 0; | 66 virtual bool HasCustomImage(int id) const = 0; |
| 64 | 67 |
| 65 // Reads the image data from the theme file into the specified vector. Only | 68 // Reads the image data from the theme file into the specified vector. Only |
| 66 // valid for un-themed resources and the themed IDR_THEME_NTP_* in most | 69 // valid for un-themed resources and the themed IDR_THEME_NTP_* in most |
| 67 // implementations of ThemeProvider. Returns NULL on error. | 70 // implementations of ThemeProvider. Returns NULL on error. |
| 68 virtual RefCountedMemory* GetRawData(int id) const = 0; | 71 virtual base::RefCountedMemory* GetRawData(int id) const = 0; |
| 69 | 72 |
| 70 #if defined(OS_MACOSX) && !defined(TOOLKIT_VIEWS) | 73 #if defined(OS_MACOSX) && !defined(TOOLKIT_VIEWS) |
| 71 // Gets the NSImage with the specified |id|. | 74 // Gets the NSImage with the specified |id|. |
| 72 // | 75 // |
| 73 // The bitmap is not assumed to exist. If a theme does not provide an image, | 76 // The bitmap is not assumed to exist. If a theme does not provide an image, |
| 74 // if |allow_default| is true, then the default image will be returned, else | 77 // if |allow_default| is true, then the default image will be returned, else |
| 75 // this function will return nil. | 78 // this function will return nil. |
| 76 virtual NSImage* GetNSImageNamed(int id, bool allow_default) const = 0; | 79 virtual NSImage* GetNSImageNamed(int id, bool allow_default) const = 0; |
| 77 | 80 |
| 78 // Gets the NSImage that GetNSImageNamed (above) would return, but returns it | 81 // Gets the NSImage that GetNSImageNamed (above) would return, but returns it |
| (...skipping 27 matching lines...) Expand all Loading... |
| 106 // is missing. | 109 // is missing. |
| 107 | 110 |
| 108 // As above, but flips it in RTL locales. | 111 // As above, but flips it in RTL locales. |
| 109 virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id) const = 0; | 112 virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id) const = 0; |
| 110 #endif | 113 #endif |
| 111 }; | 114 }; |
| 112 | 115 |
| 113 } // namespace ui | 116 } // namespace ui |
| 114 | 117 |
| 115 #endif // UI_BASE_THEME_PROVIDER_H_ | 118 #endif // UI_BASE_THEME_PROVIDER_H_ |
| OLD | NEW |