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

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

Issue 1190203002: Move (most of) chrome/browser/drive into components/drive/service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing... Created 5 years, 5 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/drive/drive_notification_manager.h
diff --git a/chrome/browser/drive/drive_notification_manager.h b/chrome/browser/drive/drive_notification_manager.h
deleted file mode 100644
index 18ae5d04e122d5803fad2060080c71b965bf6c4f..0000000000000000000000000000000000000000
--- a/chrome/browser/drive/drive_notification_manager.h
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_DRIVE_DRIVE_NOTIFICATION_MANAGER_H_
-#define CHROME_BROWSER_DRIVE_DRIVE_NOTIFICATION_MANAGER_H_
-
-#include "base/memory/weak_ptr.h"
-#include "base/observer_list.h"
-#include "base/timer/timer.h"
-#include "chrome/browser/drive/drive_notification_observer.h"
-#include "components/invalidation/public/invalidation_handler.h"
-#include "components/keyed_service/core/keyed_service.h"
-
-class ProfileSyncService;
-
-namespace invalidation {
-class InvalidationService;
-}
-
-namespace drive {
-
-// 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.
-// 2. Polling timer counts down.
-class DriveNotificationManager : public KeyedService,
- public syncer::InvalidationHandler {
- public:
- explicit DriveNotificationManager(
- invalidation::InvalidationService* invalidation_service);
- ~DriveNotificationManager() override;
-
- // KeyedService override.
- void Shutdown() override;
-
- // syncer::InvalidationHandler implementation.
- void OnInvalidatorStateChange(syncer::InvalidatorState state) override;
- void OnIncomingInvalidation(
- const syncer::ObjectIdInvalidationMap& invalidation_map) override;
- std::string GetOwnerName() const override;
-
- void AddObserver(DriveNotificationObserver* observer);
- void RemoveObserver(DriveNotificationObserver* observer);
-
- // True when XMPP notification is currently enabled.
- bool push_notification_enabled() const {
- return push_notification_enabled_;
- }
-
- // True when XMPP notification has been registered.
- bool push_notification_registered() const {
- return push_notification_registered_;
- }
-
- private:
- enum NotificationSource {
- NOTIFICATION_XMPP,
- NOTIFICATION_POLLING,
- };
-
- // Restarts the polling timer. Used for polling-based notification.
- void RestartPollingTimer();
-
- // Notifies the observers that it's time to check for updates.
- // |source| indicates where the notification comes from.
- void NotifyObserversToUpdate(NotificationSource source);
-
- // Registers for Google Drive invalidation notifications through XMPP.
- void RegisterDriveNotifications();
-
- // Returns a string representation of NotificationSource.
- static std::string NotificationSourceToString(NotificationSource source);
-
- invalidation::InvalidationService* invalidation_service_;
- base::ObserverList<DriveNotificationObserver> observers_;
-
- // True when Drive File Sync Service is registered for Drive notifications.
- bool push_notification_registered_;
- // 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.
- base::Timer polling_timer_;
-
- // Note: This should remain the last member so it'll be destroyed and
- // invalidate its weak pointers before any other members are destroyed.
- base::WeakPtrFactory<DriveNotificationManager> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(DriveNotificationManager);
-};
-
-} // namespace drive
-
-#endif // CHROME_BROWSER_DRIVE_DRIVE_NOTIFICATION_MANAGER_H_
« no previous file with comments | « chrome/browser/drive/drive_app_registry_unittest.cc ('k') | chrome/browser/drive/drive_notification_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698