Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: ui/base/resource/resource_bundle.h

Issue 457103003: Merge ResourceBundle's InitSharedInstanceLocaleOnly with InitSharedInstanceWithLocale(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: REBASE Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/base/resources_mac.cc ('k') | ui/base/resource/resource_bundle.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 LargeBoldFont, 57 LargeBoldFont,
58 }; 58 };
59 59
60 enum ImageRTL { 60 enum ImageRTL {
61 // Images are flipped in RTL locales. 61 // Images are flipped in RTL locales.
62 RTL_ENABLED, 62 RTL_ENABLED,
63 // Images are never flipped. 63 // Images are never flipped.
64 RTL_DISABLED, 64 RTL_DISABLED,
65 }; 65 };
66 66
67 enum LoadResources {
68 LOAD_COMMON_RESOURCES,
69 DO_NOT_LOAD_COMMON_RESOURCES
70 };
71
67 // Delegate class that allows interception of pack file loading and resource 72 // Delegate class that allows interception of pack file loading and resource
68 // requests. The methods of this class may be called on multiple threads. 73 // requests. The methods of this class may be called on multiple threads.
69 class Delegate { 74 class Delegate {
70 public: 75 public:
71 // Called before a resource pack file is loaded. Return the full path for 76 // Called before a resource pack file is loaded. Return the full path for
72 // the pack file to continue loading or an empty value to cancel loading. 77 // the pack file to continue loading or an empty value to cancel loading.
73 // |pack_path| will contain the complete default path for the pack file if 78 // |pack_path| will contain the complete default path for the pack file if
74 // known or just the pack file name otherwise. 79 // known or just the pack file name otherwise.
75 virtual base::FilePath GetPathForResourcePack( 80 virtual base::FilePath GetPathForResourcePack(
76 const base::FilePath& pack_path, 81 const base::FilePath& pack_path,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 122
118 // Initialize the ResourceBundle for this process. Does not take ownership of 123 // Initialize the ResourceBundle for this process. Does not take ownership of
119 // the |delegate| value. Returns the language selected. 124 // the |delegate| value. Returns the language selected.
120 // NOTE: Mac ignores this and always loads up resources for the language 125 // 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). 126 // defined by the Cocoa UI (i.e., NSBundle does the language work).
122 // 127 //
123 // TODO(sergeyu): This method also loads common resources (i.e. chrome.pak). 128 // 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 129 // 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 130 // 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). 131 // files are loaded (e.g. add a new method in Delegate).
132 // |load_resources| controls whether or not LoadCommonResources is called.
127 static std::string InitSharedInstanceWithLocale( 133 static std::string InitSharedInstanceWithLocale(
128 const std::string& pref_locale, Delegate* delegate); 134 const std::string& pref_locale,
129 135 Delegate* delegate,
130 // Same as InitSharedInstanceWithLocale(), but loads only localized resources, 136 LoadResources load_resources);
131 // without default resource packs.
132 static std::string InitSharedInstanceLocaleOnly(
133 const std::string& pref_locale, Delegate* delegate);
134 137
135 // Initialize the ResourceBundle using the given file region. If |region| is 138 // Initialize the ResourceBundle using the given file region. If |region| is
136 // MemoryMappedFile::Region::kWholeFile, the entire |pak_file| is used. 139 // MemoryMappedFile::Region::kWholeFile, the entire |pak_file| is used.
137 // This allows the use of this function in a sandbox without local file 140 // This allows the use of this function in a sandbox without local file
138 // access (as on Android). 141 // access (as on Android).
139 static void InitSharedInstanceWithPakFileRegion( 142 static void InitSharedInstanceWithPakFileRegion(
140 base::File pak_file, 143 base::File pak_file,
141 const base::MemoryMappedFile::Region& region); 144 const base::MemoryMappedFile::Region& region);
142 145
143 // Initialize the ResourceBundle using given data pack path for testing. 146 // Initialize the ResourceBundle using given data pack path for testing.
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 421
419 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); 422 DISALLOW_COPY_AND_ASSIGN(ResourceBundle);
420 }; 423 };
421 424
422 } // namespace ui 425 } // namespace ui
423 426
424 // TODO(beng): Someday, maybe, get rid of this. 427 // TODO(beng): Someday, maybe, get rid of this.
425 using ui::ResourceBundle; 428 using ui::ResourceBundle;
426 429
427 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ 430 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_
OLDNEW
« no previous file with comments | « remoting/base/resources_mac.cc ('k') | ui/base/resource/resource_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698