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

Unified Diff: chrome/browser/google/google_util_chromeos.cc

Issue 11506006: [cros] RLZ tracking can be turned off via a flag file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Set zero delay for RLZTracker in browser_tests Created 8 years 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
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..8eabc42d28850de4dcd699ce0147f95cca76ec4a 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 SetBrandForCurrentSession(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))
Ilya Sherman 2012/12/15 00:57:16 nit: This is usually written as "if (g_temporary_b
Ivan Korotkov 2012/12/17 09:05:01 Like I said above, LazyInstance only has operator=
+ return g_temporary_brand.Get();
DCHECK(g_browser_process->local_state());
return g_browser_process->local_state()->GetString(prefs::kRLZBrand);
}

Powered by Google App Engine
This is Rietveld 408576698