| Index: chrome/browser/metrics/metrics_service.cc
|
| diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
|
| index 8d40156120dbe823759a3e26846e5a8c8d6d6c51..1d8757fbaa7cf2ba80bd48d2b81c5c9724c457d2 100644
|
| --- a/chrome/browser/metrics/metrics_service.cc
|
| +++ b/chrome/browser/metrics/metrics_service.cc
|
| @@ -601,24 +601,12 @@ bool MetricsService::reporting_active() const {
|
| void MetricsService::SetUpNotifications(
|
| content::NotificationRegistrar* registrar,
|
| content::NotificationObserver* observer) {
|
| - registrar->Add(observer, chrome::NOTIFICATION_BROWSER_OPENED,
|
| - content::NotificationService::AllBrowserContextsAndSources());
|
| - registrar->Add(observer, chrome::NOTIFICATION_BROWSER_CLOSED,
|
| - content::NotificationService::AllSources());
|
| - registrar->Add(observer, chrome::NOTIFICATION_TAB_PARENTED,
|
| - content::NotificationService::AllSources());
|
| - registrar->Add(observer, chrome::NOTIFICATION_TAB_CLOSING,
|
| - content::NotificationService::AllSources());
|
| registrar->Add(observer, content::NOTIFICATION_LOAD_START,
|
| content::NotificationService::AllSources());
|
| - registrar->Add(observer, content::NOTIFICATION_LOAD_STOP,
|
| - content::NotificationService::AllSources());
|
| registrar->Add(observer, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
|
| content::NotificationService::AllSources());
|
| registrar->Add(observer, content::NOTIFICATION_RENDER_WIDGET_HOST_HANG,
|
| content::NotificationService::AllSources());
|
| - registrar->Add(observer, chrome::NOTIFICATION_OMNIBOX_OPENED_URL,
|
| - content::NotificationService::AllSources());
|
| }
|
|
|
| void MetricsService::BrowserChildProcessHostConnected(
|
| @@ -647,15 +635,6 @@ void MetricsService::Observe(int type,
|
| DCHECK(IsSingleThreaded());
|
|
|
| switch (type) {
|
| - case chrome::NOTIFICATION_BROWSER_OPENED:
|
| - case chrome::NOTIFICATION_BROWSER_CLOSED:
|
| - case chrome::NOTIFICATION_OMNIBOX_OPENED_URL:
|
| - case chrome::NOTIFICATION_TAB_PARENTED:
|
| - case chrome::NOTIFICATION_TAB_CLOSING:
|
| - case content::NOTIFICATION_LOAD_STOP:
|
| - // These notifications are used only to break out of idle mode.
|
| - break;
|
| -
|
| case content::NOTIFICATION_LOAD_START: {
|
| content::NavigationController* controller =
|
| content::Source<content::NavigationController>(source).ptr();
|
| @@ -682,10 +661,7 @@ void MetricsService::Observe(int type,
|
|
|
| default:
|
| NOTREACHED();
|
| - break;
|
| }
|
| -
|
| - HandleIdleSinceLastTransmission(false);
|
| }
|
|
|
| void MetricsService::HandleIdleSinceLastTransmission(bool in_idle) {
|
| @@ -697,6 +673,11 @@ void MetricsService::HandleIdleSinceLastTransmission(bool in_idle) {
|
| idle_since_last_transmission_ = in_idle;
|
| }
|
|
|
| +void MetricsService::OnApplicationNotIdle() {
|
| + if (recording_active_)
|
| + HandleIdleSinceLastTransmission(false);
|
| +}
|
| +
|
| void MetricsService::RecordStartOfSessionEnd() {
|
| LogCleanShutdown();
|
| RecordBooleanPrefValue(prefs::kStabilitySessionEndCompleted, false);
|
| @@ -1216,7 +1197,7 @@ void MetricsService::StartScheduledUpload() {
|
| // If recording has been turned off, the scheduler doesn't need to run.
|
| // If reporting is off, proceed if the initial log hasn't been created, since
|
| // that has to happen in order for logs to be cut and stored when persisting.
|
| - // TODO(stuartmorgan): Call Stop() on the schedule when reporting and/or
|
| + // TODO(stuartmorgan): Call Stop() on the scheduler when reporting and/or
|
| // recording are turned off instead of letting it fire and then aborting.
|
| if (idle_since_last_transmission_ ||
|
| !recording_active() ||
|
|
|