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

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

Issue 394313002: Add support for loading pak files from arbitrary file regions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move Region to MemoryMappedFile 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
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
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/files/memory_mapped_file.h"
14 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
15 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/scoped_vector.h" 17 #include "base/memory/scoped_vector.h"
17 #include "base/strings/string16.h" 18 #include "base/strings/string16.h"
18 #include "base/strings/string_piece.h" 19 #include "base/strings/string_piece.h"
19 #include "build/build_config.h" 20 #include "build/build_config.h"
20 #include "ui/base/layout.h" 21 #include "ui/base/layout.h"
21 #include "ui/base/ui_base_export.h" 22 #include "ui/base/ui_base_export.h"
22 #include "ui/gfx/font_list.h" 23 #include "ui/gfx/font_list.h"
23 #include "ui/gfx/image/image.h" 24 #include "ui/gfx/image/image.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // or just the pack file name otherwise (the delegate may optionally override 160 // or just the pack file name otherwise (the delegate may optionally override
160 // this value). |scale_factor| is the scale of images in this resource pak 161 // this value). |scale_factor| is the scale of images in this resource pak
161 // relative to the images in the 1x resource pak. This method is not thread 162 // relative to the images in the 1x resource pak. This method is not thread
162 // safe! You should call it immediately after calling InitSharedInstance. 163 // safe! You should call it immediately after calling InitSharedInstance.
163 void AddDataPackFromPath(const base::FilePath& path, 164 void AddDataPackFromPath(const base::FilePath& path,
164 ScaleFactor scale_factor); 165 ScaleFactor scale_factor);
165 166
166 // Same as above but using an already open file. 167 // Same as above but using an already open file.
167 void AddDataPackFromFile(base::File file, ScaleFactor scale_factor); 168 void AddDataPackFromFile(base::File file, ScaleFactor scale_factor);
168 169
170 // Same as above but using only a region (offset + size) of the file.
171 void AddDataPackFromFileRegion(base::File file,
172 const base::MemoryMappedFile::Region& region,
173 ScaleFactor scale_factor);
174
169 // Same as AddDataPackFromPath but does not log an error if the pack fails to 175 // Same as AddDataPackFromPath but does not log an error if the pack fails to
170 // load. 176 // load.
171 void AddOptionalDataPackFromPath(const base::FilePath& path, 177 void AddOptionalDataPackFromPath(const base::FilePath& path,
172 ScaleFactor scale_factor); 178 ScaleFactor scale_factor);
173 179
174 // Changes the locale for an already-initialized ResourceBundle, returning the 180 // Changes the locale for an already-initialized ResourceBundle, returning the
175 // name of the newly-loaded locale. Future calls to get strings will return 181 // name of the newly-loaded locale. Future calls to get strings will return
176 // the strings for this new locale. This has no effect on existing or future 182 // the strings for this new locale. This has no effect on existing or future
177 // image resources. |locale_resources_data_| is protected by a lock for the 183 // image resources. |locale_resources_data_| is protected by a lock for the
178 // duration of the swap, as GetLocalizedString() may be concurrently invoked 184 // duration of the swap, as GetLocalizedString() may be concurrently invoked
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 417
412 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); 418 DISALLOW_COPY_AND_ASSIGN(ResourceBundle);
413 }; 419 };
414 420
415 } // namespace ui 421 } // namespace ui
416 422
417 // TODO(beng): Someday, maybe, get rid of this. 423 // TODO(beng): Someday, maybe, get rid of this.
418 using ui::ResourceBundle; 424 using ui::ResourceBundle;
419 425
420 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ 426 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698