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