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

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

Issue 7677004: Switch to using .pak files for locale data on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment Created 9 years, 3 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 | « chrome_frame/chrome_frame.gyp ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 // Initialize the ResourceBundle for this process. Returns the language 77 // Initialize the ResourceBundle for this process. Returns the language
78 // selected. 78 // selected.
79 // NOTE: Mac ignores this and always loads up resources for the language 79 // NOTE: Mac ignores this and always loads up resources for the language
80 // defined by the Cocoa UI (ie-NSBundle does the langange work). 80 // defined by the Cocoa UI (ie-NSBundle does the langange work).
81 static std::string InitSharedInstance(const std::string& pref_locale); 81 static std::string InitSharedInstance(const std::string& pref_locale);
82 82
83 // Initialize the ResourceBundle using given data pack path for testing. 83 // Initialize the ResourceBundle using given data pack path for testing.
84 static void InitSharedInstanceForTest(const FilePath& path); 84 static void InitSharedInstanceForTest(const FilePath& path);
85 85
86 // Load a .pak file. Returns NULL if we fail to load |path|. The caller
87 // is responsible for deleting up this pointer.
88 static DataPack* LoadResourcesDataPak(const FilePath& path);
89
86 // Changes the locale for an already-initialized ResourceBundle. Future 90 // Changes the locale for an already-initialized ResourceBundle. Future
87 // calls to get strings will return the strings for this new locale. This 91 // calls to get strings will return the strings for this new locale. This
88 // has no effect on existing or future image resources. This has no effect 92 // has no effect on existing or future image resources. This has no effect
89 // on existing or future image resources, and thus does not use the lock to 93 // on existing or future image resources, and thus does not use the lock to
90 // guarantee thread-safety, since all string access is expected to happen on 94 // guarantee thread-safety, since all string access is expected to happen on
91 // the UI thread. 95 // the UI thread.
92 static std::string ReloadSharedInstance(const std::string& pref_locale); 96 static std::string ReloadSharedInstance(const std::string& pref_locale);
93 97
94 // Registers additional data pack files with the global ResourceBundle. When 98 // Registers additional data pack files with the global ResourceBundle. When
95 // looking for a DataResource, we will search these files after searching the 99 // looking for a DataResource, we will search these files after searching the
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // bright red bitmap. 268 // bright red bitmap.
265 gfx::Image* GetEmptyImage(); 269 gfx::Image* GetEmptyImage();
266 270
267 // Class level lock. Used to protect internal data structures that may be 271 // Class level lock. Used to protect internal data structures that may be
268 // accessed from other threads (e.g., images_). 272 // accessed from other threads (e.g., images_).
269 scoped_ptr<base::Lock> lock_; 273 scoped_ptr<base::Lock> lock_;
270 274
271 // Handles for data sources. 275 // Handles for data sources.
272 DataHandle resources_data_; 276 DataHandle resources_data_;
273 DataHandle large_icon_resources_data_; 277 DataHandle large_icon_resources_data_;
274 DataHandle locale_resources_data_; 278 #if !defined(NACL_WIN64)
279 scoped_ptr<DataPack> locale_resources_data_;
280 #endif
275 281
276 // References to extra data packs loaded via AddDataPackToSharedInstance. 282 // References to extra data packs loaded via AddDataPackToSharedInstance.
277 std::vector<LoadedDataPack*> data_packs_; 283 std::vector<LoadedDataPack*> data_packs_;
278 284
279 // Cached images. The ResourceBundle caches all retrieved images and keeps 285 // Cached images. The ResourceBundle caches all retrieved images and keeps
280 // ownership of the pointers. 286 // ownership of the pointers.
281 typedef std::map<int, gfx::Image*> ImageMap; 287 typedef std::map<int, gfx::Image*> ImageMap;
282 ImageMap images_; 288 ImageMap images_;
283 289
284 // The various fonts used. Cached to avoid repeated GDI creation/destruction. 290 // The various fonts used. Cached to avoid repeated GDI creation/destruction.
(...skipping 10 matching lines...) Expand all
295 301
296 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); 302 DISALLOW_COPY_AND_ASSIGN(ResourceBundle);
297 }; 303 };
298 304
299 } // namespace ui 305 } // namespace ui
300 306
301 // TODO(beng): Someday, maybe, get rid of this. 307 // TODO(beng): Someday, maybe, get rid of this.
302 using ui::ResourceBundle; 308 using ui::ResourceBundle;
303 309
304 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ 310 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_
OLDNEW
« no previous file with comments | « chrome_frame/chrome_frame.gyp ('k') | ui/base/resource/resource_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698