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

Unified Diff: chrome/browser/chromeos/drive/drive_scheduler.h

Issue 11418127: Pass calls to GetDocuments through the scheduler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/drive/drive_scheduler.h
diff --git a/chrome/browser/chromeos/drive/drive_scheduler.h b/chrome/browser/chromeos/drive/drive_scheduler.h
index 59092fb9098199f40e7acb4450d9bee939251ed7..23ca01838e7fa1eaa84cd510ac5f4ff9a4d41e45 100644
--- a/chrome/browser/chromeos/drive/drive_scheduler.h
+++ b/chrome/browser/chromeos/drive/drive_scheduler.h
@@ -8,6 +8,7 @@
#include "base/memory/linked_ptr.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/chromeos/drive/drive_file_system_interface.h"
+#include "chrome/browser/google_apis/drive_service_interface.h"
#include "net/base/network_change_notifier.h"
#include <deque>
@@ -33,6 +34,7 @@ class DriveScheduler
// Enum representing the type of job.
enum JobType {
TYPE_COPY,
+ TYPE_GET_DOCUMENTS,
TYPE_MOVE,
TYPE_REMOVE,
TYPE_TRANSFER_LOCAL_TO_REMOTE,
@@ -76,6 +78,7 @@ class DriveScheduler
};
DriveScheduler(Profile* profile,
+ google_apis::DriveServiceInterface* drive_service,
file_system::DriveOperations* drive_operations);
virtual ~DriveScheduler();
@@ -88,6 +91,14 @@ class DriveScheduler
const FilePath& dest_file_path,
const FileOperationCallback& callback);
+ // Adds a GetDocuments operation to the queue.
+ void GetDocuments(const GURL& feed_url,
+ int64 start_changestamp,
+ const std::string& search_query,
+ bool shared_with_me,
+ const std::string& directory_resource_id,
+ const google_apis::GetDataCallback& callback);
+
// Adds a transfer operation to the queue.
void TransferFileFromRemoteToLocal(const FilePath& remote_src_file_path,
const FilePath& local_dest_file_path,
@@ -119,8 +130,7 @@ class DriveScheduler
// Represents a single entry in the job queue.
struct QueueEntry {
QueueEntry(JobType in_job_type,
- FilePath in_file_path,
- FileOperationCallback in_callback);
+ FilePath in_file_path);
~QueueEntry();
JobInfo job_info;
@@ -133,7 +143,7 @@ class DriveScheduler
// TYPE_TRANSFER_LOCAL_TO_REMOTE,
// TYPE_TRANSFER_REGULAR_FILE,
// TYPE_TRANSFER_REMOTE_TO_LOCAL
- FileOperationCallback callback;
+ FileOperationCallback file_operation_callback;
// Destination of the operation.
// Used by:
@@ -144,8 +154,18 @@ class DriveScheduler
// TYPE_TRANSFER_REMOTE_TO_LOCAL
FilePath dest_file_path;
- // Whether the operation is recursive. Used by: TYPE_REMOVE
+ // Whether the operation is recursive. Used by:
+ // TYPE_REMOVE
bool is_recursive;
+
+ // Parameters for GetDocuments(). Used by:
+ // TYPE_GET_DOCUMENTS
+ GURL feed_url;
+ int64 start_changestamp;
+ std::string search_query;
+ bool shared_with_me;
+ std::string directory_resource_id;
+ google_apis::GetDataCallback get_data_callback;
};
// Adds the specified job to the queue. Takes ownership of |job|
@@ -170,9 +190,17 @@ class DriveScheduler
// Resets the throttle delay to the initial value, and continues the job loop.
void ResetThrottleAndContinueJobLoop();
- // Callback for job finishing. Retries the job if needed, otherwise cleans up
- // the job, invokes the callback, and continues the job loop.
- void OnJobDone(int job_id, DriveFileError error);
+ // Retries the job if needed, otherwise cleans up the job, invokes the
+ // callback, and continues the job loop.
+ scoped_ptr<QueueEntry> OnJobDone(int job_id, DriveFileError error);
+
+ // Callback for job finishing with a FileOperationCallback.
+ void OnFileOperationJobDone(int job_id, DriveFileError error);
+
+ // Callback for job finishing with a GetDataCallback.
+ void OnGetDataJobDone(int job_id,
+ google_apis::GDataErrorCode error,
+ scoped_ptr<base::Value> feed_data);
// net::NetworkChangeNotifier::ConnectionTypeObserver override.
virtual void OnConnectionTypeChanged(
@@ -206,6 +234,8 @@ class DriveScheduler
// Drive operations.
file_system::DriveOperations* drive_operations_;
+ google_apis::DriveServiceInterface* drive_service_;
+
Profile* profile_;
// Note: This should remain the last member so it'll be destroyed and
« no previous file with comments | « chrome/browser/chromeos/drive/drive_file_system.cc ('k') | chrome/browser/chromeos/drive/drive_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698