OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/metrics_services_manager/metrics_services_manager.h" | 5 #include "components/metrics_services_manager/metrics_services_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "components/metrics/metrics_service.h" | 10 #include "components/metrics/metrics_service.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 UpdateUkmService(); | 125 UpdateUkmService(); |
126 | 126 |
127 GetRapporServiceImpl()->Update(may_record_, may_upload_); | 127 GetRapporServiceImpl()->Update(may_record_, may_upload_); |
128 } | 128 } |
129 | 129 |
130 void MetricsServicesManager::UpdateUkmService() { | 130 void MetricsServicesManager::UpdateUkmService() { |
131 ukm::UkmService* ukm = GetUkmService(); | 131 ukm::UkmService* ukm = GetUkmService(); |
132 if (!ukm) | 132 if (!ukm) |
133 return; | 133 return; |
134 bool sync_enabled = | 134 bool sync_enabled = |
| 135 client_->IsMetricsReportingForceEnabled() || |
135 metrics_service_client_->IsHistorySyncEnabledOnAllProfiles(); | 136 metrics_service_client_->IsHistorySyncEnabledOnAllProfiles(); |
136 if (may_record_ && sync_enabled) { | 137 if (may_record_ && sync_enabled) { |
137 ukm->EnableRecording(); | 138 ukm->EnableRecording(); |
138 if (may_upload_) | 139 if (may_upload_) |
139 ukm->EnableReporting(); | 140 ukm->EnableReporting(); |
140 else | 141 else |
141 ukm->DisableReporting(); | 142 ukm->DisableReporting(); |
142 } else { | 143 } else { |
143 ukm->DisableRecording(); | 144 ukm->DisableRecording(); |
144 ukm->DisableReporting(); | 145 ukm->DisableReporting(); |
145 } | 146 } |
146 } | 147 } |
147 | 148 |
148 void MetricsServicesManager::UpdateUploadPermissions(bool may_upload) { | 149 void MetricsServicesManager::UpdateUploadPermissions(bool may_upload) { |
149 UpdatePermissions(client_->IsMetricsReportingEnabled(), may_upload); | 150 UpdatePermissions((client_->IsMetricsReportingForceEnabled() || |
| 151 client_->IsMetricsReportingEnabled()), |
| 152 client_->IsMetricsReportingForceEnabled() || may_upload); |
150 } | 153 } |
151 | 154 |
152 } // namespace metrics_services_manager | 155 } // namespace metrics_services_manager |
OLD | NEW |