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

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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
kinaba 2014/09/03 05:42:24 Please add some comment on why scheduling is neces
iseki 2014/09/03 12:29:00 Done.
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_.
kinaba 2014/09/03 05:42:24 "if after nextSendTime_" is not grammatical. Proba
iseki 2014/09/03 12:29:00 Done.
199 void SendDriveFileTransferEvent();
200
197 std::map<drive::JobID, DriveJobInfoWithStatus> drive_jobs_; 201 std::map<drive::JobID, DriveJobInfoWithStatus> drive_jobs_;
198 base::Time last_file_transfer_event_; 202 scoped_ptr<DriveJobInfoWithStatus> drive_job_info_for_scheduled_event_;
199 base::Time last_copy_progress_event_; 203 base::Time last_copy_progress_event_;
204 base::Time next_send_file_transfer_event_;
200 205
201 WatcherMap file_watchers_; 206 WatcherMap file_watchers_;
202 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; 207 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_;
203 Profile* profile_; 208 Profile* profile_;
204 209
205 content::NotificationRegistrar notification_registrar_; 210 content::NotificationRegistrar notification_registrar_;
206 bool multi_user_window_manager_observer_registered_; 211 bool multi_user_window_manager_observer_registered_;
207 212
208 scoped_ptr<DeviceEventRouter> device_event_router_; 213 scoped_ptr<DeviceEventRouter> device_event_router_;
209 214
210 // Note: This should remain the last member so it'll be destroyed and 215 // Note: This should remain the last member so it'll be destroyed and
211 // invalidate the weak pointers before any other members are destroyed. 216 // invalidate the weak pointers before any other members are destroyed.
212 base::WeakPtrFactory<EventRouter> weak_factory_; 217 base::WeakPtrFactory<EventRouter> weak_factory_;
213 DISALLOW_COPY_AND_ASSIGN(EventRouter); 218 DISALLOW_COPY_AND_ASSIGN(EventRouter);
214 }; 219 };
215 220
216 } // namespace file_manager 221 } // namespace file_manager
217 222
218 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ 223 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698