| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| 11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
| 12 #include <windows.h> | 12 #include <windows.h> |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 #include <map> | 15 #include <map> |
| 16 #include <string> | 16 #include <string> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "base/basictypes.h" | 19 #include "base/basictypes.h" |
| 20 #include "base/file_path.h" | 20 #include "base/file_path.h" |
| 21 #include "base/ref_counted_memory.h" | 21 #include "base/ref_counted_memory.h" |
| 22 #include "base/scoped_ptr.h" | 22 #include "base/scoped_ptr.h" |
| 23 #include "base/string16.h" | 23 #include "base/string16.h" |
| 24 #include "gfx/native_widget_types.h" | 24 #include "gfx/native_widget_types.h" |
| 25 | 25 |
| 26 namespace base { | 26 namespace app { |
| 27 class DataPack; | 27 class DataPack; |
| 28 } | 28 } |
| 29 #if defined(USE_X11) | 29 #if defined(USE_X11) |
| 30 typedef struct _GdkPixbuf GdkPixbuf; | 30 typedef struct _GdkPixbuf GdkPixbuf; |
| 31 #endif | 31 #endif |
| 32 namespace gfx { | 32 namespace gfx { |
| 33 class Font; | 33 class Font; |
| 34 } | 34 } |
| 35 class Lock; | 35 class Lock; |
| 36 class SkBitmap; | 36 class SkBitmap; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 class LoadedDataPack { | 171 class LoadedDataPack { |
| 172 public: | 172 public: |
| 173 explicit LoadedDataPack(const FilePath& path); | 173 explicit LoadedDataPack(const FilePath& path); |
| 174 ~LoadedDataPack(); | 174 ~LoadedDataPack(); |
| 175 bool GetStringPiece(int resource_id, base::StringPiece* data) const; | 175 bool GetStringPiece(int resource_id, base::StringPiece* data) const; |
| 176 RefCountedStaticMemory* GetStaticMemory(int resource_id) const; | 176 RefCountedStaticMemory* GetStaticMemory(int resource_id) const; |
| 177 | 177 |
| 178 private: | 178 private: |
| 179 void Load(); | 179 void Load(); |
| 180 | 180 |
| 181 scoped_ptr<base::DataPack> data_pack_; | 181 scoped_ptr<app::DataPack> data_pack_; |
| 182 FilePath path_; | 182 FilePath path_; |
| 183 | 183 |
| 184 DISALLOW_COPY_AND_ASSIGN(LoadedDataPack); | 184 DISALLOW_COPY_AND_ASSIGN(LoadedDataPack); |
| 185 }; | 185 }; |
| 186 | 186 |
| 187 // We define a DataHandle typedef to abstract across how data is stored | 187 // We define a DataHandle typedef to abstract across how data is stored |
| 188 // across platforms. | 188 // across platforms. |
| 189 #if defined(OS_WIN) | 189 #if defined(OS_WIN) |
| 190 // Windows stores resources in DLLs, which are managed by HINSTANCE. | 190 // Windows stores resources in DLLs, which are managed by HINSTANCE. |
| 191 typedef HINSTANCE DataHandle; | 191 typedef HINSTANCE DataHandle; |
| 192 #elif defined(USE_BASE_DATA_PACK) | 192 #elif defined(USE_BASE_DATA_PACK) |
| 193 // Linux uses base::DataPack. | 193 // Linux uses base::DataPack. |
| 194 typedef base::DataPack* DataHandle; | 194 typedef app::DataPack* DataHandle; |
| 195 #endif | 195 #endif |
| 196 | 196 |
| 197 // Ctor/dtor are private, since we're a singleton. | 197 // Ctor/dtor are private, since we're a singleton. |
| 198 ResourceBundle(); | 198 ResourceBundle(); |
| 199 ~ResourceBundle(); | 199 ~ResourceBundle(); |
| 200 | 200 |
| 201 // Free skia_images_. | 201 // Free skia_images_. |
| 202 void FreeImages(); | 202 void FreeImages(); |
| 203 | 203 |
| 204 #if defined(USE_X11) | 204 #if defined(USE_X11) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 scoped_ptr<gfx::Font> medium_bold_font_; | 270 scoped_ptr<gfx::Font> medium_bold_font_; |
| 271 scoped_ptr<gfx::Font> large_font_; | 271 scoped_ptr<gfx::Font> large_font_; |
| 272 scoped_ptr<gfx::Font> web_font_; | 272 scoped_ptr<gfx::Font> web_font_; |
| 273 | 273 |
| 274 static ResourceBundle* g_shared_instance_; | 274 static ResourceBundle* g_shared_instance_; |
| 275 | 275 |
| 276 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); | 276 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); |
| 277 }; | 277 }; |
| 278 | 278 |
| 279 #endif // APP_RESOURCE_BUNDLE_H_ | 279 #endif // APP_RESOURCE_BUNDLE_H_ |
| OLD | NEW |