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" |
(...skipping 24 matching lines...) Expand all Loading... |
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 (!file_util::DirectoryExists(consent_dir)) | 40 if (!file_util::DirectoryExists(consent_dir)) |
41 return false; | 41 return false; |
42 | 42 |
43 base::FilePath consent_file = consent_dir.AppendASCII(kConsentToSendStats); | 43 base::FilePath consent_file = consent_dir.AppendASCII(kConsentToSendStats); |
44 if (consented) { | 44 if (consented) { |
45 if ((!file_util::PathExists(consent_file)) || | 45 if ((!base::PathExists(consent_file)) || |
46 (file_util::PathExists(consent_file) && | 46 (base::PathExists(consent_file) && |
47 !google_update::posix_guid().empty())) { | 47 !google_update::posix_guid().empty())) { |
48 const char* c_str = google_update::posix_guid().c_str(); | 48 const char* c_str = google_update::posix_guid().c_str(); |
49 int size = google_update::posix_guid().size(); | 49 int size = google_update::posix_guid().size(); |
50 return file_util::WriteFile(consent_file, c_str, size) == size; | 50 return file_util::WriteFile(consent_file, c_str, size) == size; |
51 } | 51 } |
52 } else { | 52 } else { |
53 google_update::posix_guid().clear(); | 53 google_update::posix_guid().clear(); |
54 return base::Delete(consent_file, false); | 54 return base::Delete(consent_file, false); |
55 } | 55 } |
56 return true; | 56 return true; |
(...skipping 18 matching lines...) Expand all 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 |