| 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 "chrome/browser/metrics/metrics_services_manager.h" | 5 #include "chrome/browser/metrics/metrics_services_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 13 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
| 14 #include "chrome/browser/metrics/chrome_metrics_service_client.h" | 14 #include "chrome/browser/metrics/chrome_metrics_service_client.h" |
| 15 #include "chrome/browser/metrics/metrics_reporting_state.h" | 15 #include "chrome/browser/metrics/metrics_reporting_state.h" |
| 16 #include "chrome/browser/metrics/variations/chrome_variations_service_client.h" | 16 #include "chrome/browser/metrics/variations/chrome_variations_service_client.h" |
| 17 #include "chrome/browser/metrics/variations/generated_resources_map.h" | 17 #include "chrome/browser/metrics/variations/ui_string_overrider_factory.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/browser/ui/browser_otr_state.h" | 20 #include "chrome/browser/ui/browser_otr_state.h" |
| 21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 23 #include "chrome/installer/util/google_update_settings.h" | 23 #include "chrome/installer/util/google_update_settings.h" |
| 24 #include "components/metrics/metrics_service.h" | 24 #include "components/metrics/metrics_service.h" |
| 25 #include "components/metrics/metrics_state_manager.h" | 25 #include "components/metrics/metrics_state_manager.h" |
| 26 #include "components/rappor/rappor_service.h" | 26 #include "components/rappor/rappor_service.h" |
| 27 #include "components/variations/service/variations_service.h" | 27 #include "components/variations/service/variations_service.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 return rappor_service_.get(); | 63 return rappor_service_.get(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 variations::VariationsService* MetricsServicesManager::GetVariationsService() { | 66 variations::VariationsService* MetricsServicesManager::GetVariationsService() { |
| 67 DCHECK(thread_checker_.CalledOnValidThread()); | 67 DCHECK(thread_checker_.CalledOnValidThread()); |
| 68 if (!variations_service_) { | 68 if (!variations_service_) { |
| 69 variations_service_ = variations::VariationsService::Create( | 69 variations_service_ = variations::VariationsService::Create( |
| 70 make_scoped_ptr(new ChromeVariationsServiceClient()), local_state_, | 70 make_scoped_ptr(new ChromeVariationsServiceClient()), local_state_, |
| 71 GetMetricsStateManager(), switches::kDisableBackgroundNetworking, | 71 GetMetricsStateManager(), switches::kDisableBackgroundNetworking, |
| 72 variations::UIStringOverrider(chrome_variations::kResourceHashes, | 72 chrome_variations::CreateUIStringOverrider()); |
| 73 chrome_variations::kResourceIndices, | |
| 74 chrome_variations::kNumResources)); | |
| 75 } | 73 } |
| 76 return variations_service_.get(); | 74 return variations_service_.get(); |
| 77 } | 75 } |
| 78 | 76 |
| 79 void MetricsServicesManager::OnPluginLoadingError( | 77 void MetricsServicesManager::OnPluginLoadingError( |
| 80 const base::FilePath& plugin_path) { | 78 const base::FilePath& plugin_path) { |
| 81 GetChromeMetricsServiceClient()->LogPluginLoadingError(plugin_path); | 79 GetChromeMetricsServiceClient()->LogPluginLoadingError(plugin_path); |
| 82 } | 80 } |
| 83 | 81 |
| 84 ChromeMetricsServiceClient* | 82 ChromeMetricsServiceClient* |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 recording_groups |= rappor::SAFEBROWSING_RAPPOR_GROUP; | 168 recording_groups |= rappor::SAFEBROWSING_RAPPOR_GROUP; |
| 171 #endif // defined(GOOGLE_CHROME_BUILD) | 169 #endif // defined(GOOGLE_CHROME_BUILD) |
| 172 GetRapporService()->Update(recording_groups, may_upload_); | 170 GetRapporService()->Update(recording_groups, may_upload_); |
| 173 } | 171 } |
| 174 | 172 |
| 175 void MetricsServicesManager::UpdateUploadPermissions(bool may_upload) { | 173 void MetricsServicesManager::UpdateUploadPermissions(bool may_upload) { |
| 176 return UpdatePermissions( | 174 return UpdatePermissions( |
| 177 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled(), | 175 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled(), |
| 178 may_upload); | 176 may_upload); |
| 179 } | 177 } |
| OLD | NEW |