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

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

Issue 11280140: Pass calls to GetApplicationInfo through the scheduler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test 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 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"
(...skipping 15 matching lines...) Expand all
26 // concurrency as appropriate. 26 // concurrency as appropriate.
27 // 27 //
28 // TODO(zork): Provide an interface for querying the number of jobs, and state 28 // TODO(zork): Provide an interface for querying the number of jobs, and state
29 // of each. See: crbug.com/154243 29 // of each. See: crbug.com/154243
30 class DriveScheduler 30 class DriveScheduler
31 : public net::NetworkChangeNotifier::ConnectionTypeObserver { 31 : public net::NetworkChangeNotifier::ConnectionTypeObserver {
32 public: 32 public:
33 33
34 // Enum representing the type of job. 34 // Enum representing the type of job.
35 enum JobType { 35 enum JobType {
36 TYPE_GET_APPLICATION_INFO,
36 TYPE_COPY, 37 TYPE_COPY,
37 TYPE_GET_DOCUMENTS, 38 TYPE_GET_DOCUMENTS,
38 TYPE_MOVE, 39 TYPE_MOVE,
39 TYPE_REMOVE, 40 TYPE_REMOVE,
40 TYPE_TRANSFER_LOCAL_TO_REMOTE, 41 TYPE_TRANSFER_LOCAL_TO_REMOTE,
41 TYPE_TRANSFER_REGULAR_FILE, 42 TYPE_TRANSFER_REGULAR_FILE,
42 TYPE_TRANSFER_REMOTE_TO_LOCAL, 43 TYPE_TRANSFER_REMOTE_TO_LOCAL,
43 }; 44 };
44 45
45 // Current state of the job. 46 // Current state of the job.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 80
80 DriveScheduler(Profile* profile, 81 DriveScheduler(Profile* profile,
81 google_apis::DriveServiceInterface* drive_service, 82 google_apis::DriveServiceInterface* drive_service,
82 file_system::DriveOperations* drive_operations); 83 file_system::DriveOperations* drive_operations);
83 virtual ~DriveScheduler(); 84 virtual ~DriveScheduler();
84 85
85 // Initializes the object. This function should be called before any 86 // Initializes the object. This function should be called before any
86 // other functions. 87 // other functions.
87 void Initialize(); 88 void Initialize();
88 89
90 // Adds a GetApplicationInfo operation to the queue.
91 void GetApplicationInfo(const google_apis::GetDataCallback& callback);
92
89 // Adds a copy operation to the queue. 93 // Adds a copy operation to the queue.
90 void Copy(const FilePath& src_file_path, 94 void Copy(const FilePath& src_file_path,
91 const FilePath& dest_file_path, 95 const FilePath& dest_file_path,
92 const FileOperationCallback& callback); 96 const FileOperationCallback& callback);
93 97
94 // Adds a GetDocuments operation to the queue. 98 // Adds a GetDocuments operation to the queue.
95 void GetDocuments(const GURL& feed_url, 99 void GetDocuments(const GURL& feed_url,
96 int64 start_changestamp, 100 int64 start_changestamp,
97 const std::string& search_query, 101 const std::string& search_query,
98 bool shared_with_me, 102 bool shared_with_me,
(...skipping 29 matching lines...) Expand all
128 friend class DriveSchedulerTest; 132 friend class DriveSchedulerTest;
129 133
130 // Represents a single entry in the job queue. 134 // Represents a single entry in the job queue.
131 struct QueueEntry { 135 struct QueueEntry {
132 QueueEntry(JobType in_job_type, 136 QueueEntry(JobType in_job_type,
133 FilePath in_file_path); 137 FilePath in_file_path);
134 ~QueueEntry(); 138 ~QueueEntry();
135 139
136 JobInfo job_info; 140 JobInfo job_info;
137 141
138 // Callback for when the operation completes. 142 // Callback for operations that take a FileOperationCallback.
139 // Used by: 143 // Used by:
140 // TYPE_COPY, 144 // TYPE_COPY,
141 // TYPE_MOVE, 145 // TYPE_MOVE,
142 // TYPE_REMOVE, 146 // TYPE_REMOVE,
143 // TYPE_TRANSFER_LOCAL_TO_REMOTE, 147 // TYPE_TRANSFER_LOCAL_TO_REMOTE,
144 // TYPE_TRANSFER_REGULAR_FILE, 148 // TYPE_TRANSFER_REGULAR_FILE,
145 // TYPE_TRANSFER_REMOTE_TO_LOCAL 149 // TYPE_TRANSFER_REMOTE_TO_LOCAL
146 FileOperationCallback file_operation_callback; 150 FileOperationCallback file_operation_callback;
147 151
148 // Destination of the operation. 152 // Destination of the operation.
149 // Used by: 153 // Used by:
150 // TYPE_COPY, 154 // TYPE_COPY,
151 // TYPE_MOVE, 155 // TYPE_MOVE,
152 // TYPE_TRANSFER_LOCAL_TO_REMOTE, 156 // TYPE_TRANSFER_LOCAL_TO_REMOTE,
153 // TYPE_TRANSFER_REGULAR_FILE, 157 // TYPE_TRANSFER_REGULAR_FILE,
154 // TYPE_TRANSFER_REMOTE_TO_LOCAL 158 // TYPE_TRANSFER_REMOTE_TO_LOCAL
155 FilePath dest_file_path; 159 FilePath dest_file_path;
156 160
157 // Whether the operation is recursive. Used by: 161 // Whether the operation is recursive.
162 // Used by:
158 // TYPE_REMOVE 163 // TYPE_REMOVE
159 bool is_recursive; 164 bool is_recursive;
160 165
161 // Parameters for GetDocuments(). Used by: 166 // Parameters for GetDocuments().
167 // Used by:
162 // TYPE_GET_DOCUMENTS 168 // TYPE_GET_DOCUMENTS
163 GURL feed_url; 169 GURL feed_url;
164 int64 start_changestamp; 170 int64 start_changestamp;
165 std::string search_query; 171 std::string search_query;
166 bool shared_with_me; 172 bool shared_with_me;
167 std::string directory_resource_id; 173 std::string directory_resource_id;
174
175 // Callback for operations that take a GetDataCallback.
176 // Used by:
177 // TYPE_GET_APPLICATION_INFO
178 // TYPE_GET_DOCUMENTS
168 google_apis::GetDataCallback get_data_callback; 179 google_apis::GetDataCallback get_data_callback;
169 }; 180 };
170 181
171 // Adds the specified job to the queue. Takes ownership of |job| 182 // Adds the specified job to the queue. Takes ownership of |job|
172 int QueueJob(scoped_ptr<QueueEntry> job); 183 int QueueJob(scoped_ptr<QueueEntry> job);
173 184
174 // Starts the job loop, if it is not already running. 185 // Starts the job loop, if it is not already running.
175 void StartJobLoop(); 186 void StartJobLoop();
176 187
177 // Determines the next job that should run, and starts it. 188 // Determines the next job that should run, and starts it.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 255
245 // Whether this instance is initialized or not. 256 // Whether this instance is initialized or not.
246 bool initialized_; 257 bool initialized_;
247 258
248 DISALLOW_COPY_AND_ASSIGN(DriveScheduler); 259 DISALLOW_COPY_AND_ASSIGN(DriveScheduler);
249 }; 260 };
250 261
251 } // namespace drive 262 } // namespace drive
252 263
253 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SCHEDULER_H_ 264 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_SCHEDULER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_feed_loader.cc ('k') | chrome/browser/chromeos/drive/drive_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698