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

Side by Side Diff: chrome/browser/chromeos/drive/drive_scheduler.h

Issue 11620007: Switch from OnIPAddressChanged and OnConnectionTypeChange to OnNetworkChanged Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
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_DRIVE_DRIVE_SCHEDULER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SCHEDULER_H_
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SCHEDULER_H_ 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SCHEDULER_H_
7 7
8 #include "base/memory/linked_ptr.h" 8 #include "base/memory/linked_ptr.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h" 10 #include "chrome/browser/chromeos/drive/drive_file_system_interface.h"
11 #include "chrome/browser/google_apis/drive_service_interface.h" 11 #include "chrome/browser/google_apis/drive_service_interface.h"
12 #include "net/base/network_change_notifier.h" 12 #include "net/base/network_change_notifier.h"
13 13
14 #include <deque> 14 #include <deque>
15 15
16 class Profile; 16 class Profile;
17 17
18 namespace drive { 18 namespace drive {
19 19
20 // The DriveScheduler is responsible for queuing and scheduling drive 20 // The DriveScheduler is responsible for queuing and scheduling drive
21 // operations. It is responsible for handling retry logic, rate limiting, as 21 // operations. It is responsible for handling retry logic, rate limiting, as
22 // concurrency as appropriate. 22 // concurrency as appropriate.
23 // 23 //
24 // TODO(zork): Provide an interface for querying the number of jobs, and state 24 // TODO(zork): Provide an interface for querying the number of jobs, and state
25 // of each. See: crbug.com/154243 25 // of each. See: crbug.com/154243
26 class DriveScheduler 26 class DriveScheduler
27 : public net::NetworkChangeNotifier::ConnectionTypeObserver { 27 : public net::NetworkChangeNotifier::NetworkChangeObserver {
28 public: 28 public:
29 29
30 // Enum representing the type of job. 30 // Enum representing the type of job.
31 enum JobType { 31 enum JobType {
32 TYPE_GET_ACCOUNT_METADATA, 32 TYPE_GET_ACCOUNT_METADATA,
33 TYPE_GET_APPLICATION_INFO, 33 TYPE_GET_APPLICATION_INFO,
34 TYPE_GET_RESOURCE_LIST, 34 TYPE_GET_RESOURCE_LIST,
35 TYPE_GET_RESOURCE_ENTRY, 35 TYPE_GET_RESOURCE_ENTRY,
36 TYPE_DELETE_RESOURCE, 36 TYPE_DELETE_RESOURCE,
37 TYPE_COPY_HOSTED_DOCUMENT, 37 TYPE_COPY_HOSTED_DOCUMENT,
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 scoped_ptr<base::Value> feed_data); 295 scoped_ptr<base::Value> feed_data);
296 296
297 // Callback for job finishing with a EntryActionCallback. 297 // Callback for job finishing with a EntryActionCallback.
298 void OnEntryActionJobDone(int job_id, google_apis::GDataErrorCode error); 298 void OnEntryActionJobDone(int job_id, google_apis::GDataErrorCode error);
299 299
300 // Callback for job finishing with a DownloadActionCallback. 300 // Callback for job finishing with a DownloadActionCallback.
301 void OnDownloadActionJobDone(int job_id, 301 void OnDownloadActionJobDone(int job_id,
302 google_apis::GDataErrorCode error, 302 google_apis::GDataErrorCode error,
303 const FilePath& temp_file); 303 const FilePath& temp_file);
304 304
305 // net::NetworkChangeNotifier::ConnectionTypeObserver override. 305 // net::NetworkChangeNotifier::NetworkChangeObserver override.
306 virtual void OnConnectionTypeChanged( 306 virtual void OnNetworkChanged(
307 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; 307 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
308 308
309 // For testing only. Disables throttling so that testing is faster. 309 // For testing only. Disables throttling so that testing is faster.
310 void SetDisableThrottling(bool disable) { disable_throttling_ = disable; } 310 void SetDisableThrottling(bool disable) { disable_throttling_ = disable; }
311 311
312 // True when there is a job running. Indicates that new jobs should wait to 312 // True when there is a job running. Indicates that new jobs should wait to
313 // be executed. 313 // be executed.
314 bool job_loop_is_running_; 314 bool job_loop_is_running_;
315 315
316 // Next value that should be assigned as a job id. 316 // Next value that should be assigned as a job id.
(...skipping 24 matching lines...) Expand all
341 341
342 // Whether this instance is initialized or not. 342 // Whether this instance is initialized or not.
343 bool initialized_; 343 bool initialized_;
344 344
345 DISALLOW_COPY_AND_ASSIGN(DriveScheduler); 345 DISALLOW_COPY_AND_ASSIGN(DriveScheduler);
346 }; 346 };
347 347
348 } // namespace drive 348 } // namespace drive
349 349
350 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SCHEDULER_H_ 350 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SCHEDULER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698