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

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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Sends onFileTransferUpdate event right now if |immediate| is set. Otherwise
177 // it
kinaba 2014/09/04 01:40:00 please reduce newlines.
iseki 2014/09/04 01:47:16 Done.
178 // refrains from sending for a short while, and after that it sends the most
179 // recently scheduled event once.
180 // The delay is for waiting subsequent 'added' events to come after the first
181 // one
182 // when multiple tasks are added. This way, we can avoid frequent UI update
183 // caused
184 // by differences between singular and plural cases.
185 void ScheduleDriveFileTransferEvent(const drive::JobInfo& job_info,
186 const std::string& status,
187 bool immediate);
188
189 // Sends the most recently scheduled onFileTransferUpdated event to
190 // extensions.
191 // This is used for implementing ScheduledDriveFileTransferEvent().
192 void SendDriveFileTransferEvent();
193
180 std::map<drive::JobID, DriveJobInfoWithStatus> drive_jobs_; 194 std::map<drive::JobID, DriveJobInfoWithStatus> drive_jobs_;
181 base::Time last_file_transfer_event_; 195 scoped_ptr<DriveJobInfoWithStatus> drive_job_info_for_scheduled_event_;
182 base::Time last_copy_progress_event_; 196 base::Time last_copy_progress_event_;
197 base::Time next_send_file_transfer_event_;
183 198
184 WatcherMap file_watchers_; 199 WatcherMap file_watchers_;
185 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_; 200 scoped_ptr<PrefChangeRegistrar> pref_change_registrar_;
186 Profile* profile_; 201 Profile* profile_;
187 202
188 scoped_ptr<DeviceEventRouter> device_event_router_; 203 scoped_ptr<DeviceEventRouter> device_event_router_;
189 204
190 // Note: This should remain the last member so it'll be destroyed and 205 // Note: This should remain the last member so it'll be destroyed and
191 // invalidate the weak pointers before any other members are destroyed. 206 // invalidate the weak pointers before any other members are destroyed.
192 base::WeakPtrFactory<EventRouter> weak_factory_; 207 base::WeakPtrFactory<EventRouter> weak_factory_;
193 DISALLOW_COPY_AND_ASSIGN(EventRouter); 208 DISALLOW_COPY_AND_ASSIGN(EventRouter);
194 }; 209 };
195 210
196 } // namespace file_manager 211 } // namespace file_manager
197 212
198 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_ 213 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_EVENT_ROUTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/job_scheduler.cc ('k') | chrome/browser/chromeos/extensions/file_manager/event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698