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/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
13 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
14 | 14 |
| 15 #if defined(OS_MACOSX) |
| 16 #include "components/crash/app/crashpad_mac.h" |
| 17 #endif |
| 18 |
15 namespace { | 19 namespace { |
16 | 20 |
17 base::LazyInstance<std::string>::Leaky g_posix_client_id = | 21 base::LazyInstance<std::string>::Leaky g_posix_client_id = |
18 LAZY_INSTANCE_INITIALIZER; | 22 LAZY_INSTANCE_INITIALIZER; |
19 base::LazyInstance<base::Lock>::Leaky g_posix_client_id_lock = | 23 base::LazyInstance<base::Lock>::Leaky g_posix_client_id_lock = |
20 LAZY_INSTANCE_INITIALIZER; | 24 LAZY_INSTANCE_INITIALIZER; |
21 | 25 |
22 // File name used in the user data dir to indicate consent. | 26 // File name used in the user data dir to indicate consent. |
23 const char kConsentToSendStats[] = "Consent To Send Stats"; | 27 const char kConsentToSendStats[] = "Consent To Send Stats"; |
24 | 28 |
(...skipping 26 matching lines...) Expand all Loading... |
51 SetConsentFilePermissionIfNeeded(consent_file); | 55 SetConsentFilePermissionIfNeeded(consent_file); |
52 | 56 |
53 base::AutoLock lock(g_posix_client_id_lock.Get()); | 57 base::AutoLock lock(g_posix_client_id_lock.Get()); |
54 g_posix_client_id.Get().assign(tmp_guid); | 58 g_posix_client_id.Get().assign(tmp_guid); |
55 } | 59 } |
56 return consented; | 60 return consented; |
57 } | 61 } |
58 | 62 |
59 // static | 63 // static |
60 bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { | 64 bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { |
| 65 #if defined(OS_MACOSX) |
| 66 crash_reporter::SetUploadsEnabled(consented); |
| 67 #endif |
| 68 |
61 base::FilePath consent_dir; | 69 base::FilePath consent_dir; |
62 PathService::Get(chrome::DIR_USER_DATA, &consent_dir); | 70 PathService::Get(chrome::DIR_USER_DATA, &consent_dir); |
63 if (!base::DirectoryExists(consent_dir)) | 71 if (!base::DirectoryExists(consent_dir)) |
64 return false; | 72 return false; |
65 | 73 |
66 base::AutoLock lock(g_posix_client_id_lock.Get()); | 74 base::AutoLock lock(g_posix_client_id_lock.Get()); |
67 | 75 |
68 base::FilePath consent_file = consent_dir.AppendASCII(kConsentToSendStats); | 76 base::FilePath consent_file = consent_dir.AppendASCII(kConsentToSendStats); |
69 if (!consented) { | 77 if (!consented) { |
70 g_posix_client_id.Get().clear(); | 78 g_posix_client_id.Get().clear(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 126 |
119 // static | 127 // static |
120 int GoogleUpdateSettings::GetLastRunTime() { | 128 int GoogleUpdateSettings::GetLastRunTime() { |
121 return -1; | 129 return -1; |
122 } | 130 } |
123 | 131 |
124 // static | 132 // static |
125 bool GoogleUpdateSettings::SetLastRunTime() { | 133 bool GoogleUpdateSettings::SetLastRunTime() { |
126 return false; | 134 return false; |
127 } | 135 } |
OLD | NEW |