| 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" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 int size = client_id.size(); | 87 int size = client_id.size(); |
| 88 bool write_success = | 88 bool write_success = |
| 89 base::WriteFile(consent_file, client_id.c_str(), size) == size; | 89 base::WriteFile(consent_file, client_id.c_str(), size) == size; |
| 90 if (write_success) | 90 if (write_success) |
| 91 SetConsentFilePermissionIfNeeded(consent_file); | 91 SetConsentFilePermissionIfNeeded(consent_file); |
| 92 return write_success; | 92 return write_success; |
| 93 } | 93 } |
| 94 | 94 |
| 95 // static | 95 // static |
| 96 // TODO(gab): Implement storing/loading for all ClientInfo fields on POSIX. | 96 // TODO(gab): Implement storing/loading for all ClientInfo fields on POSIX. |
| 97 scoped_ptr<metrics::ClientInfo> GoogleUpdateSettings::LoadMetricsClientInfo() { | 97 std::unique_ptr<metrics::ClientInfo> |
| 98 scoped_ptr<metrics::ClientInfo> client_info(new metrics::ClientInfo); | 98 GoogleUpdateSettings::LoadMetricsClientInfo() { |
| 99 std::unique_ptr<metrics::ClientInfo> client_info(new metrics::ClientInfo); |
| 99 | 100 |
| 100 base::AutoLock lock(g_posix_client_id_lock.Get()); | 101 base::AutoLock lock(g_posix_client_id_lock.Get()); |
| 101 if (g_posix_client_id.Get().empty()) | 102 if (g_posix_client_id.Get().empty()) |
| 102 return scoped_ptr<metrics::ClientInfo>(); | 103 return nullptr; |
| 103 client_info->client_id = g_posix_client_id.Get(); | 104 client_info->client_id = g_posix_client_id.Get(); |
| 104 | 105 |
| 105 return client_info; | 106 return client_info; |
| 106 } | 107 } |
| 107 | 108 |
| 108 // static | 109 // static |
| 109 // TODO(gab): Implement storing/loading for all ClientInfo fields on POSIX. | 110 // TODO(gab): Implement storing/loading for all ClientInfo fields on POSIX. |
| 110 void GoogleUpdateSettings::StoreMetricsClientInfo( | 111 void GoogleUpdateSettings::StoreMetricsClientInfo( |
| 111 const metrics::ClientInfo& client_info) { | 112 const metrics::ClientInfo& client_info) { |
| 112 // Make sure that user has consented to send crashes. | 113 // Make sure that user has consented to send crashes. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 127 | 128 |
| 128 // static | 129 // static |
| 129 int GoogleUpdateSettings::GetLastRunTime() { | 130 int GoogleUpdateSettings::GetLastRunTime() { |
| 130 return -1; | 131 return -1; |
| 131 } | 132 } |
| 132 | 133 |
| 133 // static | 134 // static |
| 134 bool GoogleUpdateSettings::SetLastRunTime() { | 135 bool GoogleUpdateSettings::SetLastRunTime() { |
| 135 return false; | 136 return false; |
| 136 } | 137 } |
| OLD | NEW |