| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_RESOURCE_BUNDLE_H_ | 5 #ifndef APP_RESOURCE_BUNDLE_H_ |
| 6 #define APP_RESOURCE_BUNDLE_H_ | 6 #define APP_RESOURCE_BUNDLE_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #if defined(OS_LINUX) | 28 #if defined(OS_LINUX) |
| 29 typedef struct _GdkPixbuf GdkPixbuf; | 29 typedef struct _GdkPixbuf GdkPixbuf; |
| 30 #endif | 30 #endif |
| 31 namespace gfx{ | 31 namespace gfx{ |
| 32 class Font; | 32 class Font; |
| 33 } | 33 } |
| 34 class SkBitmap; | 34 class SkBitmap; |
| 35 typedef uint32 SkColor; | 35 typedef uint32 SkColor; |
| 36 class StringPiece; | 36 class StringPiece; |
| 37 | 37 |
| 38 #if defined(OS_MACOSX) |
| 39 #ifdef __OBJC__ |
| 40 @class NSImage; |
| 41 #else |
| 42 class NSImage; |
| 43 #endif // __OBJC__ |
| 44 #endif // defined(OS_MACOSX) |
| 45 |
| 38 // ResourceBundle is a central facility to load images and other resources, | 46 // ResourceBundle is a central facility to load images and other resources, |
| 39 // such as theme graphics. | 47 // such as theme graphics. |
| 40 // Every resource is loaded only once. | 48 // Every resource is loaded only once. |
| 41 class ResourceBundle { | 49 class ResourceBundle { |
| 42 public: | 50 public: |
| 43 // An enumeration of the various font styles used throughout Chrome. | 51 // An enumeration of the various font styles used throughout Chrome. |
| 44 // The following holds true for the font sizes: | 52 // The following holds true for the font sizes: |
| 45 // Small <= Base <= Medium <= MediumBold <= Large. | 53 // Small <= Base <= Medium <= MediumBold <= Large. |
| 46 enum FontStyle { | 54 enum FontStyle { |
| 47 SmallFont, | 55 SmallFont, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 113 |
| 106 // Returns the font for the specified style. | 114 // Returns the font for the specified style. |
| 107 gfx::Font GetFont(FontStyle style); | 115 gfx::Font GetFont(FontStyle style); |
| 108 | 116 |
| 109 #if defined(OS_WIN) | 117 #if defined(OS_WIN) |
| 110 // Loads and returns an icon from the theme dll. | 118 // Loads and returns an icon from the theme dll. |
| 111 HICON LoadThemeIcon(int icon_id); | 119 HICON LoadThemeIcon(int icon_id); |
| 112 | 120 |
| 113 // Loads and returns a cursor from the app module. | 121 // Loads and returns a cursor from the app module. |
| 114 HCURSOR LoadCursor(int cursor_id); | 122 HCURSOR LoadCursor(int cursor_id); |
| 123 #elif defined(OS_MACOSX) |
| 124 // Wrapper for GetBitmapNamed. Converts the bitmap to an autoreleased NSImage. |
| 125 NSImage* GetNSImageNamed(int resource_id); |
| 115 #elif defined(OS_LINUX) | 126 #elif defined(OS_LINUX) |
| 116 // Gets the GdkPixbuf with the specified resource_id, first by looking into | 127 // Gets the GdkPixbuf with the specified resource_id, first by looking into |
| 117 // the theme data, than in the current module data if applicable. Returns a | 128 // the theme data, than in the current module data if applicable. Returns a |
| 118 // pointer to a shared instance of the GdkPixbuf. This shared GdkPixbuf is | 129 // pointer to a shared instance of the GdkPixbuf. This shared GdkPixbuf is |
| 119 // owned by the resource bundle and should not be freed. | 130 // owned by the resource bundle and should not be freed. |
| 120 // | 131 // |
| 121 // The bitmap is assumed to exist. This function will log in release, and | 132 // The bitmap is assumed to exist. This function will log in release, and |
| 122 // assert in debug mode if it does not. On failure, this will return a | 133 // assert in debug mode if it does not. On failure, this will return a |
| 123 // pointer to a shared empty placeholder bitmap so it will be visible what | 134 // pointer to a shared empty placeholder bitmap so it will be visible what |
| 124 // is missing. | 135 // is missing. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 scoped_ptr<gfx::Font> medium_bold_font_; | 220 scoped_ptr<gfx::Font> medium_bold_font_; |
| 210 scoped_ptr<gfx::Font> large_font_; | 221 scoped_ptr<gfx::Font> large_font_; |
| 211 scoped_ptr<gfx::Font> web_font_; | 222 scoped_ptr<gfx::Font> web_font_; |
| 212 | 223 |
| 213 static ResourceBundle* g_shared_instance_; | 224 static ResourceBundle* g_shared_instance_; |
| 214 | 225 |
| 215 DISALLOW_EVIL_CONSTRUCTORS(ResourceBundle); | 226 DISALLOW_EVIL_CONSTRUCTORS(ResourceBundle); |
| 216 }; | 227 }; |
| 217 | 228 |
| 218 #endif // APP_RESOURCE_BUNDLE_H_ | 229 #endif // APP_RESOURCE_BUNDLE_H_ |
| OLD | NEW |