Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Side by Side Diff: chrome/browser/metrics/chrome_metrics_service_client.cc

Issue 2858683006: UKM debug page (Closed)
Patch Set: Seperate BUILD file Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | components/ukm/debug_page/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #include "components/metrics/net/version_utils.h" 75 #include "components/metrics/net/version_utils.h"
76 #include "components/metrics/profiler/profiler_metrics_provider.h" 76 #include "components/metrics/profiler/profiler_metrics_provider.h"
77 #include "components/metrics/profiler/tracking_synchronizer.h" 77 #include "components/metrics/profiler/tracking_synchronizer.h"
78 #include "components/metrics/stability_metrics_helper.h" 78 #include "components/metrics/stability_metrics_helper.h"
79 #include "components/metrics/ui/screen_info_metrics_provider.h" 79 #include "components/metrics/ui/screen_info_metrics_provider.h"
80 #include "components/metrics/url_constants.h" 80 #include "components/metrics/url_constants.h"
81 #include "components/omnibox/browser/omnibox_metrics_provider.h" 81 #include "components/omnibox/browser/omnibox_metrics_provider.h"
82 #include "components/prefs/pref_registry_simple.h" 82 #include "components/prefs/pref_registry_simple.h"
83 #include "components/prefs/pref_service.h" 83 #include "components/prefs/pref_service.h"
84 #include "components/sync/device_info/device_count_metrics_provider.h" 84 #include "components/sync/device_info/device_count_metrics_provider.h"
85 #include "components/ukm/debug_page/debug_page.h"
85 #include "components/ukm/ukm_service.h" 86 #include "components/ukm/ukm_service.h"
86 #include "components/version_info/version_info.h" 87 #include "components/version_info/version_info.h"
87 #include "content/public/browser/browser_thread.h" 88 #include "content/public/browser/browser_thread.h"
88 #include "content/public/browser/histogram_fetcher.h" 89 #include "content/public/browser/histogram_fetcher.h"
89 #include "content/public/browser/notification_service.h" 90 #include "content/public/browser/notification_service.h"
90 #include "extensions/features/features.h" 91 #include "extensions/features/features.h"
91 #include "ppapi/features/features.h" 92 #include "ppapi/features/features.h"
92 #include "printing/features/features.h" 93 #include "printing/features/features.h"
93 94
94 #if defined(OS_ANDROID) 95 #if defined(OS_ANDROID)
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 wchar_t exe_file[MAX_PATH] = {}; 273 wchar_t exe_file[MAX_PATH] = {};
273 CHECK(::GetModuleFileName(nullptr, exe_file, arraysize(exe_file))); 274 CHECK(::GetModuleFileName(nullptr, exe_file, arraysize(exe_file)));
274 275
275 base::string16 unused_special_build; 276 base::string16 unused_special_build;
276 install_static::GetExecutableVersionDetails( 277 install_static::GetExecutableVersionDetails(
277 exe_file, product_name, version_number, &unused_special_build, 278 exe_file, product_name, version_number, &unused_special_build,
278 channel_name); 279 channel_name);
279 } 280 }
280 #endif // OS_WIN 281 #endif // OS_WIN
281 282
283 ukm::UkmService* BindableGetUkmService() {
284 return g_browser_process->ukm_service();
285 }
286
282 } // namespace 287 } // namespace
283 288
284 const char ChromeMetricsServiceClient::kBrowserMetricsName[] = "BrowserMetrics"; 289 const char ChromeMetricsServiceClient::kBrowserMetricsName[] = "BrowserMetrics";
285 290
286 ChromeMetricsServiceClient::ChromeMetricsServiceClient( 291 ChromeMetricsServiceClient::ChromeMetricsServiceClient(
287 metrics::MetricsStateManager* state_manager) 292 metrics::MetricsStateManager* state_manager)
288 : metrics_state_manager_(state_manager), 293 : metrics_state_manager_(state_manager),
289 #if defined(OS_CHROMEOS) 294 #if defined(OS_CHROMEOS)
290 chromeos_metrics_provider_(nullptr), 295 chromeos_metrics_provider_(nullptr),
291 #endif 296 #endif
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 // Observe history deletions for all profiles. 924 // Observe history deletions for all profiles.
920 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED, 925 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_ADDED,
921 content::NotificationService::AllBrowserContextsAndSources()); 926 content::NotificationService::AllBrowserContextsAndSources());
922 for (Profile* profile : 927 for (Profile* profile :
923 g_browser_process->profile_manager()->GetLoadedProfiles()) { 928 g_browser_process->profile_manager()->GetLoadedProfiles()) {
924 RegisterForProfileEvents(profile); 929 RegisterForProfileEvents(profile);
925 } 930 }
926 } 931 }
927 932
928 void ChromeMetricsServiceClient::RegisterForProfileEvents(Profile* profile) { 933 void ChromeMetricsServiceClient::RegisterForProfileEvents(Profile* profile) {
934 // Register chrome://ukm handler
935 content::URLDataSource::Add(
936 profile, new ukm::debug::DebugPage(base::Bind(&BindableGetUkmService)));
929 #if defined(OS_CHROMEOS) 937 #if defined(OS_CHROMEOS)
930 // Ignore the signin profile for sync disables / history deletion. 938 // Ignore the signin profile for sync disables / history deletion.
931 if (chromeos::ProfileHelper::IsSigninProfile(profile)) 939 if (chromeos::ProfileHelper::IsSigninProfile(profile))
932 return; 940 return;
933 #endif 941 #endif
934 history::HistoryService* history_service = 942 history::HistoryService* history_service =
935 HistoryServiceFactory::GetForProfile(profile, 943 HistoryServiceFactory::GetForProfile(profile,
936 ServiceAccessType::IMPLICIT_ACCESS); 944 ServiceAccessType::IMPLICIT_ACCESS);
937 ObserveServiceForDeletions(history_service); 945 ObserveServiceForDeletions(history_service);
938 browser_sync::ProfileSyncService* sync = 946 browser_sync::ProfileSyncService* sync =
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 ukm_service_->Purge(); 996 ukm_service_->Purge();
989 ukm_service_->ResetClientId(); 997 ukm_service_->ResetClientId();
990 } 998 }
991 // Signal service manager to enable/disable UKM based on new state. 999 // Signal service manager to enable/disable UKM based on new state.
992 UpdateRunningServices(); 1000 UpdateRunningServices();
993 } 1001 }
994 1002
995 bool ChromeMetricsServiceClient::IsHistorySyncEnabledOnAllProfiles() { 1003 bool ChromeMetricsServiceClient::IsHistorySyncEnabledOnAllProfiles() {
996 return SyncDisableObserver::IsHistorySyncEnabledOnAllProfiles(); 1004 return SyncDisableObserver::IsHistorySyncEnabledOnAllProfiles();
997 } 1005 }
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | components/ukm/debug_page/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698