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 "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 ScaleFactor scale_factor) = 0; | 98 ScaleFactor scale_factor) = 0; |
99 | 99 |
100 // Retrieve a raw data resource. Return true if a resource was provided or | 100 // Retrieve a raw data resource. Return true if a resource was provided or |
101 // false to attempt retrieval of the default resource. | 101 // false to attempt retrieval of the default resource. |
102 virtual bool GetRawDataResource(int resource_id, | 102 virtual bool GetRawDataResource(int resource_id, |
103 ScaleFactor scale_factor, | 103 ScaleFactor scale_factor, |
104 base::StringPiece* value) = 0; | 104 base::StringPiece* value) = 0; |
105 | 105 |
106 // Retrieve a localized string. Return true if a string was provided or | 106 // Retrieve a localized string. Return true if a string was provided or |
107 // false to attempt retrieval of the default string. | 107 // false to attempt retrieval of the default string. |
108 virtual bool GetLocalizedString(int message_id, string16* value) = 0; | 108 virtual bool GetLocalizedString(int message_id, base::string16* value) = 0; |
109 | 109 |
110 // Returns a font or NULL to attempt retrieval of the default resource. | 110 // Returns a font or NULL to attempt retrieval of the default resource. |
111 virtual scoped_ptr<gfx::Font> GetFont(FontStyle style) = 0; | 111 virtual scoped_ptr<gfx::Font> GetFont(FontStyle style) = 0; |
112 | 112 |
113 protected: | 113 protected: |
114 virtual ~Delegate() {} | 114 virtual ~Delegate() {} |
115 }; | 115 }; |
116 | 116 |
117 // Initialize the ResourceBundle for this process. Does not take ownership of | 117 // Initialize the ResourceBundle for this process. Does not take ownership of |
118 // the |delegate| value. Returns the language selected. | 118 // the |delegate| value. Returns the language selected. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 223 |
224 // Return the contents of a resource in a StringPiece given the resource id | 224 // Return the contents of a resource in a StringPiece given the resource id |
225 // nearest the scale factor |scale_factor|. | 225 // nearest the scale factor |scale_factor|. |
226 // Use ResourceHandle::SCALE_FACTOR_NONE for scale independent image resources | 226 // Use ResourceHandle::SCALE_FACTOR_NONE for scale independent image resources |
227 // (such as wallpaper). | 227 // (such as wallpaper). |
228 base::StringPiece GetRawDataResourceForScale(int resource_id, | 228 base::StringPiece GetRawDataResourceForScale(int resource_id, |
229 ScaleFactor scale_factor) const; | 229 ScaleFactor scale_factor) const; |
230 | 230 |
231 // Get a localized string given a message id. Returns an empty | 231 // Get a localized string given a message id. Returns an empty |
232 // string if the message_id is not found. | 232 // string if the message_id is not found. |
233 string16 GetLocalizedString(int message_id); | 233 base::string16 GetLocalizedString(int message_id); |
234 | 234 |
235 // Returns the font list for the specified style. | 235 // Returns the font list for the specified style. |
236 const gfx::FontList& GetFontList(FontStyle style); | 236 const gfx::FontList& GetFontList(FontStyle style); |
237 | 237 |
238 // Returns the font for the specified style. | 238 // Returns the font for the specified style. |
239 const gfx::Font& GetFont(FontStyle style); | 239 const gfx::Font& GetFont(FontStyle style); |
240 | 240 |
241 // Resets and reloads the cached fonts. This is useful when the fonts of the | 241 // Resets and reloads the cached fonts. This is useful when the fonts of the |
242 // system have changed, for example, when the locale has changed. | 242 // system have changed, for example, when the locale has changed. |
243 void ReloadFonts(); | 243 void ReloadFonts(); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 | 394 |
395 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); | 395 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); |
396 }; | 396 }; |
397 | 397 |
398 } // namespace ui | 398 } // namespace ui |
399 | 399 |
400 // TODO(beng): Someday, maybe, get rid of this. | 400 // TODO(beng): Someday, maybe, get rid of this. |
401 using ui::ResourceBundle; | 401 using ui::ResourceBundle; |
402 | 402 |
403 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ | 403 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ |
OLD | NEW |