Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/event_router.h

Issue 507293002: Enrich fileBrowserPrivate.onFileTransfersUpdated event to support displaying total number of jobs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 if should_delay is
196 // true. call_time is used to refresh sending event.
197 void SendDriveFileTransferEvent(
198 const DriveJobInfoWithStatus& job_info_with_status,
199 base::Time call_time,
200 bool should_delay);
201
198 std::map<drive::JobID, DriveJobInfoWithStatus> drive_jobs_; 202 std::map<drive::JobID, DriveJobInfoWithStatus> drive_jobs_;
199 base::Time last_file_transfer_event_; 203 base::Time last_file_transfer_event_;
200 base::Time last_copy_progress_event_; 204 base::Time last_copy_progress_event_;
205 base::Time last_post_delayed_task_;
206 base::Time first_delay_task_;
207
208 const base::TimeDelta delay_time_;
209 const base::TimeDelta force_send_time_;
201 210
202 WatcherMap file_watchers_; 211 WatcherMap file_watchers_;
203 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; 212 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_;
204 Profile* profile_; 213 Profile* profile_;
205 214
206 content::NotificationRegistrar notification_registrar_; 215 content::NotificationRegistrar notification_registrar_;
207 bool multi_user_window_manager_observer_registered_; 216 bool multi_user_window_manager_observer_registered_;
208 217
209 scoped_ptr<DeviceEventRouter> device_event_router_; 218 scoped_ptr<DeviceEventRouter> device_event_router_;
210 219
211 // Note: This should remain the last member so it'll be destroyed and 220 // Note: This should remain the last member so it'll be destroyed and
212 // invalidate the weak pointers before any other members are destroyed. 221 // invalidate the weak pointers before any other members are destroyed.
213 base::WeakPtrFactory<EventRouter> weak_factory_; 222 base::WeakPtrFactory<EventRouter> weak_factory_;
214 DISALLOW_COPY_AND_ASSIGN(EventRouter); 223 DISALLOW_COPY_AND_ASSIGN(EventRouter);
215 }; 224 };
216 225
217 } // namespace file_manager 226 } // namespace file_manager
218 227
219 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ 228 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698