| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 DCHECK(thread_checker_.CalledOnValidThread()); | 78 DCHECK(thread_checker_.CalledOnValidThread()); |
| 79 metrics::MetricsService* metrics = GetMetricsService(); | 79 metrics::MetricsService* metrics = GetMetricsService(); |
| 80 | 80 |
| 81 if (client_->OnlyDoMetricsRecording()) { | 81 if (client_->OnlyDoMetricsRecording()) { |
| 82 metrics->StartRecordingForTests(); | 82 metrics->StartRecordingForTests(); |
| 83 GetRapporService()->Update( | 83 GetRapporService()->Update( |
| 84 rappor::UMA_RAPPOR_GROUP | rappor::SAFEBROWSING_RAPPOR_GROUP, false); | 84 rappor::UMA_RAPPOR_GROUP | rappor::SAFEBROWSING_RAPPOR_GROUP, false); |
| 85 return; | 85 return; |
| 86 } | 86 } |
| 87 | 87 |
| 88 client_->UpdateRunningServices(may_record_, may_upload_); |
| 89 |
| 88 if (may_record_) { | 90 if (may_record_) { |
| 89 if (!metrics->recording_active()) | 91 if (!metrics->recording_active()) |
| 90 metrics->Start(); | 92 metrics->Start(); |
| 91 | 93 |
| 92 if (may_upload_) | 94 if (may_upload_) |
| 93 metrics->EnableReporting(); | 95 metrics->EnableReporting(); |
| 94 else | 96 else |
| 95 metrics->DisableReporting(); | 97 metrics->DisableReporting(); |
| 96 } else { | 98 } else { |
| 97 metrics->Stop(); | 99 metrics->Stop(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 113 recording_groups |= rappor::SAFEBROWSING_RAPPOR_GROUP; | 115 recording_groups |= rappor::SAFEBROWSING_RAPPOR_GROUP; |
| 114 #endif // defined(GOOGLE_CHROME_BUILD) | 116 #endif // defined(GOOGLE_CHROME_BUILD) |
| 115 GetRapporService()->Update(recording_groups, may_upload_); | 117 GetRapporService()->Update(recording_groups, may_upload_); |
| 116 } | 118 } |
| 117 | 119 |
| 118 void MetricsServicesManager::UpdateUploadPermissions(bool may_upload) { | 120 void MetricsServicesManager::UpdateUploadPermissions(bool may_upload) { |
| 119 UpdatePermissions(client_->IsMetricsReportingEnabled(), may_upload); | 121 UpdatePermissions(client_->IsMetricsReportingEnabled(), may_upload); |
| 120 } | 122 } |
| 121 | 123 |
| 122 } // namespace metrics_services_manager | 124 } // namespace metrics_services_manager |
| OLD | NEW |