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

Unified Diff: chrome/browser/google_apis/drive_notification_manager.h

Issue 13891016: Merge ChromeOS and SyncFS XMPP Notification into one class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 8 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
Index: chrome/browser/google_apis/drive_notification_manager.h
diff --git a/chrome/browser/google_apis/drive_notification_manager.h b/chrome/browser/google_apis/drive_notification_manager.h
index 16905db5b7c885977779a80d3e3d922ef1459972..1f2ee58f324656584910d6515a0bebe9b8500e0f 100644
--- a/chrome/browser/google_apis/drive_notification_manager.h
+++ b/chrome/browser/google_apis/drive_notification_manager.h
@@ -5,24 +5,26 @@
#ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_NOTIFICATION_MANAGER_H_
#define CHROME_BROWSER_GOOGLE_APIS_DRIVE_NOTIFICATION_MANAGER_H_
+#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
+#include "base/timer.h"
#include "chrome/browser/google_apis/drive_notification_observer.h"
#include "chrome/browser/profiles/profile_keyed_service.h"
#include "sync/notifier/invalidation_handler.h"
class Profile;
+class ProfileSyncService;
namespace google_apis {
// Informs observers when they should check Google Drive for updates.
// Conditions under which updates should be searched:
// 1. XMPP invalidation is received from Google Drive.
-// TODO(calvinlo): Implement public syncer::InvalidationHandler interface.
// 2. Polling timer counts down.
-// TODO(calvinlo): Also add in backup timer.
class DriveNotificationManager
: public ProfileKeyedService,
- public syncer::InvalidationHandler {
+ public syncer::InvalidationHandler,
+ public base::SupportsWeakPtr<DriveNotificationManager> {
satorux1 2013/04/19 04:12:13 Please use WeakPtrFactory instead in favor of less
calvinlo 2013/04/19 06:15:09 Removed. Thanks for the tip. Actually, after my
public:
explicit DriveNotificationManager(Profile* profile);
virtual ~DriveNotificationManager();
@@ -38,16 +40,19 @@ class DriveNotificationManager
void AddObserver(DriveNotificationObserver* observer);
void RemoveObserver(DriveNotificationObserver* observer);
+ bool IsPushNotificationEnabled();
satorux1 2013/04/19 04:12:13 Function comment is missing.
calvinlo 2013/04/19 06:15:09 Done.
private:
void NotifyObserversToUpdate();
// XMPP notification related methods.
void RegisterDriveNotifications();
- bool IsDriveNotificationSupported();
- void SetPushNotificationEnabled(syncer::InvalidatorState state);
+
+ // Polling related methods.
+ void SchedulePolling(int64 new_delay_sec);
Profile* profile_;
+ ProfileSyncService* profile_sync_service_;
ObserverList<DriveNotificationObserver> observers_;
// XMPP notification related variables.
@@ -56,7 +61,8 @@ class DriveNotificationManager
// True once the first drive notification is received with OK state.
bool push_notification_enabled_;
- // TODO(calvinlo): Polling variables to go here.
+ // Timer to trigger fetching changes for incremental sync.
+ base::RepeatingTimer<DriveNotificationManager> polling_timer_;
satorux1 2013/04/19 04:12:13 I thought you wanted to remove the polling code??
calvinlo 2013/04/19 06:15:09 Removed. Sorry, I originally based this patch on h
DISALLOW_COPY_AND_ASSIGN(DriveNotificationManager);
};

Powered by Google App Engine
This is Rietveld 408576698