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

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

Issue 322523002: Adding OverrideStringResource API to ResourceBundle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | « no previous file | ui/base/resource/resource_bundle.cc » ('j') | ui/base/resource/resource_bundle.cc » ('J')
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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 const gfx::Font& GetFont(FontStyle style); 238 const gfx::Font& GetFont(FontStyle style);
239 239
240 // Resets and reloads the cached fonts. This is useful when the fonts of the 240 // Resets and reloads the cached fonts. This is useful when the fonts of the
241 // system have changed, for example, when the locale has changed. 241 // system have changed, for example, when the locale has changed.
242 void ReloadFonts(); 242 void ReloadFonts();
243 243
244 // Overrides the path to the pak file from which the locale resources will be 244 // Overrides the path to the pak file from which the locale resources will be
245 // loaded. Pass an empty path to undo. 245 // loaded. Pass an empty path to undo.
246 void OverrideLocalePakForTest(const base::FilePath& pak_path); 246 void OverrideLocalePakForTest(const base::FilePath& pak_path);
247 247
248 // Overrides a localized string resource with the given string. If no delegate
249 // is present, the |string| will be returned when getting the localized string
250 // |message_id|. This is intended to be used in conjunction with field trials
251 // and the variations service to experiment with different UI strings.
252 void OverrideStringResource(int message_id, const base::string16& string);
253
248 // Returns the full pathname of the locale file to load. May return an empty 254 // Returns the full pathname of the locale file to load. May return an empty
249 // string if no locale data files are found and |test_file_exists| is true. 255 // string if no locale data files are found and |test_file_exists| is true.
250 // Used on Android to load the local file in the browser process and pass it 256 // Used on Android to load the local file in the browser process and pass it
251 // to the sandboxed renderer process. 257 // to the sandboxed renderer process.
252 base::FilePath GetLocaleFilePath(const std::string& app_locale, 258 base::FilePath GetLocaleFilePath(const std::string& app_locale,
253 bool test_file_exists); 259 bool test_file_exists);
254 260
255 // Returns the maximum scale factor currently loaded. 261 // Returns the maximum scale factor currently loaded.
256 // Returns SCALE_FACTOR_100P if no resource is loaded. 262 // Returns SCALE_FACTOR_100P if no resource is loaded.
257 ScaleFactor GetMaxScaleFactor() const; 263 ScaleFactor GetMaxScaleFactor() const;
258 264
259 private: 265 private:
260 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetPathForLocalePack); 266 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetPathForLocalePack);
261 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetImageNamed); 267 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetImageNamed);
262 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetNativeImageNamed); 268 FRIEND_TEST_ALL_PREFIXES(ResourceBundleTest, DelegateGetNativeImageNamed);
263 269
264 friend class ResourceBundleImageTest; 270 friend class ResourceBundleImageTest;
265 friend class ResourceBundleTest; 271 friend class ResourceBundleTest;
266 272
267 class ResourceBundleImageSource; 273 class ResourceBundleImageSource;
268 friend class ResourceBundleImageSource; 274 friend class ResourceBundleImageSource;
269 275
276 typedef base::hash_map<int, base::string16> IdToStringMap;
grt (UTC plus 2) 2014/06/11 01:51:18 #include "base/containers/hash_tables.h"
jwd 2014/07/03 17:41:31 Done.
277
270 // Ctor/dtor are private, since we're a singleton. 278 // Ctor/dtor are private, since we're a singleton.
271 explicit ResourceBundle(Delegate* delegate); 279 explicit ResourceBundle(Delegate* delegate);
272 ~ResourceBundle(); 280 ~ResourceBundle();
273 281
274 // Shared initialization. 282 // Shared initialization.
275 static void InitSharedInstance(Delegate* delegate); 283 static void InitSharedInstance(Delegate* delegate);
276 284
277 // Free skia_images_. 285 // Free skia_images_.
278 void FreeImages(); 286 void FreeImages();
279 287
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 scoped_ptr<gfx::FontList> small_font_list_; 392 scoped_ptr<gfx::FontList> small_font_list_;
385 scoped_ptr<gfx::FontList> small_bold_font_list_; 393 scoped_ptr<gfx::FontList> small_bold_font_list_;
386 scoped_ptr<gfx::FontList> medium_font_list_; 394 scoped_ptr<gfx::FontList> medium_font_list_;
387 scoped_ptr<gfx::FontList> medium_bold_font_list_; 395 scoped_ptr<gfx::FontList> medium_bold_font_list_;
388 scoped_ptr<gfx::FontList> large_font_list_; 396 scoped_ptr<gfx::FontList> large_font_list_;
389 scoped_ptr<gfx::FontList> large_bold_font_list_; 397 scoped_ptr<gfx::FontList> large_bold_font_list_;
390 scoped_ptr<gfx::FontList> web_font_list_; 398 scoped_ptr<gfx::FontList> web_font_list_;
391 399
392 base::FilePath overridden_pak_path_; 400 base::FilePath overridden_pak_path_;
393 401
402 IdToStringMap overridden_strings_;
403
394 DISALLOW_COPY_AND_ASSIGN(ResourceBundle); 404 DISALLOW_COPY_AND_ASSIGN(ResourceBundle);
395 }; 405 };
396 406
397 } // namespace ui 407 } // namespace ui
398 408
399 // TODO(beng): Someday, maybe, get rid of this. 409 // TODO(beng): Someday, maybe, get rid of this.
400 using ui::ResourceBundle; 410 using ui::ResourceBundle;
401 411
402 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_ 412 #endif // UI_BASE_RESOURCE_RESOURCE_BUNDLE_H_
OLDNEW
« no previous file with comments | « no previous file | ui/base/resource/resource_bundle.cc » ('j') | ui/base/resource/resource_bundle.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698