| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 APP_THEME_PROVIDER_H_ | 5 #ifndef UI_BASE_THEME_PROVIDER_H_ |
| 6 #define APP_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 | 11 |
| 12 #if defined(OS_MACOSX) | 12 #if defined(OS_MACOSX) |
| 13 #ifdef __OBJC__ | 13 #ifdef __OBJC__ |
| 14 @class NSColor; | 14 @class NSColor; |
| 15 @class NSGradient; | 15 @class NSGradient; |
| 16 @class NSImage; | 16 @class NSImage; |
| 17 #else | 17 #else |
| 18 class NSColor; | 18 class NSColor; |
| 19 class NSGradient; | 19 class NSGradient; |
| 20 class NSImage; | 20 class NSImage; |
| 21 #endif // __OBJC__ | 21 #endif // __OBJC__ |
| 22 #elif !defined(OS_WIN) | 22 #elif !defined(OS_WIN) |
| 23 typedef struct _GdkColor GdkColor; | 23 typedef struct _GdkColor GdkColor; |
| 24 typedef struct _GdkPixbuf GdkPixbuf; | 24 typedef struct _GdkPixbuf GdkPixbuf; |
| 25 #endif // OS_* | 25 #endif // OS_* |
| 26 | 26 |
| 27 class Profile; | 27 class Profile; |
| 28 class RefCountedMemory; | 28 class RefCountedMemory; |
| 29 class SkBitmap; | 29 class SkBitmap; |
| 30 | 30 |
| 31 namespace ui { |
| 32 |
| 31 //////////////////////////////////////////////////////////////////////////////// | 33 //////////////////////////////////////////////////////////////////////////////// |
| 32 // | 34 // |
| 33 // ThemeProvider | 35 // ThemeProvider |
| 34 // | 36 // |
| 35 // 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 |
| 36 // implemented to provide bitmaps and color information for a given theme. | 38 // implemented to provide bitmaps and color information for a given theme. |
| 37 // | 39 // |
| 38 //////////////////////////////////////////////////////////////////////////////// | 40 //////////////////////////////////////////////////////////////////////////////// |
| 39 | 41 |
| 40 class ThemeProvider { | 42 class ThemeProvider { |
| 41 public: | 43 public: |
| 42 virtual ~ThemeProvider(); | 44 virtual ~ThemeProvider(); |
| 43 | 45 |
| 46 // TODO(beng): This dependency is horrible! |
| 44 // Initialize the provider with the passed in profile. | 47 // Initialize the provider with the passed in profile. |
| 45 virtual void Init(Profile* profile) = 0; | 48 virtual void Init(Profile* profile) = 0; |
| 46 | 49 |
| 47 // Get the bitmap specified by |id|. An implementation of ThemeProvider should | 50 // Get the bitmap specified by |id|. An implementation of ThemeProvider should |
| 48 // 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). |
| 49 virtual SkBitmap* GetBitmapNamed(int id) const = 0; | 52 virtual SkBitmap* GetBitmapNamed(int id) const = 0; |
| 50 | 53 |
| 51 // Get the color specified by |id|. | 54 // Get the color specified by |id|. |
| 52 virtual SkColor GetColor(int id) const = 0; | 55 virtual SkColor GetColor(int id) const = 0; |
| 53 | 56 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // assert in debug mode if it does not. On failure, this will return a | 108 // assert in debug mode if it does not. On failure, this will return a |
| 106 // pointer to a shared empty placeholder bitmap so it will be visible what | 109 // pointer to a shared empty placeholder bitmap so it will be visible what |
| 107 // is missing. | 110 // is missing. |
| 108 virtual GdkPixbuf* GetPixbufNamed(int id) const = 0; | 111 virtual GdkPixbuf* GetPixbufNamed(int id) const = 0; |
| 109 | 112 |
| 110 // As above, but flips it in RTL locales. | 113 // As above, but flips it in RTL locales. |
| 111 virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id) const = 0; | 114 virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id) const = 0; |
| 112 #endif | 115 #endif |
| 113 }; | 116 }; |
| 114 | 117 |
| 115 #endif // APP_THEME_PROVIDER_H_ | 118 } // namespace ui |
| 119 |
| 120 #endif // UI_BASE_THEME_PROVIDER_H_ |
| OLD | NEW |