Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: chrome/common/resource_bundle.h

Issue 40042: Add trivial theming support in extensions.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 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 CHROME_COMMON_RESOURCE_BUNDLE_H__ 5 #ifndef CHROME_COMMON_RESOURCE_BUNDLE_H__
6 #define CHROME_COMMON_RESOURCE_BUNDLE_H__ 6 #define CHROME_COMMON_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)
11 #include <windows.h> 11 #include <windows.h>
12 #endif 12 #endif
13 13
14 #include <map> 14 #include <map>
15 #include <string> 15 #include <string>
16 16
17 #include "base/basictypes.h" 17 #include "base/basictypes.h"
18 #include "base/file_path.h" 18 #include "base/file_path.h"
19 #include "base/lock.h" 19 #include "base/lock.h"
20 #include "base/scoped_ptr.h" 20 #include "base/scoped_ptr.h"
21 #include "chrome/browser/extensions/extension.h"
21 22
22 #if defined(OS_LINUX) || defined(OS_MACOSX) 23 #if defined(OS_LINUX) || defined(OS_MACOSX)
23 namespace base { 24 namespace base {
24 class DataPack; 25 class DataPack;
25 }; 26 };
26 #endif 27 #endif
27 #if defined(OS_LINUX) 28 #if defined(OS_LINUX)
28 typedef struct _GdkPixbuf GdkPixbuf; 29 typedef struct _GdkPixbuf GdkPixbuf;
29 #endif 30 #endif
30 class ChromeFont; 31 class ChromeFont;
32 class Extension;
31 class SkBitmap; 33 class SkBitmap;
32 class StringPiece; 34 class StringPiece;
33 35
34 // ResourceBundle is a central facility to load images and other resources, 36 // ResourceBundle is a central facility to load images and other resources,
35 // such as theme graphics. 37 // such as theme graphics.
36 // Every resource is loaded only once. 38 // Every resource is loaded only once.
37 class ResourceBundle { 39 class ResourceBundle {
38 public: 40 public:
39 // An enumeration of the various font styles used throughout Chrome. 41 // An enumeration of the various font styles used throughout Chrome.
40 // The following holds true for the font sizes: 42 // The following holds true for the font sizes:
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // Loads and returns the global accelerators. 113 // Loads and returns the global accelerators.
112 HACCEL GetGlobalAccelerators(); 114 HACCEL GetGlobalAccelerators();
113 115
114 // Loads and returns a cursor from the app module. 116 // Loads and returns a cursor from the app module.
115 HCURSOR LoadCursor(int cursor_id); 117 HCURSOR LoadCursor(int cursor_id);
116 #elif defined(OS_LINUX) 118 #elif defined(OS_LINUX)
117 // Load a theme image as a GdkPixbuf. 119 // Load a theme image as a GdkPixbuf.
118 GdkPixbuf* LoadPixbuf(int resource_id); 120 GdkPixbuf* LoadPixbuf(int resource_id);
119 #endif 121 #endif
120 122
123 // Sets an Extension object that can handle theme resource requests.
124 void SetThemeExtension(const Extension& e);
125
121 private: 126 private:
122 // We define a DataHandle typedef to abstract across how data is stored 127 // We define a DataHandle typedef to abstract across how data is stored
123 // across platforms. 128 // across platforms.
124 #if defined(OS_WIN) 129 #if defined(OS_WIN)
125 // Windows stores resources in DLLs, which are managed by HINSTANCE. 130 // Windows stores resources in DLLs, which are managed by HINSTANCE.
126 typedef HINSTANCE DataHandle; 131 typedef HINSTANCE DataHandle;
127 #elif defined(OS_LINUX) || defined(OS_MACOSX) 132 #elif defined(OS_LINUX) || defined(OS_MACOSX)
128 // Linux uses base::DataPack. 133 // Linux uses base::DataPack.
129 typedef base::DataPack* DataHandle; 134 typedef base::DataPack* DataHandle;
130 #endif 135 #endif
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // The various fonts used. Cached to avoid repeated GDI creation/destruction. 181 // The various fonts used. Cached to avoid repeated GDI creation/destruction.
177 scoped_ptr<ChromeFont> base_font_; 182 scoped_ptr<ChromeFont> base_font_;
178 scoped_ptr<ChromeFont> small_font_; 183 scoped_ptr<ChromeFont> small_font_;
179 scoped_ptr<ChromeFont> medium_font_; 184 scoped_ptr<ChromeFont> medium_font_;
180 scoped_ptr<ChromeFont> medium_bold_font_; 185 scoped_ptr<ChromeFont> medium_bold_font_;
181 scoped_ptr<ChromeFont> large_font_; 186 scoped_ptr<ChromeFont> large_font_;
182 scoped_ptr<ChromeFont> web_font_; 187 scoped_ptr<ChromeFont> web_font_;
183 188
184 static ResourceBundle* g_shared_instance_; 189 static ResourceBundle* g_shared_instance_;
185 190
191 scoped_ptr<Extension> theme_extension_;
192
186 DISALLOW_EVIL_CONSTRUCTORS(ResourceBundle); 193 DISALLOW_EVIL_CONSTRUCTORS(ResourceBundle);
187 }; 194 };
188 195
189 #endif // CHROME_COMMON_RESOURCE_BUNDLE_H__ 196 #endif // CHROME_COMMON_RESOURCE_BUNDLE_H__
190 197
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698