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

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);
190 bool empty();
195 drive::JobInfo job_info; 191 drive::JobInfo job_info;
196 std::string status; 192 std::string status;
197 }; 193 };
194
195 // Schedule onFileTransferUpdated event.
196 void ScheduleEvent(DriveJobInfoWithStatus& job_info_with_status,
hirono 2014/09/01 03:53:44 Sorry this is my fault. The naming in my pseudo co
iseki 2014/09/01 06:45:40 Done.
197 bool immediate);
198
199 // Sends onFileTranferUpdated to extensions if after nextSendTime_.
200 void SendDriveFileTransferEvent();
201
198 std::map<drive::JobID, DriveJobInfoWithStatus> drive_jobs_; 202 std::map<drive::JobID, DriveJobInfoWithStatus> drive_jobs_;
203 DriveJobInfoWithStatus drive_job_info_with_status_;
199 base::Time last_file_transfer_event_; 204 base::Time last_file_transfer_event_;
200 base::Time last_copy_progress_event_; 205 base::Time last_copy_progress_event_;
206 base::Time nextSendTime_;
hirono 2014/09/01 03:53:44 ditto. Please fix the name.
iseki 2014/09/01 06:45:40 Done.
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698