| Index: ios/chrome/browser/application_context_impl.cc
|
| diff --git a/ios/chrome/browser/application_context_impl.cc b/ios/chrome/browser/application_context_impl.cc
|
| index 8b4ac1bc66c064087da6308432d386ddac1ef9f4..b0982c8f1718e1158152b8991fc7ccb1ccc9f52e 100644
|
| --- a/ios/chrome/browser/application_context_impl.cc
|
| +++ b/ios/chrome/browser/application_context_impl.cc
|
| @@ -31,6 +31,7 @@
|
| #include "components/prefs/pref_registry_simple.h"
|
| #include "components/prefs/pref_service.h"
|
| #include "components/translate/core/browser/translate_download_manager.h"
|
| +#include "components/ukm/ukm_service.h"
|
| #include "components/update_client/configurator.h"
|
| #include "components/update_client/update_query_params.h"
|
| #include "components/variations/service/variations_service.h"
|
| @@ -131,16 +132,18 @@ void ApplicationContextImpl::OnAppEnterForeground() {
|
| PrefService* local_state = GetLocalState();
|
| local_state->SetBoolean(prefs::kLastSessionExitedCleanly, false);
|
|
|
| - // Tell the metrics service that the application resumes.
|
| + // Tell the metrics services that the application resumes.
|
| metrics::MetricsService* metrics_service = GetMetricsService();
|
| if (metrics_service && local_state) {
|
| metrics_service->OnAppEnterForeground();
|
| local_state->CommitPendingWrite();
|
| }
|
| -
|
| variations::VariationsService* variations_service = GetVariationsService();
|
| if (variations_service)
|
| variations_service->OnAppEnterForeground();
|
| + ukm::UkmService* ukm_service = g_browser_process->ukm_service();
|
| + if (ukm_service)
|
| + ukm_service->OnAppEnterForeground();
|
| }
|
|
|
| void ApplicationContextImpl::OnAppEnterBackground() {
|
| @@ -163,10 +166,13 @@ void ApplicationContextImpl::OnAppEnterBackground() {
|
| PrefService* local_state = GetLocalState();
|
| local_state->SetBoolean(prefs::kLastSessionExitedCleanly, true);
|
|
|
| - // Tell the metrics service it was cleanly shutdown.
|
| + // Tell the metrics services they were cleanly shutdown.
|
| metrics::MetricsService* metrics_service = GetMetricsService();
|
| if (metrics_service && local_state)
|
| metrics_service->OnAppEnterBackground();
|
| + ukm::UkmService* ukm_service = g_browser_process->ukm_service();
|
| + if (ukm_service)
|
| + ukm_service->OnAppEnterBackground();
|
|
|
| // Persisting to disk is protected by a critical task, so no other special
|
| // handling is necessary on iOS.
|
|
|