| 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/chrome_metrics_service_client.h" | 5 #include "chrome/browser/metrics/chrome_metrics_service_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 wchar_t exe_file[MAX_PATH] = {}; | 274 wchar_t exe_file[MAX_PATH] = {}; |
| 275 CHECK(::GetModuleFileName(nullptr, exe_file, arraysize(exe_file))); | 275 CHECK(::GetModuleFileName(nullptr, exe_file, arraysize(exe_file))); |
| 276 | 276 |
| 277 base::string16 unused_special_build; | 277 base::string16 unused_special_build; |
| 278 install_static::GetExecutableVersionDetails( | 278 install_static::GetExecutableVersionDetails( |
| 279 exe_file, product_name, version_number, &unused_special_build, | 279 exe_file, product_name, version_number, &unused_special_build, |
| 280 channel_name); | 280 channel_name); |
| 281 } | 281 } |
| 282 #endif // OS_WIN | 282 #endif // OS_WIN |
| 283 | 283 |
| 284 ukm::UkmService* BindableGetUkmService() { | 284 ukm::UkmService* BindableGetUkmService( |
| 285 return g_browser_process->ukm_service(); | 285 base::WeakPtr<ChromeMetricsServiceClient> weak_ptr) { |
| 286 if (!weak_ptr) |
| 287 return nullptr; |
| 288 return weak_ptr->GetUkmService(); |
| 286 } | 289 } |
| 287 | 290 |
| 288 } // namespace | 291 } // namespace |
| 289 | 292 |
| 290 const char ChromeMetricsServiceClient::kBrowserMetricsName[] = "BrowserMetrics"; | 293 const char ChromeMetricsServiceClient::kBrowserMetricsName[] = "BrowserMetrics"; |
| 291 | 294 |
| 292 ChromeMetricsServiceClient::ChromeMetricsServiceClient( | 295 ChromeMetricsServiceClient::ChromeMetricsServiceClient( |
| 293 metrics::MetricsStateManager* state_manager) | 296 metrics::MetricsStateManager* state_manager) |
| 294 : metrics_state_manager_(state_manager), | 297 : metrics_state_manager_(state_manager), |
| 295 #if defined(OS_CHROMEOS) | 298 #if defined(OS_CHROMEOS) |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 content::NotificationService::AllBrowserContextsAndSources()); | 931 content::NotificationService::AllBrowserContextsAndSources()); |
| 929 for (Profile* profile : | 932 for (Profile* profile : |
| 930 g_browser_process->profile_manager()->GetLoadedProfiles()) { | 933 g_browser_process->profile_manager()->GetLoadedProfiles()) { |
| 931 RegisterForProfileEvents(profile); | 934 RegisterForProfileEvents(profile); |
| 932 } | 935 } |
| 933 } | 936 } |
| 934 | 937 |
| 935 void ChromeMetricsServiceClient::RegisterForProfileEvents(Profile* profile) { | 938 void ChromeMetricsServiceClient::RegisterForProfileEvents(Profile* profile) { |
| 936 // Register chrome://ukm handler | 939 // Register chrome://ukm handler |
| 937 content::URLDataSource::Add( | 940 content::URLDataSource::Add( |
| 938 profile, new ukm::debug::DebugPage(base::Bind(&BindableGetUkmService))); | 941 profile, new ukm::debug::DebugPage(base::Bind( |
| 942 &BindableGetUkmService, weak_ptr_factory_.GetWeakPtr()))); |
| 939 #if defined(OS_CHROMEOS) | 943 #if defined(OS_CHROMEOS) |
| 940 // Ignore the signin profile for sync disables / history deletion. | 944 // Ignore the signin profile for sync disables / history deletion. |
| 941 if (chromeos::ProfileHelper::IsSigninProfile(profile)) | 945 if (chromeos::ProfileHelper::IsSigninProfile(profile)) |
| 942 return; | 946 return; |
| 943 #endif | 947 #endif |
| 944 history::HistoryService* history_service = | 948 history::HistoryService* history_service = |
| 945 HistoryServiceFactory::GetForProfile(profile, | 949 HistoryServiceFactory::GetForProfile(profile, |
| 946 ServiceAccessType::IMPLICIT_ACCESS); | 950 ServiceAccessType::IMPLICIT_ACCESS); |
| 947 ObserveServiceForDeletions(history_service); | 951 ObserveServiceForDeletions(history_service); |
| 948 browser_sync::ProfileSyncService* sync = | 952 browser_sync::ProfileSyncService* sync = |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 ukm_service_->Purge(); | 1002 ukm_service_->Purge(); |
| 999 ukm_service_->ResetClientId(); | 1003 ukm_service_->ResetClientId(); |
| 1000 } | 1004 } |
| 1001 // Signal service manager to enable/disable UKM based on new state. | 1005 // Signal service manager to enable/disable UKM based on new state. |
| 1002 UpdateRunningServices(); | 1006 UpdateRunningServices(); |
| 1003 } | 1007 } |
| 1004 | 1008 |
| 1005 bool ChromeMetricsServiceClient::IsHistorySyncEnabledOnAllProfiles() { | 1009 bool ChromeMetricsServiceClient::IsHistorySyncEnabledOnAllProfiles() { |
| 1006 return SyncDisableObserver::IsHistorySyncEnabledOnAllProfiles(); | 1010 return SyncDisableObserver::IsHistorySyncEnabledOnAllProfiles(); |
| 1007 } | 1011 } |
| OLD | NEW |