drive_notification_observer.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright (c) 2013 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_DRIVE_DRIVE_NOTIFICATION_OBSERVER_H_
  5. #define COMPONENTS_DRIVE_DRIVE_NOTIFICATION_OBSERVER_H_
  6. #include <map>
  7. #include <string>
  8. namespace drive {
  9. // Interface for classes which need to know when to check Google Drive for
  10. // updates.
  11. class DriveNotificationObserver {
  12. public:
  13. // Called when a notification from Google Drive is received. |invalidations|
  14. // is the map from objects that raised the notification to the changelist,
  15. // either a team drive id or empty string to represent the users default
  16. // corpus, to the change ID.
  17. virtual void OnNotificationReceived(
  18. const std::map<std::string, int64_t>& invalidations) = 0;
  19. // Called when there has not been a recent notification from Google Drive and
  20. // the timer used for polling Google Drive fired.
  21. virtual void OnNotificationTimerFired() = 0;
  22. // Called when XMPP-based push notification is enabled or disabled.
  23. virtual void OnPushNotificationEnabled(bool enabled) {}
  24. protected:
  25. virtual ~DriveNotificationObserver() = default;
  26. };
  27. } // namespace drive
  28. #endif // COMPONENTS_DRIVE_DRIVE_NOTIFICATION_OBSERVER_H_