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_RESOURCE_RESOURCE_BUNDLE_H_ | 5 #ifndef UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
6 #define UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 6 #define UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 248 |
249 // Returns the full pathname of the locale file to load. May return an empty | 249 // Returns the full pathname of the locale file to load. May return an empty |
250 // string if no locale data files are found and |test_file_exists| is true. | 250 // string if no locale data files are found and |test_file_exists| is true. |
251 // Used on Android to load the local file in the browser process and pass it | 251 // Used on Android to load the local file in the browser process and pass it |
252 // to the sandboxed renderer process. | 252 // to the sandboxed renderer process. |
253 base::FilePath GetLocaleFilePath(const std::string& app_locale, | 253 base::FilePath GetLocaleFilePath(const std::string& app_locale, |
254 bool test_file_exists); | 254 bool test_file_exists); |
255 | 255 |
256 // Returns the maximum scale factor currently loaded. | 256 // Returns the maximum scale factor currently loaded. |
257 // Returns SCALE_FACTOR_100P if no resource is loaded. | 257 // Returns SCALE_FACTOR_100P if no resource is loaded. |
258 ScaleFactor max_scale_factor() const { | 258 ScaleFactor GetMaxScaleFactor() const; |
259 return max_scale_factor_; | |
260 } | |
261 | 259 |
262 private: | 260 private: |
263 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetPathForLocalePack); | 261 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetPathForLocalePack); |
264 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetImageNamed); | 262 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetImageNamed); |
265 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetNativeImageNamed); | 263 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetNativeImageNamed); |
266 | 264 |
267 friend class ResourceBundleImageTest; | 265 friend class ResourceBundleImageTest; |
268 friend class ResourceBundleTest; | 266 friend class ResourceBundleTest; |
269 | 267 |
270 class ResourceBundleImageSource; | 268 class ResourceBundleImageSource; |
271 friend class ResourceBundleImageSource; | 269 friend class ResourceBundleImageSource; |
272 | 270 |
273 // Ctor/dtor are private, since we're a singleton. | 271 // Ctor/dtor are private, since we're a singleton. |
274 explicit ResourceBundle(Delegate* delegate); | 272 explicit ResourceBundle(Delegate* delegate); |
275 ~ResourceBundle(); | 273 ~ResourceBundle(); |
276 | 274 |
| 275 // Shared initialization. |
| 276 static void InitSharedInstance(Delegate* delegate); |
| 277 |
277 // Free skia_images_. | 278 // Free skia_images_. |
278 void FreeImages(); | 279 void FreeImages(); |
279 | 280 |
280 // Load the main resources. | 281 // Load the main resources. |
281 void LoadCommonResources(); | 282 void LoadCommonResources(); |
282 | 283 |
283 // Implementation for AddDataPackFromPath and AddOptionalDataPackFromPath, if | 284 // Implementation for AddDataPackFromPath and AddOptionalDataPackFromPath, if |
284 // the pack is not |optional| logs an error on failure to load. | 285 // the pack is not |optional| logs an error on failure to load. |
285 void AddDataPackFromPathInternal(const base::FilePath& path, | 286 void AddDataPackFromPathInternal(const base::FilePath& path, |
286 ScaleFactor scale_factor, | 287 ScaleFactor scale_factor, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 | 394 |
394 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); | 395 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); |
395 }; | 396 }; |
396 | 397 |
397 } // namespace ui | 398 } // namespace ui |
398 | 399 |
399 // TODO(beng): Someday, maybe, get rid of this. | 400 // TODO(beng): Someday, maybe, get rid of this. |
400 using ui::ResourceBundle; | 401 using ui::ResourceBundle; |
401 | 402 |
402 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 403 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
OLD | NEW |