Index: chrome/browser/google/google_update_settings_posix.cc |
diff --git a/chrome/browser/google/google_update_settings_posix.cc b/chrome/browser/google/google_update_settings_posix.cc |
index 242407c8696d31a157652df9410f74beb1d5e657..7d2a8260c1e2628c2a6bd83c162a035a9b545058 100644 |
--- a/chrome/browser/google/google_update_settings_posix.cc |
+++ b/chrome/browser/google/google_update_settings_posix.cc |
@@ -10,9 +10,14 @@ |
#include "chrome/common/chrome_paths.h" |
namespace google_update { |
-std::string posix_guid; |
+ |
+static std::string& posix_guid() { |
joth
2011/11/18 01:16:37
nit: non-const reference not allowed in style guid
|
+ CR_DEFINE_STATIC_LOCAL(std::string, guid, ()); |
+ return guid; |
} |
+} // namespace google_update |
+ |
// File name used in the user data dir to indicate consent. |
static const char kConsentToSendStats[] = "Consent To Send Stats"; |
@@ -24,7 +29,7 @@ bool GoogleUpdateSettings::GetCollectStatsConsent() { |
std::string tmp_guid; |
bool consented = file_util::ReadFileToString(consent_file, &tmp_guid); |
if (consented) |
- google_update::posix_guid.assign(tmp_guid); |
+ google_update::posix_guid().assign(tmp_guid); |
return consented; |
} |
@@ -39,13 +44,13 @@ bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { |
if (consented) { |
if ((!file_util::PathExists(consent_file)) || |
(file_util::PathExists(consent_file) && |
- !google_update::posix_guid.empty())) { |
- const char* c_str = google_update::posix_guid.c_str(); |
- int size = google_update::posix_guid.size(); |
+ !google_update::posix_guid().empty())) { |
+ const char* c_str = google_update::posix_guid().c_str(); |
+ int size = google_update::posix_guid().size(); |
return file_util::WriteFile(consent_file, c_str, size) == size; |
} |
} else { |
- google_update::posix_guid.clear(); |
+ google_update::posix_guid().clear(); |
return file_util::Delete(consent_file, false); |
} |
return true; |
@@ -60,7 +65,7 @@ bool GoogleUpdateSettings::SetMetricsId(const std::wstring& client_id) { |
return false; |
// Since user has consented, write the metrics id to the file. |
- google_update::posix_guid = WideToASCII(client_id); |
+ google_update::posix_guid() = WideToASCII(client_id); |
return GoogleUpdateSettings::SetCollectStatsConsent(true); |
} |