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 GetMaxScaleFactor() const; | 258 ScaleFactor max_scale_factor() const { |
| 259 return max_scale_factor_; |
| 260 } |
259 | 261 |
260 private: | 262 private: |
261 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetPathForLocalePack); | 263 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetPathForLocalePack); |
262 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetImageNamed); | 264 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetImageNamed); |
263 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetNativeImageNamed); | 265 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetNativeImageNamed); |
264 | 266 |
265 friend class ResourceBundleImageTest; | 267 friend class ResourceBundleImageTest; |
266 friend class ResourceBundleTest; | 268 friend class ResourceBundleTest; |
267 | 269 |
268 class ResourceBundleImageSource; | 270 class ResourceBundleImageSource; |
269 friend class ResourceBundleImageSource; | 271 friend class ResourceBundleImageSource; |
270 | 272 |
271 // Ctor/dtor are private, since we're a singleton. | 273 // Ctor/dtor are private, since we're a singleton. |
272 explicit ResourceBundle(Delegate* delegate); | 274 explicit ResourceBundle(Delegate* delegate); |
273 ~ResourceBundle(); | 275 ~ResourceBundle(); |
274 | 276 |
275 // Shared initialization. | |
276 static void InitSharedInstance(Delegate* delegate); | |
277 | |
278 // Free skia_images_. | 277 // Free skia_images_. |
279 void FreeImages(); | 278 void FreeImages(); |
280 | 279 |
281 // Load the main resources. | 280 // Load the main resources. |
282 void LoadCommonResources(); | 281 void LoadCommonResources(); |
283 | 282 |
284 // Implementation for AddDataPackFromPath and AddOptionalDataPackFromPath, if | 283 // Implementation for AddDataPackFromPath and AddOptionalDataPackFromPath, if |
285 // the pack is not |optional| logs an error on failure to load. | 284 // the pack is not |optional| logs an error on failure to load. |
286 void AddDataPackFromPathInternal(const base::FilePath& path, | 285 void AddDataPackFromPathInternal(const base::FilePath& path, |
287 ScaleFactor scale_factor, | 286 ScaleFactor scale_factor, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 | 393 |
395 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); | 394 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); |
396 }; | 395 }; |
397 | 396 |
398 } // namespace ui | 397 } // namespace ui |
399 | 398 |
400 // TODO(beng): Someday, maybe, get rid of this. | 399 // TODO(beng): Someday, maybe, get rid of this. |
401 using ui::ResourceBundle; | 400 using ui::ResourceBundle; |
402 | 401 |
403 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 402 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
OLD | NEW |