| 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // the files are hardcoded in ResourceBundle. Fix it to allow to specify which | 125 // the files are hardcoded in ResourceBundle. Fix it to allow to specify which |
| 126 // files are loaded (e.g. add a new method in Delegate). | 126 // files are loaded (e.g. add a new method in Delegate). |
| 127 static std::string InitSharedInstanceWithLocale( | 127 static std::string InitSharedInstanceWithLocale( |
| 128 const std::string& pref_locale, Delegate* delegate); | 128 const std::string& pref_locale, Delegate* delegate); |
| 129 | 129 |
| 130 // Same as InitSharedInstanceWithLocale(), but loads only localized resources, | 130 // Same as InitSharedInstanceWithLocale(), but loads only localized resources, |
| 131 // without default resource packs. | 131 // without default resource packs. |
| 132 static std::string InitSharedInstanceLocaleOnly( | 132 static std::string InitSharedInstanceLocaleOnly( |
| 133 const std::string& pref_locale, Delegate* delegate); | 133 const std::string& pref_locale, Delegate* delegate); |
| 134 | 134 |
| 135 // Initialize the ResourceBundle using given file. The second argument | 135 // Initialize the ResourceBundle using the given file region. If |region| is |
| 136 // controls whether or not ResourceBundle::LoadCommonResources is called. | 136 // MemoryMappedFile::Region::kWholeFile, the entire |pak_file| is used. |
| 137 // |should_load_common_resources| controls whether or not LoadCommonResources |
| 138 // is called. |
| 137 // This allows the use of this function in a sandbox without local file | 139 // This allows the use of this function in a sandbox without local file |
| 138 // access (as on Android). | 140 // access (as on Android). |
| 139 static void InitSharedInstanceWithPakFile(base::File file, | 141 static void InitSharedInstanceWithPakFileRegion( |
| 140 bool should_load_common_resources); | 142 base::File pak_file, |
| 143 const base::MemoryMappedFile::Region& region, |
| 144 bool should_load_common_resources); |
| 141 | 145 |
| 142 // Initialize the ResourceBundle using given data pack path for testing. | 146 // Initialize the ResourceBundle using given data pack path for testing. |
| 143 static void InitSharedInstanceWithPakPath(const base::FilePath& path); | 147 static void InitSharedInstanceWithPakPath(const base::FilePath& path); |
| 144 | 148 |
| 145 // Delete the ResourceBundle for this process if it exists. | 149 // Delete the ResourceBundle for this process if it exists. |
| 146 static void CleanupSharedInstance(); | 150 static void CleanupSharedInstance(); |
| 147 | 151 |
| 148 // Returns true after the global resource loader instance has been created. | 152 // Returns true after the global resource loader instance has been created. |
| 149 static bool HasSharedInstance(); | 153 static bool HasSharedInstance(); |
| 150 | 154 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 421 |
| 418 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); | 422 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); |
| 419 }; | 423 }; |
| 420 | 424 |
| 421 } // namespace ui | 425 } // namespace ui |
| 422 | 426 |
| 423 // TODO(beng): Someday, maybe, get rid of this. | 427 // TODO(beng): Someday, maybe, get rid of this. |
| 424 using ui::ResourceBundle; | 428 using ui::ResourceBundle; |
| 425 | 429 |
| 426 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 430 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
| OLD | NEW |