Index: chrome/browser/metrics/chrome_metrics_service_client.cc |
diff --git a/chrome/browser/metrics/chrome_metrics_service_client.cc b/chrome/browser/metrics/chrome_metrics_service_client.cc |
index 7d0e51a86d3d827a99ae55809847694fb3b9a475..1e11c9ece0f2bf8ba72b9c580a6bc88410020e27 100644 |
--- a/chrome/browser/metrics/chrome_metrics_service_client.cc |
+++ b/chrome/browser/metrics/chrome_metrics_service_client.cc |
@@ -41,6 +41,7 @@ |
#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/browser/safe_browsing/certificate_reporting_metrics_provider.h" |
#include "chrome/browser/sync/chrome_sync_client.h" |
+#include "chrome/browser/sync/profile_sync_service_factory.h" |
#include "chrome/browser/ui/browser_otr_state.h" |
#include "chrome/common/channel_info.h" |
#include "chrome/common/chrome_paths.h" |
@@ -50,6 +51,7 @@ |
#include "chrome/common/features.h" |
#include "chrome/common/pref_names.h" |
#include "chrome/installer/util/util_constants.h" |
+#include "components/browser_sync/profile_sync_service.h" |
#include "components/browser_watcher/stability_debugging.h" |
#include "components/history/core/browser/history_service.h" |
#include "components/metrics/call_stack_profile_metrics_provider.h" |
@@ -877,15 +879,19 @@ void ChromeMetricsServiceClient::RegisterForNotifications() { |
content::NotificationService::AllBrowserContextsAndSources()); |
for (Profile* profile : |
g_browser_process->profile_manager()->GetLoadedProfiles()) { |
- RegisterForHistoryDeletions(profile); |
+ RegisterForProfileEvents(profile); |
} |
} |
-void ChromeMetricsServiceClient::RegisterForHistoryDeletions(Profile* profile) { |
+void ChromeMetricsServiceClient::RegisterForProfileEvents(Profile* profile) { |
history::HistoryService* history_service = |
HistoryServiceFactory::GetForProfile(profile, |
ServiceAccessType::IMPLICIT_ACCESS); |
ObserveServiceForDeletions(history_service); |
+ browser_sync::ProfileSyncService* sync = |
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); |
+ if (sync) |
+ ObserveServiceForSyncDisables(static_cast<syncer::SyncService*>(sync)); |
} |
void ChromeMetricsServiceClient::Observe( |
@@ -907,7 +913,7 @@ void ChromeMetricsServiceClient::Observe( |
break; |
case chrome::NOTIFICATION_PROFILE_ADDED: |
skym
2017/02/03 01:03:59
I'm worried unimportant profiles are going to keep
Steven Holte
2017/02/04 00:16:32
I'm not too worried about this since the multi-pro
skym
2017/02/07 16:45:44
Okay. Thanks for adding the histogram to track thi
|
- RegisterForHistoryDeletions(content::Source<Profile>(source).ptr()); |
+ RegisterForProfileEvents(content::Source<Profile>(source).ptr()); |
break; |
default: |
@@ -927,3 +933,13 @@ void ChromeMetricsServiceClient::OnHistoryDeleted() { |
if (ukm_service_) |
ukm_service_->Purge(); |
} |
+ |
+void ChromeMetricsServiceClient::OnSyncPrefsChanged(bool must_purge) { |
+ if (ukm_service_) { |
+ if (must_purge) |
+ ukm_service_->Purge(); |
+ // Signal service manager to enable/disable UKM based on new state. |
+ if (update_running_services_) |
+ update_running_services_.Run(); |
+ } |
+} |