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

Side by Side 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: ChromeOS SigFault fix 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_NOTIFICATION_MANAGER_H_ 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_NOTIFICATION_MANAGER_H_
6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_NOTIFICATION_MANAGER_H_ 6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_NOTIFICATION_MANAGER_H_
7 7
8 #include "base/observer_list.h" 8 #include "base/observer_list.h"
9 #include "chrome/browser/google_apis/drive_notification_observer.h" 9 #include "chrome/browser/google_apis/drive_notification_observer.h"
10 #include "chrome/browser/profiles/profile_keyed_service.h" 10 #include "chrome/browser/profiles/profile_keyed_service.h"
11 #include "sync/notifier/invalidation_handler.h" 11 #include "sync/notifier/invalidation_handler.h"
12 12
13 class Profile; 13 class Profile;
14 class ProfileSyncService;
14 15
15 namespace google_apis { 16 namespace google_apis {
16 17
17 // Informs observers when they should check Google Drive for updates. 18 // Informs observers when they should check Google Drive for updates.
18 // Conditions under which updates should be searched: 19 // Conditions under which updates should be searched:
19 // 1. XMPP invalidation is received from Google Drive. 20 // 1. XMPP invalidation is received from Google Drive.
20 // TODO(calvinlo): Implement public syncer::InvalidationHandler interface.
21 // 2. Polling timer counts down. 21 // 2. Polling timer counts down.
22 // TODO(calvinlo): Also add in backup timer.
23 class DriveNotificationManager 22 class DriveNotificationManager
24 : public ProfileKeyedService, 23 : public ProfileKeyedService,
25 public syncer::InvalidationHandler { 24 public syncer::InvalidationHandler {
26 public: 25 public:
27 explicit DriveNotificationManager(Profile* profile); 26 explicit DriveNotificationManager(Profile* profile);
28 virtual ~DriveNotificationManager(); 27 virtual ~DriveNotificationManager();
29 28
30 // ProfileKeyedService override. 29 // ProfileKeyedService override.
31 virtual void Shutdown() OVERRIDE; 30 virtual void Shutdown() OVERRIDE;
32 31
33 // syncer::InvalidationHandler implementation. 32 // syncer::InvalidationHandler implementation.
34 virtual void OnInvalidatorStateChange( 33 virtual void OnInvalidatorStateChange(
35 syncer::InvalidatorState state) OVERRIDE; 34 syncer::InvalidatorState state) OVERRIDE;
36 virtual void OnIncomingInvalidation( 35 virtual void OnIncomingInvalidation(
37 const syncer::ObjectIdInvalidationMap& invalidation_map) OVERRIDE; 36 const syncer::ObjectIdInvalidationMap& invalidation_map) OVERRIDE;
38 37
39 void AddObserver(DriveNotificationObserver* observer); 38 void AddObserver(DriveNotificationObserver* observer);
40 void RemoveObserver(DriveNotificationObserver* observer); 39 void RemoveObserver(DriveNotificationObserver* observer);
41 40
41 // True when XMPP notifications registered and enabled. False otherwise.
42 bool IsPushNotificationEnabled();
43
42 private: 44 private:
43 void NotifyObserversToUpdate(); 45 void NotifyObserversToUpdate();
44
45 // XMPP notification related methods.
46 void RegisterDriveNotifications(); 46 void RegisterDriveNotifications();
47 bool IsDriveNotificationSupported();
48 void SetPushNotificationEnabled(syncer::InvalidatorState state);
49 47
50 Profile* profile_; 48 Profile* profile_;
51 ObserverList<DriveNotificationObserver> observers_; 49 ObserverList<DriveNotificationObserver> observers_;
52 50
53 // XMPP notification related variables.
54 // True when Drive File Sync Service is registered for Drive notifications. 51 // True when Drive File Sync Service is registered for Drive notifications.
55 bool push_notification_registered_; 52 bool push_notification_registered_;
56 // True once the first drive notification is received with OK state. 53 // True once the first drive notification is received with OK state.
57 bool push_notification_enabled_; 54 bool push_notification_enabled_;
58 55
59 // TODO(calvinlo): Polling variables to go here.
60
61 DISALLOW_COPY_AND_ASSIGN(DriveNotificationManager); 56 DISALLOW_COPY_AND_ASSIGN(DriveNotificationManager);
62 }; 57 };
63 58
64 } // namespace google_apis 59 } // namespace google_apis
65 60
66 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_NOTIFICATION_MANAGER_H_ 61 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_NOTIFICATION_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_system_service.cc ('k') | chrome/browser/google_apis/drive_notification_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698