OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/installer/util/google_update_settings.h" | 5 #include "chrome/installer/util/google_update_settings.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
11 | 11 |
12 namespace google_update { | 12 namespace google_update { |
13 | 13 |
14 static std::string& posix_guid() { | 14 static std::string& posix_guid() { |
15 CR_DEFINE_STATIC_LOCAL(std::string, guid, ()); | 15 CR_DEFINE_STATIC_LOCAL(std::string, guid, ()); |
16 return guid; | 16 return guid; |
17 } | 17 } |
18 | 18 |
19 } // namespace google_update | 19 } // namespace google_update |
20 | 20 |
21 // File name used in the user data dir to indicate consent. | 21 // File name used in the user data dir to indicate consent. |
22 static const char kConsentToSendStats[] = "Consent To Send Stats"; | 22 static const char kConsentToSendStats[] = "Consent To Send Stats"; |
23 | 23 |
24 // static | 24 // static |
25 bool GoogleUpdateSettings::GetCollectStatsConsent() { | 25 bool GoogleUpdateSettings::GetCollectStatsConsent() { |
26 base::FilePath consent_file; | 26 base::FilePath consent_file; |
27 PathService::Get(chrome::DIR_USER_DATA, &consent_file); | 27 PathService::Get(chrome::DIR_USER_DATA, &consent_file); |
28 consent_file = consent_file.Append(kConsentToSendStats); | 28 consent_file = consent_file.Append(kConsentToSendStats); |
29 std::string tmp_guid; | 29 std::string tmp_guid; |
30 bool consented = file_util::ReadFileToString(consent_file, &tmp_guid); | 30 bool consented = base::ReadFileToString(consent_file, &tmp_guid); |
31 if (consented) | 31 if (consented) |
32 google_update::posix_guid().assign(tmp_guid); | 32 google_update::posix_guid().assign(tmp_guid); |
33 return consented; | 33 return consented; |
34 } | 34 } |
35 | 35 |
36 // static | 36 // static |
37 bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { | 37 bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { |
38 base::FilePath consent_dir; | 38 base::FilePath consent_dir; |
39 PathService::Get(chrome::DIR_USER_DATA, &consent_dir); | 39 PathService::Get(chrome::DIR_USER_DATA, &consent_dir); |
40 if (!base::DirectoryExists(consent_dir)) | 40 if (!base::DirectoryExists(consent_dir)) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 // static | 76 // static |
77 int GoogleUpdateSettings::GetLastRunTime() { | 77 int GoogleUpdateSettings::GetLastRunTime() { |
78 return -1; | 78 return -1; |
79 } | 79 } |
80 | 80 |
81 // static | 81 // static |
82 bool GoogleUpdateSettings::SetLastRunTime() { | 82 bool GoogleUpdateSettings::SetLastRunTime() { |
83 return false; | 83 return false; |
84 } | 84 } |
OLD | NEW |