Index: chrome/browser/google/google_util_chromeos.cc |
diff --git a/chrome/browser/google/google_util_chromeos.cc b/chrome/browser/google/google_util_chromeos.cc |
index 2892efc7240d401e517776dfc4c9dedd4ef04e96..c7ce083003e8cb65511d5dbd48d97e2b68ab02e1 100644 |
--- a/chrome/browser/google/google_util_chromeos.cc |
+++ b/chrome/browser/google/google_util_chromeos.cc |
@@ -6,6 +6,7 @@ |
#include "base/bind.h" |
#include "base/file_path.h" |
#include "base/file_util.h" |
+#include "base/lazy_instance.h" |
#include "base/logging.h" |
#include "base/string_util.h" |
#include "base/task_runner_util.h" |
@@ -40,12 +41,24 @@ void SetBrand(const base::Closure& callback, const std::string& brand) { |
callback.Run(); |
} |
+base::LazyInstance<std::string> g_temporary_brand = LAZY_INSTANCE_INITIALIZER; |
+ |
} // namespace |
+void SetTemporaryBrand(const std::string& brand) { |
+ DCHECK( |
+ !content::BrowserThread::IsWellKnownThread(content::BrowserThread::UI) || |
+ content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
+ g_temporary_brand.Get().assign(brand); |
+} |
+ |
std::string GetBrand() { |
DCHECK( |
!content::BrowserThread::IsWellKnownThread(content::BrowserThread::UI) || |
content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
+ // Get() should not be called as it creates an instance. |
+ if (!(g_temporary_brand == NULL)) |
Peter Kasting
2012/12/11 20:21:49
Nit: Why not just use !=?
Ivan Korotkov
2012/12/12 13:05:56
LazyInstance has no operator!=. This looks like th
|
+ return g_temporary_brand.Get(); |
DCHECK(g_browser_process->local_state()); |
return g_browser_process->local_state()->GetString(prefs::kRLZBrand); |
} |