| 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 |
| 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.h" |
| 13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.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" |
| 24 #include "ui/gfx/native_widget_types.h" | 25 #include "ui/gfx/native_widget_types.h" |
| 25 | 26 |
| 26 class SkBitmap; | 27 class SkBitmap; |
| 27 | 28 |
| 28 namespace base { | 29 namespace base { |
| 29 class File; | |
| 30 class Lock; | 30 class Lock; |
| 31 class RefCountedStaticMemory; | 31 class RefCountedStaticMemory; |
| 32 } | 32 } |
| 33 | 33 |
| 34 namespace ui { | 34 namespace ui { |
| 35 | 35 |
| 36 class DataPack; | 36 class DataPack; |
| 37 class ResourceHandle; | 37 class ResourceHandle; |
| 38 | 38 |
| 39 // ResourceBundle is a central facility to load images and other resources, | 39 // ResourceBundle is a central facility to load images and other resources, |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 // or just the pack file name otherwise (the delegate may optionally override | 159 // 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 | 160 // 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 | 161 // relative to the images in the 1x resource pak. This method is not thread |
| 162 // safe! You should call it immediately after calling InitSharedInstance. | 162 // safe! You should call it immediately after calling InitSharedInstance. |
| 163 void AddDataPackFromPath(const base::FilePath& path, | 163 void AddDataPackFromPath(const base::FilePath& path, |
| 164 ScaleFactor scale_factor); | 164 ScaleFactor scale_factor); |
| 165 | 165 |
| 166 // Same as above but using an already open file. | 166 // Same as above but using an already open file. |
| 167 void AddDataPackFromFile(base::File file, ScaleFactor scale_factor); | 167 void AddDataPackFromFile(base::File file, ScaleFactor scale_factor); |
| 168 | 168 |
| 169 // Same as above but using only a region (offset + size) of the file. |
| 170 void AddDataPackFromFileRegion(base::File file, |
| 171 const base::File::Region& region, |
| 172 ScaleFactor scale_factor); |
| 173 |
| 169 // Same as AddDataPackFromPath but does not log an error if the pack fails to | 174 // Same as AddDataPackFromPath but does not log an error if the pack fails to |
| 170 // load. | 175 // load. |
| 171 void AddOptionalDataPackFromPath(const base::FilePath& path, | 176 void AddOptionalDataPackFromPath(const base::FilePath& path, |
| 172 ScaleFactor scale_factor); | 177 ScaleFactor scale_factor); |
| 173 | 178 |
| 174 // Changes the locale for an already-initialized ResourceBundle, returning the | 179 // Changes the locale for an already-initialized ResourceBundle, returning the |
| 175 // name of the newly-loaded locale. Future calls to get strings will return | 180 // 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 | 181 // 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 | 182 // image resources. |locale_resources_data_| is protected by a lock for the |
| 178 // duration of the swap, as GetLocalizedString() may be concurrently invoked | 183 // duration of the swap, as GetLocalizedString() may be concurrently invoked |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 | 416 |
| 412 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); | 417 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); |
| 413 }; | 418 }; |
| 414 | 419 |
| 415 } // namespace ui | 420 } // namespace ui |
| 416 | 421 |
| 417 // TODO(beng): Someday, maybe, get rid of this. | 422 // TODO(beng): Someday, maybe, get rid of this. |
| 418 using ui::ResourceBundle; | 423 using ui::ResourceBundle; |
| 419 | 424 |
| 420 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 425 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
| OLD | NEW |