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

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: Review fixes 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..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);
}

Powered by Google App Engine
This is Rietveld 408576698