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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // drive::JobListObserver overrides. | 105 // drive::JobListObserver overrides. |
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( |
| 116 const base::FilePath& drive_path, |
| 117 const drive::FileChange* changed_files) OVERRIDE; |
112 virtual void OnDriveSyncError(drive::file_system::DriveSyncErrorType type, | 118 virtual void OnDriveSyncError(drive::file_system::DriveSyncErrorType type, |
113 const base::FilePath& drive_path) OVERRIDE; | 119 const base::FilePath& drive_path) OVERRIDE; |
114 | 120 |
115 // VolumeManagerObserver overrides. | 121 // VolumeManagerObserver overrides. |
116 virtual void OnDiskAdded( | 122 virtual void OnDiskAdded( |
117 const chromeos::disks::DiskMountManager::Disk& disk, | 123 const chromeos::disks::DiskMountManager::Disk& disk, |
118 bool mounting) OVERRIDE; | 124 bool mounting) OVERRIDE; |
119 virtual void OnDiskRemoved( | 125 virtual void OnDiskRemoved( |
120 const chromeos::disks::DiskMountManager::Disk& disk) OVERRIDE; | 126 const chromeos::disks::DiskMountManager::Disk& disk) OVERRIDE; |
121 virtual void OnDeviceAdded(const std::string& device_path) OVERRIDE; | 127 virtual void OnDeviceAdded(const std::string& device_path) OVERRIDE; |
(...skipping 17 matching lines...) Expand all Loading... |
139 // chrome::MultiUserWindowManager::Observer overrides: | 145 // chrome::MultiUserWindowManager::Observer overrides: |
140 virtual void OnOwnerEntryChanged(aura::Window* window) OVERRIDE; | 146 virtual void OnOwnerEntryChanged(aura::Window* window) OVERRIDE; |
141 | 147 |
142 private: | 148 private: |
143 typedef std::map<base::FilePath, FileWatcher*> WatcherMap; | 149 typedef std::map<base::FilePath, FileWatcher*> WatcherMap; |
144 | 150 |
145 // Called when prefs related to file manager change. | 151 // Called when prefs related to file manager change. |
146 void OnFileManagerPrefsChanged(); | 152 void OnFileManagerPrefsChanged(); |
147 | 153 |
148 // Process file watch notifications. | 154 // Process file watch notifications. |
149 void HandleFileWatchNotification(const base::FilePath& path, | 155 void HandleFileWatchNotification(const drive::FileChange* list, |
| 156 const base::FilePath& path, |
150 bool got_error); | 157 bool got_error); |
151 | 158 |
152 // Sends directory change event. | 159 // Sends directory change event. |
153 void DispatchDirectoryChangeEvent( | 160 void DispatchDirectoryChangeEvent( |
154 const base::FilePath& path, | 161 const base::FilePath& path, |
155 bool error, | 162 const drive::FileChange* list, |
| 163 bool got_error, |
156 const std::vector<std::string>& extension_ids); | 164 const std::vector<std::string>& extension_ids); |
157 | 165 |
158 // Sends directory change event, after converting the file definition to entry | 166 // Sends directory change event, after converting the file definition to entry |
159 // definition. | 167 // definition. |
160 void DispatchDirectoryChangeEventWithEntryDefinition( | 168 void DispatchDirectoryChangeEventWithEntryDefinition( |
| 169 const linked_ptr<drive::FileChange> list, |
| 170 const std::string* extension_id, |
161 bool watcher_error, | 171 bool watcher_error, |
162 const EntryDefinition& entry_definition); | 172 const EntryDefinition& entry_definition); |
163 | 173 |
164 // If needed, opens a file manager window for the removable device mounted at | 174 // 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 | 175 // |mount_path|. Disk.mount_path() is empty, since it is being filled out |
166 // after calling notifying observers by DiskMountManager. | 176 // after calling notifying observers by DiskMountManager. |
167 void ShowRemovableDeviceInFileManager(VolumeType type, | 177 void ShowRemovableDeviceInFileManager(VolumeType type, |
168 const base::FilePath& mount_path); | 178 const base::FilePath& mount_path); |
169 | 179 |
170 // Dispatches an onDeviceChanged event containing |type| and |path| to | 180 // Dispatches an onDeviceChanged event containing |type| and |path| to |
(...skipping 28 matching lines...) Expand all Loading... |
199 | 209 |
200 // Note: This should remain the last member so it'll be destroyed and | 210 // Note: This should remain the last member so it'll be destroyed and |
201 // invalidate the weak pointers before any other members are destroyed. | 211 // invalidate the weak pointers before any other members are destroyed. |
202 base::WeakPtrFactory<EventRouter> weak_factory_; | 212 base::WeakPtrFactory<EventRouter> weak_factory_; |
203 DISALLOW_COPY_AND_ASSIGN(EventRouter); | 213 DISALLOW_COPY_AND_ASSIGN(EventRouter); |
204 }; | 214 }; |
205 | 215 |
206 } // namespace file_manager | 216 } // namespace file_manager |
207 | 217 |
208 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ | 218 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ |
OLD | NEW |