| 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 Profile; | |
| 29 class RefCountedMemory; | 28 class RefCountedMemory; |
| 30 class SkBitmap; | 29 class SkBitmap; |
| 31 | 30 |
| 32 namespace ui { | 31 namespace ui { |
| 33 | 32 |
| 34 //////////////////////////////////////////////////////////////////////////////// | 33 //////////////////////////////////////////////////////////////////////////////// |
| 35 // | 34 // |
| 36 // ThemeProvider | 35 // ThemeProvider |
| 37 // | 36 // |
| 38 // ThemeProvider is an abstract class that defines the API that should be | 37 // ThemeProvider is an abstract class that defines the API that should be |
| 39 // implemented to provide bitmaps and color information for a given theme. | 38 // implemented to provide bitmaps and color information for a given theme. |
| 40 // | 39 // |
| 41 //////////////////////////////////////////////////////////////////////////////// | 40 //////////////////////////////////////////////////////////////////////////////// |
| 42 | 41 |
| 43 class UI_EXPORT ThemeProvider { | 42 class UI_EXPORT ThemeProvider { |
| 44 public: | 43 public: |
| 45 virtual ~ThemeProvider(); | 44 virtual ~ThemeProvider(); |
| 46 | 45 |
| 47 // TODO(beng): This dependency is horrible! | |
| 48 // Initialize the provider with the passed in profile. | |
| 49 virtual void Init(Profile* profile) = 0; | |
| 50 | |
| 51 // Get the bitmap specified by |id|. An implementation of ThemeProvider should | 46 // Get the bitmap specified by |id|. An implementation of ThemeProvider should |
| 52 // have its own source of ids (e.g. an enum, or external resource bundle). | 47 // have its own source of ids (e.g. an enum, or external resource bundle). |
| 53 virtual SkBitmap* GetBitmapNamed(int id) const = 0; | 48 virtual SkBitmap* GetBitmapNamed(int id) const = 0; |
| 54 | 49 |
| 55 // Get the color specified by |id|. | 50 // Get the color specified by |id|. |
| 56 virtual SkColor GetColor(int id) const = 0; | 51 virtual SkColor GetColor(int id) const = 0; |
| 57 | 52 |
| 58 // Get the property (e.g. an alignment expressed in an enum, or a width or | 53 // Get the property (e.g. an alignment expressed in an enum, or a width or |
| 59 // height) specified by |id|. | 54 // height) specified by |id|. |
| 60 virtual bool GetDisplayProperty(int id, int* result) const = 0; | 55 virtual bool GetDisplayProperty(int id, int* result) const = 0; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // is missing. | 106 // is missing. |
| 112 | 107 |
| 113 // As above, but flips it in RTL locales. | 108 // As above, but flips it in RTL locales. |
| 114 virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id) const = 0; | 109 virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id) const = 0; |
| 115 #endif | 110 #endif |
| 116 }; | 111 }; |
| 117 | 112 |
| 118 } // namespace ui | 113 } // namespace ui |
| 119 | 114 |
| 120 #endif // UI_BASE_THEME_PROVIDER_H_ | 115 #endif // UI_BASE_THEME_PROVIDER_H_ |
| OLD | NEW |