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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 extensions::api::file_browser_private::MountCompletedEventType event_type, | 174 extensions::api::file_browser_private::MountCompletedEventType event_type, |
175 chromeos::MountError error, | 175 chromeos::MountError error, |
176 const VolumeInfo& volume_info); | 176 const VolumeInfo& volume_info); |
177 | 177 |
178 // If needed, opens a file manager window for the removable device mounted at | 178 // If needed, opens a file manager window for the removable device mounted at |
179 // |mount_path|. Disk.mount_path() is empty, since it is being filled out | 179 // |mount_path|. Disk.mount_path() is empty, since it is being filled out |
180 // after calling notifying observers by DiskMountManager. | 180 // after calling notifying observers by DiskMountManager. |
181 void ShowRemovableDeviceInFileManager(VolumeType type, | 181 void ShowRemovableDeviceInFileManager(VolumeType type, |
182 const base::FilePath& mount_path); | 182 const base::FilePath& mount_path); |
183 | 183 |
184 // Sends onFileTranferUpdated to extensions if needed. If |always| is true, | |
185 // it sends the event always. Otherwise, it sends the event if enough time has | |
186 // passed from the previous event so as not to make extension busy. | |
187 void SendDriveFileTransferEvent(bool always); | |
188 | |
189 // Manages the list of currently active Drive file transfer jobs. | 184 // Manages the list of currently active Drive file transfer jobs. |
190 struct DriveJobInfoWithStatus { | 185 struct DriveJobInfoWithStatus { |
191 DriveJobInfoWithStatus(); | 186 DriveJobInfoWithStatus(); |
192 DriveJobInfoWithStatus(const drive::JobInfo& info, | 187 DriveJobInfoWithStatus(const drive::JobInfo& info, |
193 const std::string& status); | 188 const std::string& status); |
194 drive::JobInfo job_info; | 189 drive::JobInfo job_info; |
195 std::string status; | 190 std::string status; |
196 }; | 191 }; |
| 192 |
| 193 // Schedule onFileTransferUpdated event. |
| 194 void ScheduleDriveFileTransferEvent(const drive::JobInfo& job_info, |
| 195 const std::string& status, |
| 196 bool immediate); |
| 197 |
| 198 // Sends onFileTranferUpdated to extensions if after nextSendTime_. |
| 199 void SendDriveFileTransferEvent(); |
| 200 |
197 std::map<drive::JobID, DriveJobInfoWithStatus> drive_jobs_; | 201 std::map<drive::JobID, DriveJobInfoWithStatus> drive_jobs_; |
| 202 scoped_ptr<DriveJobInfoWithStatus> drive_job_info_with_status_; |
198 base::Time last_file_transfer_event_; | 203 base::Time last_file_transfer_event_; |
199 base::Time last_copy_progress_event_; | 204 base::Time last_copy_progress_event_; |
| 205 base::Time next_send_file_transfer_event_; |
200 | 206 |
201 WatcherMap file_watchers_; | 207 WatcherMap file_watchers_; |
202 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; | 208 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; |
203 Profile* profile_; | 209 Profile* profile_; |
204 | 210 |
205 content::NotificationRegistrar notification_registrar_; | 211 content::NotificationRegistrar notification_registrar_; |
206 bool multi_user_window_manager_observer_registered_; | 212 bool multi_user_window_manager_observer_registered_; |
207 | 213 |
208 scoped_ptr<DeviceEventRouter> device_event_router_; | 214 scoped_ptr<DeviceEventRouter> device_event_router_; |
209 | 215 |
210 // 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 |
211 // invalidate the weak pointers before any other members are destroyed. | 217 // invalidate the weak pointers before any other members are destroyed. |
212 base::WeakPtrFactory<EventRouter> weak_factory_; | 218 base::WeakPtrFactory<EventRouter> weak_factory_; |
213 DISALLOW_COPY_AND_ASSIGN(EventRouter); | 219 DISALLOW_COPY_AND_ASSIGN(EventRouter); |
214 }; | 220 }; |
215 | 221 |
216 } // namespace file_manager | 222 } // namespace file_manager |
217 | 223 |
218 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ | 224 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ |
OLD | NEW |