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

Unified Diff: chrome/browser/metrics/metrics_service.cc

Issue 287193005: [Metrics] Move non-idle notifications from MetricsService to ChromeMetricsServiceClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: break! Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/metrics/metrics_service.h ('k') | chrome/browser/metrics/metrics_services_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() ||
« no previous file with comments | « chrome/browser/metrics/metrics_service.h ('k') | chrome/browser/metrics/metrics_services_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698