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 // Dispatches the mount completed event. | 173 // Dispatches the mount completed event. |
165 void DispatchMountCompletedEvent( | 174 void DispatchMountCompletedEvent( |
166 extensions::api::file_browser_private::MountCompletedEventType event_type, | 175 extensions::api::file_browser_private::MountCompletedEventType event_type, |
167 chromeos::MountError error, | 176 chromeos::MountError error, |
168 const VolumeInfo& volume_info, | 177 const VolumeInfo& volume_info, |
169 bool is_remounting); | 178 bool is_remounting); |
170 | 179 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 215 |
207 // Note: This should remain the last member so it'll be destroyed and | 216 // Note: This should remain the last member so it'll be destroyed and |
208 // invalidate the weak pointers before any other members are destroyed. | 217 // invalidate the weak pointers before any other members are destroyed. |
209 base::WeakPtrFactory<EventRouter> weak_factory_; | 218 base::WeakPtrFactory<EventRouter> weak_factory_; |
210 DISALLOW_COPY_AND_ASSIGN(EventRouter); | 219 DISALLOW_COPY_AND_ASSIGN(EventRouter); |
211 }; | 220 }; |
212 | 221 |
213 } // namespace file_manager | 222 } // namespace file_manager |
214 | 223 |
215 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ | 224 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ |
OLD | NEW |