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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 | 117 |
118 // Initialize the ResourceBundle for this process. Does not take ownership of | 118 // Initialize the ResourceBundle for this process. Does not take ownership of |
119 // the |delegate| value. Returns the language selected. | 119 // the |delegate| value. Returns the language selected. |
120 // NOTE: Mac ignores this and always loads up resources for the language | 120 // NOTE: Mac ignores this and always loads up resources for the language |
121 // defined by the Cocoa UI (i.e., NSBundle does the language work). | 121 // defined by the Cocoa UI (i.e., NSBundle does the language work). |
122 // | 122 // |
123 // TODO(sergeyu): This method also loads common resources (i.e. chrome.pak). | 123 // TODO(sergeyu): This method also loads common resources (i.e. chrome.pak). |
124 // There is no way to specify which resource files are loaded, i.e. names of | 124 // There is no way to specify which resource files are loaded, i.e. names of |
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 // |should_load_common_resources| controls whether or not LoadCommonResources | |
128 // is called. | |
127 static std::string InitSharedInstanceWithLocale( | 129 static std::string InitSharedInstanceWithLocale( |
128 const std::string& pref_locale, Delegate* delegate); | 130 const std::string& pref_locale, |
129 | 131 Delegate* delegate, |
130 // Same as InitSharedInstanceWithLocale(), but loads only localized resources, | 132 bool should_load_common_resources); |
tony
2014/08/11 16:25:56
It would be better if this were an enum { LOAD_COM
tfarina
2014/08/12 04:01:01
Done.
| |
131 // without default resource packs. | |
132 static std::string InitSharedInstanceLocaleOnly( | |
133 const std::string& pref_locale, Delegate* delegate); | |
134 | 133 |
135 // Initialize the ResourceBundle using the given file region. If |region| is | 134 // Initialize the ResourceBundle using the given file region. If |region| is |
136 // MemoryMappedFile::Region::kWholeFile, the entire |pak_file| is used. | 135 // MemoryMappedFile::Region::kWholeFile, the entire |pak_file| is used. |
137 // |should_load_common_resources| controls whether or not LoadCommonResources | 136 // |should_load_common_resources| controls whether or not LoadCommonResources |
138 // is called. | 137 // is called. |
139 // This allows the use of this function in a sandbox without local file | 138 // This allows the use of this function in a sandbox without local file |
140 // access (as on Android). | 139 // access (as on Android). |
141 static void InitSharedInstanceWithPakFileRegion( | 140 static void InitSharedInstanceWithPakFileRegion( |
142 base::File pak_file, | 141 base::File pak_file, |
143 const base::MemoryMappedFile::Region& region, | 142 const base::MemoryMappedFile::Region& region, |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
421 | 420 |
422 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); | 421 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); |
423 }; | 422 }; |
424 | 423 |
425 } // namespace ui | 424 } // namespace ui |
426 | 425 |
427 // TODO(beng): Someday, maybe, get rid of this. | 426 // TODO(beng): Someday, maybe, get rid of this. |
428 using ui::ResourceBundle; | 427 using ui::ResourceBundle; |
429 | 428 |
430 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 429 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
OLD | NEW |