| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 using file_manager::util::EntryDefinition; | 35 using file_manager::util::EntryDefinition; |
| 36 | 36 |
| 37 namespace base { | 37 namespace base { |
| 38 class ListValue; | 38 class ListValue; |
| 39 } | 39 } |
| 40 | 40 |
| 41 namespace chromeos { | 41 namespace chromeos { |
| 42 class NetworkState; | 42 class NetworkState; |
| 43 } | 43 } |
| 44 | 44 |
| 45 namespace drive { |
| 46 class FileChange; |
| 47 } |
| 48 |
| 45 namespace file_manager { | 49 namespace file_manager { |
| 46 | 50 |
| 47 // Monitors changes in disk mounts, network connection state and preferences | 51 // Monitors changes in disk mounts, network connection state and preferences |
| 48 // affecting File Manager. Dispatches appropriate File Browser events. | 52 // affecting File Manager. Dispatches appropriate File Browser events. |
| 49 class EventRouter | 53 class EventRouter |
| 50 : public chromeos::NetworkStateHandlerObserver, | 54 : public chromeos::NetworkStateHandlerObserver, |
| 51 public drive::FileSystemObserver, | 55 public drive::FileSystemObserver, |
| 52 public drive::JobListObserver, | 56 public drive::JobListObserver, |
| 53 public drive::DriveServiceObserver, | 57 public drive::DriveServiceObserver, |
| 54 public VolumeManagerObserver, | 58 public VolumeManagerObserver, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 virtual void OnJobAdded(const drive::JobInfo& job_info) OVERRIDE; | 106 virtual void OnJobAdded(const drive::JobInfo& job_info) OVERRIDE; |
| 103 virtual void OnJobUpdated(const drive::JobInfo& job_info) OVERRIDE; | 107 virtual void OnJobUpdated(const drive::JobInfo& job_info) OVERRIDE; |
| 104 virtual void OnJobDone(const drive::JobInfo& job_info, | 108 virtual void OnJobDone(const drive::JobInfo& job_info, |
| 105 drive::FileError error) OVERRIDE; | 109 drive::FileError error) OVERRIDE; |
| 106 | 110 |
| 107 // drive::DriveServiceObserver overrides. | 111 // drive::DriveServiceObserver overrides. |
| 108 virtual void OnRefreshTokenInvalid() OVERRIDE; | 112 virtual void OnRefreshTokenInvalid() OVERRIDE; |
| 109 | 113 |
| 110 // drive::FileSystemObserver overrides. | 114 // drive::FileSystemObserver overrides. |
| 111 virtual void OnDirectoryChanged(const base::FilePath& drive_path) OVERRIDE; | 115 virtual void OnDirectoryChanged(const base::FilePath& drive_path) OVERRIDE; |
| 116 virtual void OnFileChanged(const drive::FileChange& changed_files) OVERRIDE; |
| 112 virtual void OnDriveSyncError(drive::file_system::DriveSyncErrorType type, | 117 virtual void OnDriveSyncError(drive::file_system::DriveSyncErrorType type, |
| 113 const base::FilePath& drive_path) OVERRIDE; | 118 const base::FilePath& drive_path) OVERRIDE; |
| 114 | 119 |
| 115 // VolumeManagerObserver overrides. | 120 // VolumeManagerObserver overrides. |
| 116 virtual void OnDiskAdded( | 121 virtual void OnDiskAdded( |
| 117 const chromeos::disks::DiskMountManager::Disk& disk, | 122 const chromeos::disks::DiskMountManager::Disk& disk, |
| 118 bool mounting) OVERRIDE; | 123 bool mounting) OVERRIDE; |
| 119 virtual void OnDiskRemoved( | 124 virtual void OnDiskRemoved( |
| 120 const chromeos::disks::DiskMountManager::Disk& disk) OVERRIDE; | 125 const chromeos::disks::DiskMountManager::Disk& disk) OVERRIDE; |
| 121 virtual void OnDeviceAdded(const std::string& device_path) OVERRIDE; | 126 virtual void OnDeviceAdded(const std::string& device_path) OVERRIDE; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 139 // chrome::MultiUserWindowManager::Observer overrides: | 144 // chrome::MultiUserWindowManager::Observer overrides: |
| 140 virtual void OnOwnerEntryChanged(aura::Window* window) OVERRIDE; | 145 virtual void OnOwnerEntryChanged(aura::Window* window) OVERRIDE; |
| 141 | 146 |
| 142 private: | 147 private: |
| 143 typedef std::map<base::FilePath, FileWatcher*> WatcherMap; | 148 typedef std::map<base::FilePath, FileWatcher*> WatcherMap; |
| 144 | 149 |
| 145 // Called when prefs related to file manager change. | 150 // Called when prefs related to file manager change. |
| 146 void OnFileManagerPrefsChanged(); | 151 void OnFileManagerPrefsChanged(); |
| 147 | 152 |
| 148 // Process file watch notifications. | 153 // Process file watch notifications. |
| 149 void HandleFileWatchNotification(const base::FilePath& path, | 154 void HandleFileWatchNotification(const drive::FileChange* list, |
| 155 const base::FilePath& path, |
| 150 bool got_error); | 156 bool got_error); |
| 151 | 157 |
| 152 // Sends directory change event. | 158 // Sends directory change event. |
| 153 void DispatchDirectoryChangeEvent( | 159 void DispatchDirectoryChangeEvent( |
| 154 const base::FilePath& path, | 160 const base::FilePath& path, |
| 155 bool error, | 161 const drive::FileChange* list, |
| 162 bool got_error, |
| 156 const std::vector<std::string>& extension_ids); | 163 const std::vector<std::string>& extension_ids); |
| 157 | 164 |
| 158 // Sends directory change event, after converting the file definition to entry | 165 // Sends directory change event, after converting the file definition to entry |
| 159 // definition. | 166 // definition. |
| 160 void DispatchDirectoryChangeEventWithEntryDefinition( | 167 void DispatchDirectoryChangeEventWithEntryDefinition( |
| 168 const linked_ptr<drive::FileChange> list, |
| 169 const std::string* extension_id, |
| 161 bool watcher_error, | 170 bool watcher_error, |
| 162 const EntryDefinition& entry_definition); | 171 const EntryDefinition& entry_definition); |
| 163 | 172 |
| 164 // If needed, opens a file manager window for the removable device mounted at | 173 // If needed, opens a file manager window for the removable device mounted at |
| 165 // |mount_path|. Disk.mount_path() is empty, since it is being filled out | 174 // |mount_path|. Disk.mount_path() is empty, since it is being filled out |
| 166 // after calling notifying observers by DiskMountManager. | 175 // after calling notifying observers by DiskMountManager. |
| 167 void ShowRemovableDeviceInFileManager(VolumeType type, | 176 void ShowRemovableDeviceInFileManager(VolumeType type, |
| 168 const base::FilePath& mount_path); | 177 const base::FilePath& mount_path); |
| 169 | 178 |
| 170 // Dispatches an onDeviceChanged event containing |type| and |path| to | 179 // Dispatches an onDeviceChanged event containing |type| and |path| to |
| (...skipping 28 matching lines...) Expand all Loading... |
| 199 | 208 |
| 200 // Note: This should remain the last member so it'll be destroyed and | 209 // Note: This should remain the last member so it'll be destroyed and |
| 201 // invalidate the weak pointers before any other members are destroyed. | 210 // invalidate the weak pointers before any other members are destroyed. |
| 202 base::WeakPtrFactory<EventRouter> weak_factory_; | 211 base::WeakPtrFactory<EventRouter> weak_factory_; |
| 203 DISALLOW_COPY_AND_ASSIGN(EventRouter); | 212 DISALLOW_COPY_AND_ASSIGN(EventRouter); |
| 204 }; | 213 }; |
| 205 | 214 |
| 206 } // namespace file_manager | 215 } // namespace file_manager |
| 207 | 216 |
| 208 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ | 217 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ |
| OLD | NEW |