OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/installer/util/google_update_settings.h" |
| 6 |
| 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" |
| 9 #include "base/path_service.h" |
| 10 #include "chrome/common/chrome_paths.h" |
| 11 |
| 12 // File name used in the user data dir to indicate consent. |
| 13 static const char kConsentToSendStats[] = "Consent To Send Stats"; |
| 14 |
| 15 // static |
| 16 bool GoogleUpdateSettings::GetCollectStatsConsent() { |
| 17 FilePath consent_file; |
| 18 PathService::Get(chrome::DIR_USER_DATA, &consent_file); |
| 19 consent_file = consent_file.Append(kConsentToSendStats); |
| 20 return file_util::PathExists(consent_file); |
| 21 } |
| 22 |
| 23 // static |
| 24 bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { |
| 25 FilePath consent_dir; |
| 26 PathService::Get(chrome::DIR_USER_DATA, &consent_dir); |
| 27 if (!file_util::DirectoryExists(consent_dir)) |
| 28 return false; |
| 29 |
| 30 FilePath consent_file = consent_dir.AppendASCII(kConsentToSendStats); |
| 31 if (consented) |
| 32 return file_util::WriteFile(consent_file, "", 0) == 0; |
| 33 else |
| 34 return file_util::Delete(consent_file, false); |
| 35 } |
| 36 |
| 37 // static |
| 38 bool GoogleUpdateSettings::GetLanguage(std::wstring* language) { |
| 39 NOTIMPLEMENTED(); |
| 40 return false; |
| 41 } |
OLD | NEW |