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 d2aa299b7f225966f0a7c11a57fc9ecc301dcce2..f09fa2af2084110233dbc78a306d4f495bba72b4 100644 |
--- a/chrome/browser/metrics/chrome_metrics_service_client.cc |
+++ b/chrome/browser/metrics/chrome_metrics_service_client.cc |
@@ -40,6 +40,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" |
@@ -49,6 +50,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" |
@@ -883,15 +885,18 @@ 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 = |
Alexei Svitkine (slow)
2017/02/01 19:31:07
Is it possible this is null?
If not, add a DCHECK
Steven Holte
2017/02/03 00:04:34
Added a null check.
|
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); |
+ ObserveServiceForSyncDisables(static_cast<syncer::SyncService*>(sync)); |
} |
void ChromeMetricsServiceClient::Observe( |
@@ -913,7 +918,7 @@ void ChromeMetricsServiceClient::Observe( |
break; |
case chrome::NOTIFICATION_PROFILE_ADDED: |
- RegisterForHistoryDeletions(content::Source<Profile>(source).ptr()); |
+ RegisterForProfileEvents(content::Source<Profile>(source).ptr()); |
break; |
default: |
@@ -933,3 +938,12 @@ void ChromeMetricsServiceClient::OnHistoryDeleted() { |
if (ukm_service_) |
ukm_service_->Purge(); |
} |
+ |
+void ChromeMetricsServiceClient::OnSyncPrefsChanged(bool must_purge) { |
+ if (ukm_service_) { |
+ if (must_purge) |
+ ukm_service_->Purge(); |
+ if (update_running_services_) |
rkaplow
2017/02/01 16:40:55
can you comment on why this is needed
Steven Holte
2017/02/03 00:04:34
Done.
|
+ update_running_services_.Run(); |
+ } |
+} |