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

Unified 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: Threading and reset 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/base/resource/resource_bundle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/resource/resource_bundle.h
diff --git a/ui/base/resource/resource_bundle.h b/ui/base/resource/resource_bundle.h
index 809b1125159ef939b2cbddb450b36f9f7ed57da4..ef006a8969e96511c66a1c175b57c5488527fbce 100644
--- a/ui/base/resource/resource_bundle.h
+++ b/ui/base/resource/resource_bundle.h
@@ -9,6 +9,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/containers/hash_tables.h"
#include "base/files/file_path.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
@@ -245,6 +246,15 @@ class UI_BASE_EXPORT ResourceBundle {
// loaded. Pass an empty path to undo.
void OverrideLocalePakForTest(const base::FilePath& pak_path);
+ // Overrides a localized string resource with the given string. If no delegate
+ // is present, the |string| will be returned when getting the localized string
+ // |message_id|. If |ReloadLocaleResources| is called, all overrides are
+ // cleared. This is intended to be used in conjunction with field trials and
+ // the variations service to experiment with different UI strings. This method
+ // is not thread safe!
+ void OverrideLocaleStringResource(int message_id,
grt (UTC plus 2) 2014/07/03 19:00:34 how will this be used so that it's safe?
jwd 2014/07/11 19:23:27 It's only used in prethreadcreate... It's only cal
+ const base::string16& string);
+
// Returns the full pathname of the locale file to load. May return an empty
// string if no locale data files are found and |test_file_exists| is true.
// Used on Android to load the local file in the browser process and pass it
@@ -267,6 +277,8 @@ class UI_BASE_EXPORT ResourceBundle {
class ResourceBundleImageSource;
friend class ResourceBundleImageSource;
+ typedef base::hash_map<int, base::string16> IdToStringMap;
+
// Ctor/dtor are private, since we're a singleton.
explicit ResourceBundle(Delegate* delegate);
~ResourceBundle();
@@ -391,6 +403,8 @@ class UI_BASE_EXPORT ResourceBundle {
base::FilePath overridden_pak_path_;
+ IdToStringMap overridden_locale_strings_;
+
DISALLOW_COPY_AND_ASSIGN(ResourceBundle);
};
« no previous file with comments | « no previous file | ui/base/resource/resource_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698