| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 static bool HasSharedInstance(); | 80 static bool HasSharedInstance(); |
| 81 | 81 |
| 82 // Return the global resource loader instance. | 82 // Return the global resource loader instance. |
| 83 static ResourceBundle& GetSharedInstance(); | 83 static ResourceBundle& GetSharedInstance(); |
| 84 | 84 |
| 85 // Check if the .pak for the given locale exists. | 85 // Check if the .pak for the given locale exists. |
| 86 static bool LocaleDataPakExists(const std::string& locale); | 86 static bool LocaleDataPakExists(const std::string& locale); |
| 87 | 87 |
| 88 // Registers additional data pack files with the global ResourceBundle. When | 88 // Registers additional data pack files with the global ResourceBundle. When |
| 89 // looking for a DataResource, we will search these files after searching the | 89 // looking for a DataResource, we will search these files after searching the |
| 90 // main module. This method is not thread safe! You should call it | 90 // main module. |scale_factor| is the scale of images in this resource pak |
| 91 // immediately after calling InitSharedInstance. | 91 // relative to the images in the 1x resource pak. This method is not thread |
| 92 void AddDataPack(const FilePath& path); | 92 // safe! You should call it immediately after calling InitSharedInstance. |
| 93 void AddDataPack(const FilePath& path, float scale_factor); |
| 93 | 94 |
| 94 // Changes the locale for an already-initialized ResourceBundle, returning the | 95 // Changes the locale for an already-initialized ResourceBundle, returning the |
| 95 // name of the newly-loaded locale. Future calls to get strings will return | 96 // name of the newly-loaded locale. Future calls to get strings will return |
| 96 // the strings for this new locale. This has no effect on existing or future | 97 // the strings for this new locale. This has no effect on existing or future |
| 97 // image resources. |locale_resources_data_| is protected by a lock for the | 98 // image resources. |locale_resources_data_| is protected by a lock for the |
| 98 // duration of the swap, as GetLocalizedString() may be concurrently invoked | 99 // duration of the swap, as GetLocalizedString() may be concurrently invoked |
| 99 // on another thread. | 100 // on another thread. |
| 100 std::string ReloadLocaleResources(const std::string& pref_locale); | 101 std::string ReloadLocaleResources(const std::string& pref_locale); |
| 101 | 102 |
| 102 // Gets the bitmap with the specified resource_id from the current module | 103 // Gets the bitmap with the specified resource_id from the current module |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 221 |
| 221 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); | 222 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); |
| 222 }; | 223 }; |
| 223 | 224 |
| 224 } // namespace ui | 225 } // namespace ui |
| 225 | 226 |
| 226 // TODO(beng): Someday, maybe, get rid of this. | 227 // TODO(beng): Someday, maybe, get rid of this. |
| 227 using ui::ResourceBundle; | 228 using ui::ResourceBundle; |
| 228 | 229 |
| 229 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 230 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
| OLD | NEW |