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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 extensions::api::file_browser_private::MountCompletedEventType event_type, | 157 extensions::api::file_browser_private::MountCompletedEventType event_type, |
158 chromeos::MountError error, | 158 chromeos::MountError error, |
159 const VolumeInfo& volume_info); | 159 const VolumeInfo& volume_info); |
160 | 160 |
161 // If needed, opens a file manager window for the removable device mounted at | 161 // If needed, opens a file manager window for the removable device mounted at |
162 // |mount_path|. Disk.mount_path() is empty, since it is being filled out | 162 // |mount_path|. Disk.mount_path() is empty, since it is being filled out |
163 // after calling notifying observers by DiskMountManager. | 163 // after calling notifying observers by DiskMountManager. |
164 void ShowRemovableDeviceInFileManager(VolumeType type, | 164 void ShowRemovableDeviceInFileManager(VolumeType type, |
165 const base::FilePath& mount_path); | 165 const base::FilePath& mount_path); |
166 | 166 |
167 // Sends onFileTranferUpdated to extensions if needed. If |always| is true, | |
168 // it sends the event always. Otherwise, it sends the event if enough time has | |
169 // passed from the previous event so as not to make extension busy. | |
170 void SendDriveFileTransferEvent(bool always); | |
171 | |
172 // Manages the list of currently active Drive file transfer jobs. | 167 // Manages the list of currently active Drive file transfer jobs. |
173 struct DriveJobInfoWithStatus { | 168 struct DriveJobInfoWithStatus { |
174 DriveJobInfoWithStatus(); | 169 DriveJobInfoWithStatus(); |
175 DriveJobInfoWithStatus(const drive::JobInfo& info, | 170 DriveJobInfoWithStatus(const drive::JobInfo& info, |
176 const std::string& status); | 171 const std::string& status); |
177 drive::JobInfo job_info; | 172 drive::JobInfo job_info; |
178 std::string status; | 173 std::string status; |
179 }; | 174 }; |
175 | |
176 // Schedule onFileTransferUpdated event to count following events. | |
kinaba
2014/09/03 15:54:19
"to count following events" is still vague.
I gues
iseki
2014/09/04 00:50:07
Done.
| |
177 // If only one event receive, Files.app display the name of a item otherwise | |
178 // display the number of items. Counting the event is necessary to avoid | |
179 // displaying the name of a item. | |
180 void ScheduleDriveFileTransferEvent(const drive::JobInfo& job_info, | |
181 const std::string& status, | |
182 bool immediate); | |
183 | |
184 // Sends onFileTranferUpdated to extensions if call time is after | |
185 // nextSendTime_. | |
186 void SendDriveFileTransferEvent(); | |
kinaba
2014/09/03 15:54:19
This method itself does not refer timing anymore,
iseki
2014/09/04 00:50:07
Done.
| |
187 | |
180 std::map<drive::JobID, DriveJobInfoWithStatus> drive_jobs_; | 188 std::map<drive::JobID, DriveJobInfoWithStatus> drive_jobs_; |
181 base::Time last_file_transfer_event_; | 189 scoped_ptr<DriveJobInfoWithStatus> drive_job_info_for_scheduled_event_; |
182 base::Time last_copy_progress_event_; | 190 base::Time last_copy_progress_event_; |
191 base::Time next_send_file_transfer_event_; | |
183 | 192 |
184 WatcherMap file_watchers_; | 193 WatcherMap file_watchers_; |
185 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; | 194 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; |
186 Profile* profile_; | 195 Profile* profile_; |
187 | 196 |
188 scoped_ptr<DeviceEventRouter> device_event_router_; | 197 scoped_ptr<DeviceEventRouter> device_event_router_; |
189 | 198 |
190 // Note: This should remain the last member so it'll be destroyed and | 199 // Note: This should remain the last member so it'll be destroyed and |
191 // invalidate the weak pointers before any other members are destroyed. | 200 // invalidate the weak pointers before any other members are destroyed. |
192 base::WeakPtrFactory<EventRouter> weak_factory_; | 201 base::WeakPtrFactory<EventRouter> weak_factory_; |
193 DISALLOW_COPY_AND_ASSIGN(EventRouter); | 202 DISALLOW_COPY_AND_ASSIGN(EventRouter); |
194 }; | 203 }; |
195 | 204 |
196 } // namespace file_manager | 205 } // namespace file_manager |
197 | 206 |
198 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ | 207 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ |
OLD | NEW |