diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-07 06:45:40 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-07 06:45:40 +0000 |
commit | 3522561ca1f518b906dda7e93ab5658b6d162d14 (patch) | |
tree | 9369c6b57be6d490c6e2cfc28d52412180b46494 | |
parent | 1586599b3d1c0c331024a4b309a73ec95c592545 (diff) | |
download | chromium_src-3522561ca1f518b906dda7e93ab5658b6d162d14.zip chromium_src-3522561ca1f518b906dda7e93ab5658b6d162d14.tar.gz chromium_src-3522561ca1f518b906dda7e93ab5658b6d162d14.tar.bz2 |
drive: Add UMA for understanding push notification availability
Drive.PushNotificationRegistered tells whether the registration
was successful or not.
Drive.PushNotificationInitiallyEnabled tells whether or not the
push notification was initially enabled.
BUG=238550
TEST=Open Drive in Files.app. wait for a minute. Open chrome:histograms. Confirm that the two histograms appear there.
R=calvinlo@chromium.org, tzik@chromium.org
Review URL: https://codereview.chromium.org/14556025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198657 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/google_apis/drive_notification_manager.cc | 9 | ||||
-rw-r--r-- | chrome/browser/google_apis/drive_notification_manager.h | 4 |
2 files changed, 12 insertions, 1 deletions
diff --git a/chrome/browser/google_apis/drive_notification_manager.cc b/chrome/browser/google_apis/drive_notification_manager.cc index 56ee6c4..58e9395 100644 --- a/chrome/browser/google_apis/drive_notification_manager.cc +++ b/chrome/browser/google_apis/drive_notification_manager.cc @@ -31,6 +31,7 @@ DriveNotificationManager::DriveNotificationManager(Profile* profile) : profile_(profile), push_notification_registered_(false), push_notification_enabled_(false), + observers_notified_(false), polling_timer_(true /* retain_user_task */, false /* is_repeating */), weak_ptr_factory_(this) { RegisterDriveNotifications(); @@ -114,6 +115,11 @@ void DriveNotificationManager::NotifyObserversToUpdate( DVLOG(1) << "Notifying observers: " << NotificationSourceToString(source); FOR_EACH_OBSERVER(DriveNotificationObserver, observers_, OnNotificationReceived()); + if (!observers_notified_) { + UMA_HISTOGRAM_BOOLEAN("Drive.PushNotificationInitiallyEnabled", + push_notification_enabled_); + } + observers_notified_ = true; // Note that polling_timer_ is not a repeating timer. Restarting manually // here is better as XMPP may be received right before the polling timer is @@ -137,6 +143,9 @@ void DriveNotificationManager::RegisterDriveNotifications() { profile_sync_service->UpdateRegisteredInvalidationIds(this, ids); push_notification_registered_ = true; OnInvalidatorStateChange(profile_sync_service->GetInvalidatorState()); + + UMA_HISTOGRAM_BOOLEAN("Drive.PushNotificationRegistered", + push_notification_registered_); } // static diff --git a/chrome/browser/google_apis/drive_notification_manager.h b/chrome/browser/google_apis/drive_notification_manager.h index 02ccd90..ca8cac6 100644 --- a/chrome/browser/google_apis/drive_notification_manager.h +++ b/chrome/browser/google_apis/drive_notification_manager.h @@ -67,8 +67,10 @@ class DriveNotificationManager // True when Drive File Sync Service is registered for Drive notifications. bool push_notification_registered_; - // True once the first drive notification is received with OK state. + // True if the XMPP-based push notification is currently enabled. bool push_notification_enabled_; + // True once observers are notified for the first time. + bool observers_notified_; // The timer is used for polling based notification. XMPP should usually be // used but notification is done per polling when XMPP is not working. |