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

Side by Side Diff: chrome/browser/drive/fake_drive_service.h

Issue 17140009: Support contents upload on FakeDriveService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: +completion callback Created 7 years, 6 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_DRIVE_FAKE_DRIVE_SERVICE_H_ 5 #ifndef CHROME_BROWSER_DRIVE_FAKE_DRIVE_SERVICE_H_
6 #define CHROME_BROWSER_DRIVE_FAKE_DRIVE_SERVICE_H_ 6 #define CHROME_BROWSER_DRIVE_FAKE_DRIVE_SERVICE_H_
7 7
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/drive/drive_service_interface.h" 10 #include "chrome/browser/drive/drive_service_interface.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 // Sets the last modified time for an entry specified by |resource_id|. 205 // Sets the last modified time for an entry specified by |resource_id|.
206 // On success, returns HTTP_SUCCESS with the parsed entry. 206 // On success, returns HTTP_SUCCESS with the parsed entry.
207 // |callback| must not be null. 207 // |callback| must not be null.
208 void SetLastModifiedTime( 208 void SetLastModifiedTime(
209 const std::string& resource_id, 209 const std::string& resource_id,
210 const base::Time& last_modified_time, 210 const base::Time& last_modified_time,
211 const google_apis::GetResourceEntryCallback& callback); 211 const google_apis::GetResourceEntryCallback& callback);
212 212
213 private: 213 private:
214 struct UploadSession;
215
214 // Returns a pointer to the entry that matches |resource_id|, or NULL if 216 // Returns a pointer to the entry that matches |resource_id|, or NULL if
215 // not found. 217 // not found.
216 base::DictionaryValue* FindEntryByResourceId(const std::string& resource_id); 218 base::DictionaryValue* FindEntryByResourceId(const std::string& resource_id);
217 219
218 // Returns a pointer to the entry that matches |content_url|, or NULL if 220 // Returns a pointer to the entry that matches |content_url|, or NULL if
219 // not found. 221 // not found.
220 base::DictionaryValue* FindEntryByContentUrl(const GURL& content_url); 222 base::DictionaryValue* FindEntryByContentUrl(const GURL& content_url);
221 223
222 // Returns a pointer to the entry that matches |upload_url|, or NULL if
223 // not found.
224 base::DictionaryValue* FindEntryByUploadUrl(const GURL& upload_url);
225
226 // Returns a new resource ID, which looks like "resource_id_<num>" where 224 // Returns a new resource ID, which looks like "resource_id_<num>" where
227 // <num> is a monotonically increasing number starting from 1. 225 // <num> is a monotonically increasing number starting from 1.
228 std::string GetNewResourceId(); 226 std::string GetNewResourceId();
229 227
230 // Increments |largest_changestamp_| and adds the new changestamp to 228 // Increments |largest_changestamp_| and adds the new changestamp and ETag to
231 // |entry|. 229 // |entry|.
232 void AddNewChangestamp(base::DictionaryValue* entry); 230 void AddNewChangestampAndETag(base::DictionaryValue* entry);
233 231
234 // Adds a new entry based on the given parameters. |entry_kind| should be 232 // Adds a new entry based on the given parameters. |entry_kind| should be
235 // "file" or "folder". Returns a pointer to the newly added entry, or NULL 233 // "file" or "folder". Returns a pointer to the newly added entry, or NULL
236 // if failed. 234 // if failed.
237 const base::DictionaryValue* AddNewEntry( 235 const base::DictionaryValue* AddNewEntry(
238 const std::string& content_type, 236 const std::string& content_type,
239 const std::string& content_data, 237 const std::string& content_data,
240 const std::string& parent_resource_id, 238 const std::string& parent_resource_id,
241 const std::string& title, 239 const std::string& title,
242 bool shared_with_me, 240 bool shared_with_me,
243 const std::string& entry_kind); 241 const std::string& entry_kind);
244 242
245 // Core implementation of GetResourceList. 243 // Core implementation of GetResourceList.
246 // This method returns the slice of the all matched entries, and its range 244 // This method returns the slice of the all matched entries, and its range
247 // is between |start_offset| (inclusive) and |start_offset| + |max_results| 245 // is between |start_offset| (inclusive) and |start_offset| + |max_results|
248 // (exclusive). 246 // (exclusive).
249 // Increments *load_counter by 1 before it returns successfully. 247 // Increments *load_counter by 1 before it returns successfully.
250 void GetResourceListInternal( 248 void GetResourceListInternal(
251 int64 start_changestamp, 249 int64 start_changestamp,
252 const std::string& search_query, 250 const std::string& search_query,
253 const std::string& directory_resource_id, 251 const std::string& directory_resource_id,
254 int start_offset, 252 int start_offset,
255 int max_results, 253 int max_results,
256 int* load_counter, 254 int* load_counter,
257 const google_apis::GetResourceListCallback& callback); 255 const google_apis::GetResourceListCallback& callback);
258 256
257 // Returns new upload session URL.
258 GURL GetNewUploadSessionUrl();
259
259 scoped_ptr<base::DictionaryValue> resource_list_value_; 260 scoped_ptr<base::DictionaryValue> resource_list_value_;
260 scoped_ptr<base::Value> account_metadata_value_; 261 scoped_ptr<base::Value> account_metadata_value_;
261 scoped_ptr<base::Value> app_info_value_; 262 scoped_ptr<base::Value> app_info_value_;
263 std::map<GURL, UploadSession> upload_sessions_;
262 int64 largest_changestamp_; 264 int64 largest_changestamp_;
263 int64 published_date_seq_; 265 int64 published_date_seq_;
266 int64 next_upload_sequence_number_;
264 int default_max_results_; 267 int default_max_results_;
265 int resource_id_count_; 268 int resource_id_count_;
266 int resource_list_load_count_; 269 int resource_list_load_count_;
267 int change_list_load_count_; 270 int change_list_load_count_;
268 int directory_load_count_; 271 int directory_load_count_;
269 int about_resource_load_count_; 272 int about_resource_load_count_;
270 bool offline_; 273 bool offline_;
271 base::FilePath last_cancelled_file_; 274 base::FilePath last_cancelled_file_;
272 275
273 DISALLOW_COPY_AND_ASSIGN(FakeDriveService); 276 DISALLOW_COPY_AND_ASSIGN(FakeDriveService);
274 }; 277 };
275 278
276 } // namespace drive 279 } // namespace drive
277 280
278 #endif // CHROME_BROWSER_DRIVE_FAKE_DRIVE_SERVICE_H_ 281 #endif // CHROME_BROWSER_DRIVE_FAKE_DRIVE_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/drive/fake_drive_service.cc » ('j') | chrome/browser/drive/fake_drive_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698