Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / extensions / file_manager / event_router.h
index 30a26ff..0813807 100644 (file)
 #include "chrome/browser/chromeos/file_manager/file_watcher.h"
 #include "chrome/browser/chromeos/file_manager/volume_manager_observer.h"
 #include "chrome/browser/drive/drive_service_interface.h"
+#include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
 #include "chrome/common/extensions/api/file_browser_private.h"
 #include "chromeos/disks/disk_mount_manager.h"
 #include "chromeos/network/network_state_handler_observer.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
 #include "webkit/browser/fileapi/file_system_operation.h"
 
 class PrefChangeRegistrar;
@@ -44,7 +47,9 @@ class EventRouter
       public drive::FileSystemObserver,
       public drive::JobListObserver,
       public drive::DriveServiceObserver,
-      public VolumeManagerObserver {
+      public VolumeManagerObserver,
+      public content::NotificationObserver,
+      public chrome::MultiUserWindowManager::Observer {
  public:
   explicit EventRouter(Profile* profile);
   virtual ~EventRouter();
@@ -52,7 +57,7 @@ class EventRouter
   void Shutdown();
 
   // Starts observing file system change events.
-  void ObserveFileSystemEvents();
+  void ObserveEvents();
 
   typedef base::Callback<void(bool success)> BoolCallback;
 
@@ -82,6 +87,9 @@ class EventRouter
                       const GURL& destination_url,
                       int64 size);
 
+  // Register observer to the multi user window manager.
+  void RegisterMultiUserWindowManagerObserver();
+
   // chromeos::NetworkStateHandlerObserver overrides.
   virtual void DefaultNetworkChanged(
       const chromeos::NetworkState* network) OVERRIDE;
@@ -96,11 +104,9 @@ class EventRouter
   virtual void OnRefreshTokenInvalid() OVERRIDE;
 
   // drive::FileSystemObserver overrides.
-  virtual void OnDirectoryChanged(
-      const base::FilePath& directory_path) OVERRIDE;
-  virtual void OnDriveSyncError(
-      drive::file_system::DriveSyncErrorType type,
-      const base::FilePath& file_path) OVERRIDE;
+  virtual void OnDirectoryChanged(const base::FilePath& drive_path) OVERRIDE;
+  virtual void OnDriveSyncError(drive::file_system::DriveSyncErrorType type,
+                                const base::FilePath& drive_path) OVERRIDE;
 
   // VolumeManagerObserver overrides.
   virtual void OnDiskAdded(
@@ -120,6 +126,14 @@ class EventRouter
   virtual void OnFormatCompleted(
       const std::string& device_path, bool success) OVERRIDE;
 
+  // content::NotificationObserver overrides.
+  virtual void Observe(int type,
+                       const content::NotificationSource& source,
+                       const content::NotificationDetails& details) OVERRIDE;
+
+  // chrome::MultiUserWindowManager::Observer overrides:
+  virtual void OnOwnerEntryChanged(aura::Window* window) OVERRIDE;
+
  private:
   typedef std::map<base::FilePath, FileWatcher*> WatcherMap;
 
@@ -167,6 +181,9 @@ class EventRouter
   scoped_ptr<PrefChangeRegistrar> pref_change_registrar_;
   Profile* profile_;
 
+  content::NotificationRegistrar notification_registrar_;
+  bool multi_user_window_manager_observer_registered_;
+
   // Note: This should remain the last member so it'll be destroyed and
   // invalidate the weak pointers before any other members are destroyed.
   base::WeakPtrFactory<EventRouter> weak_factory_;