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

Side by Side 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: Re-apply ps#16, it got lost 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 unified diff | Download patch | Annotate | Revision Log
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 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 22 matching lines...) Expand all
33 TrimWhitespace(brand, TRIM_ALL, &brand); 33 TrimWhitespace(brand, TRIM_ALL, &brand);
34 return brand; 34 return brand;
35 } 35 }
36 36
37 // Sets the brand code to |brand|. 37 // Sets the brand code to |brand|.
38 void SetBrand(const base::Closure& callback, const std::string& brand) { 38 void SetBrand(const base::Closure& callback, const std::string& brand) {
39 g_browser_process->local_state()->SetString(prefs::kRLZBrand, brand); 39 g_browser_process->local_state()->SetString(prefs::kRLZBrand, brand);
40 callback.Run(); 40 callback.Run();
41 } 41 }
42 42
43 // True if brand code has been cleared for the current session.
44 bool g_brand_empty = false;
45
43 } // namespace 46 } // namespace
44 47
48 void ClearBrandForCurrentSession() {
49 DCHECK(
50 !content::BrowserThread::IsWellKnownThread(content::BrowserThread::UI) ||
51 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
52 g_brand_empty = true;
53 }
54
45 std::string GetBrand() { 55 std::string GetBrand() {
46 DCHECK( 56 DCHECK(
47 !content::BrowserThread::IsWellKnownThread(content::BrowserThread::UI) || 57 !content::BrowserThread::IsWellKnownThread(content::BrowserThread::UI) ||
48 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 58 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
59 if (g_brand_empty)
60 return std::string();
49 DCHECK(g_browser_process->local_state()); 61 DCHECK(g_browser_process->local_state());
50 return g_browser_process->local_state()->GetString(prefs::kRLZBrand); 62 return g_browser_process->local_state()->GetString(prefs::kRLZBrand);
51 } 63 }
52 64
53 void SetBrandFromFile(const base::Closure& callback) { 65 void SetBrandFromFile(const base::Closure& callback) {
54 base::PostTaskAndReplyWithResult( 66 base::PostTaskAndReplyWithResult(
55 base::WorkerPool::GetTaskRunner(false /* task_is_slow */), 67 base::WorkerPool::GetTaskRunner(false /* task_is_slow */),
56 FROM_HERE, 68 FROM_HERE,
57 base::Bind(&ReadBrandFromFile), 69 base::Bind(&ReadBrandFromFile),
58 base::Bind(&SetBrand, callback)); 70 base::Bind(&SetBrand, callback));
59 } 71 }
60 72
61 } // namespace chromeos 73 } // namespace chromeos
62 } // namespace google_util 74 } // namespace google_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698