| OLD | NEW |
| 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_DRIVE_DRIVE_NOTIFICATION_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_DRIVE_DRIVE_NOTIFICATION_MANAGER_H_ |
| 6 #define CHROME_BROWSER_DRIVE_DRIVE_NOTIFICATION_MANAGER_H_ | 6 #define CHROME_BROWSER_DRIVE_DRIVE_NOTIFICATION_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 // Informs observers when they should check Google Drive for updates. | 23 // Informs observers when they should check Google Drive for updates. |
| 24 // Conditions under which updates should be searched: | 24 // Conditions under which updates should be searched: |
| 25 // 1. XMPP invalidation is received from Google Drive. | 25 // 1. XMPP invalidation is received from Google Drive. |
| 26 // 2. Polling timer counts down. | 26 // 2. Polling timer counts down. |
| 27 class DriveNotificationManager : public KeyedService, | 27 class DriveNotificationManager : public KeyedService, |
| 28 public syncer::InvalidationHandler { | 28 public syncer::InvalidationHandler { |
| 29 public: | 29 public: |
| 30 explicit DriveNotificationManager( | 30 explicit DriveNotificationManager( |
| 31 invalidation::InvalidationService* invalidation_service); | 31 invalidation::InvalidationService* invalidation_service); |
| 32 virtual ~DriveNotificationManager(); | 32 ~DriveNotificationManager() override; |
| 33 | 33 |
| 34 // KeyedService override. | 34 // KeyedService override. |
| 35 virtual void Shutdown() override; | 35 void Shutdown() override; |
| 36 | 36 |
| 37 // syncer::InvalidationHandler implementation. | 37 // syncer::InvalidationHandler implementation. |
| 38 virtual void OnInvalidatorStateChange( | 38 void OnInvalidatorStateChange(syncer::InvalidatorState state) override; |
| 39 syncer::InvalidatorState state) override; | 39 void OnIncomingInvalidation( |
| 40 virtual void OnIncomingInvalidation( | |
| 41 const syncer::ObjectIdInvalidationMap& invalidation_map) override; | 40 const syncer::ObjectIdInvalidationMap& invalidation_map) override; |
| 42 virtual std::string GetOwnerName() const override; | 41 std::string GetOwnerName() const override; |
| 43 | 42 |
| 44 void AddObserver(DriveNotificationObserver* observer); | 43 void AddObserver(DriveNotificationObserver* observer); |
| 45 void RemoveObserver(DriveNotificationObserver* observer); | 44 void RemoveObserver(DriveNotificationObserver* observer); |
| 46 | 45 |
| 47 // True when XMPP notification is currently enabled. | 46 // True when XMPP notification is currently enabled. |
| 48 bool push_notification_enabled() const { | 47 bool push_notification_enabled() const { |
| 49 return push_notification_enabled_; | 48 return push_notification_enabled_; |
| 50 } | 49 } |
| 51 | 50 |
| 52 // True when XMPP notification has been registered. | 51 // True when XMPP notification has been registered. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // Note: This should remain the last member so it'll be destroyed and | 89 // Note: This should remain the last member so it'll be destroyed and |
| 91 // invalidate its weak pointers before any other members are destroyed. | 90 // invalidate its weak pointers before any other members are destroyed. |
| 92 base::WeakPtrFactory<DriveNotificationManager> weak_ptr_factory_; | 91 base::WeakPtrFactory<DriveNotificationManager> weak_ptr_factory_; |
| 93 | 92 |
| 94 DISALLOW_COPY_AND_ASSIGN(DriveNotificationManager); | 93 DISALLOW_COPY_AND_ASSIGN(DriveNotificationManager); |
| 95 }; | 94 }; |
| 96 | 95 |
| 97 } // namespace drive | 96 } // namespace drive |
| 98 | 97 |
| 99 #endif // CHROME_BROWSER_DRIVE_DRIVE_NOTIFICATION_MANAGER_H_ | 98 #endif // CHROME_BROWSER_DRIVE_DRIVE_NOTIFICATION_MANAGER_H_ |
| OLD | NEW |