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

Side by Side Diff: chrome/browser/sync_file_system/drive_file_sync_client.h

Issue 11421125: Implement polling part of DriveFileSyncService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/NotifyRemoteChangeAvailable/NotifyRemoteChangeQueueUpdated/ 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_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_CLIENT_H_ 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_CLIENT_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_CLIENT_H_ 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/threading/non_thread_safe.h" 13 #include "base/threading/non_thread_safe.h"
14 #include "chrome/browser/google_apis/drive_service_interface.h" 14 #include "chrome/browser/google_apis/drive_service_interface.h"
15 #include "chrome/browser/google_apis/drive_upload_error.h" 15 #include "chrome/browser/google_apis/drive_upload_error.h"
16 #include "chrome/browser/google_apis/gdata_errorcode.h" 16 #include "chrome/browser/google_apis/gdata_errorcode.h"
17 #include "chrome/browser/google_apis/gdata_wapi_parser.h" 17 #include "chrome/browser/google_apis/gdata_wapi_parser.h"
18 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h"
18 19
19 class GURL; 20 class GURL;
20 class Profile; 21 class Profile;
21 22
22 namespace google_apis { 23 namespace google_apis {
23 class DriveUploaderInterface; 24 class DriveUploaderInterface;
24 } 25 }
25 26
26 namespace sync_file_system { 27 namespace sync_file_system {
27 28
(...skipping 22 matching lines...) Expand all
50 DocumentFeedCallback; 51 DocumentFeedCallback;
51 typedef base::Callback<void(google_apis::GDataErrorCode error, 52 typedef base::Callback<void(google_apis::GDataErrorCode error,
52 scoped_ptr<google_apis::DocumentEntry> entry)> 53 scoped_ptr<google_apis::DocumentEntry> entry)>
53 DocumentEntryCallback; 54 DocumentEntryCallback;
54 55
55 explicit DriveFileSyncClient(Profile* profile); 56 explicit DriveFileSyncClient(Profile* profile);
56 virtual ~DriveFileSyncClient(); 57 virtual ~DriveFileSyncClient();
57 58
58 static scoped_ptr<DriveFileSyncClient> CreateForTesting( 59 static scoped_ptr<DriveFileSyncClient> CreateForTesting(
59 Profile* profile, 60 Profile* profile,
61 const GURL& base_url,
60 scoped_ptr<google_apis::DriveServiceInterface> drive_service, 62 scoped_ptr<google_apis::DriveServiceInterface> drive_service,
61 scoped_ptr<google_apis::DriveUploaderInterface> drive_uploader); 63 scoped_ptr<google_apis::DriveUploaderInterface> drive_uploader);
62 64
63 // Fetches Resource ID of the directory where we should place all files to 65 // Fetches Resource ID of the directory where we should place all files to
64 // sync. Upon completion, invokes |callback|. 66 // sync. Upon completion, invokes |callback|.
65 // If the directory does not exist on the server this also creates 67 // If the directory does not exist on the server this also creates
66 // the directory. 68 // the directory.
67 void GetDriveDirectoryForSyncRoot(const ResourceIdCallback& callback); 69 void GetDriveDirectoryForSyncRoot(const ResourceIdCallback& callback);
68 70
69 // Fetches Resource ID of the directory for the |origin|. 71 // Fetches Resource ID of the directory for the |origin|.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 // deleted from Drive. If |remote_file_md5| is different from the actual 148 // deleted from Drive. If |remote_file_md5| is different from the actual
147 // value, cancels the deletion and invokes |callback| with 149 // value, cancels the deletion and invokes |callback| with
148 // GDataErrorCode::HTTP_CONFLICT immediately. 150 // GDataErrorCode::HTTP_CONFLICT immediately.
149 void DeleteFile(const std::string& resource_id, 151 void DeleteFile(const std::string& resource_id,
150 const std::string& remote_file_md5, 152 const std::string& remote_file_md5,
151 const GDataErrorCallback& callback); 153 const GDataErrorCallback& callback);
152 154
153 static std::string OriginToDirectoryTitle(const GURL& origin); 155 static std::string OriginToDirectoryTitle(const GURL& origin);
154 static GURL DirectoryTitleToOrigin(const std::string& title); 156 static GURL DirectoryTitleToOrigin(const std::string& title);
155 157
158 // Convers |resource_id| to corresponing resource link.
nhiroki 2012/12/04 07:06:01 nit: s/Convers/Converts/
tzik 2012/12/04 07:07:46 Done.
159 GURL ResourceIdToResourceLink(const std::string& resource_id) const;
160
156 private: 161 private:
157 friend class DriveFileSyncClientTest; 162 friend class DriveFileSyncClientTest;
158 friend class DriveFileSyncServiceTest; 163 friend class DriveFileSyncServiceTest;
159 164
160 // Constructor for test use. 165 // Constructor for test use.
161 DriveFileSyncClient( 166 DriveFileSyncClient(
162 Profile* profile, 167 Profile* profile,
168 const GURL& base_url,
163 scoped_ptr<google_apis::DriveServiceInterface> drive_service, 169 scoped_ptr<google_apis::DriveServiceInterface> drive_service,
164 scoped_ptr<google_apis::DriveUploaderInterface> drive_uploader); 170 scoped_ptr<google_apis::DriveUploaderInterface> drive_uploader);
165 171
166 void DidGetDirectory(const std::string& parent_resource_id, 172 void DidGetDirectory(const std::string& parent_resource_id,
167 const std::string& directory_name, 173 const std::string& directory_name,
168 const ResourceIdCallback& callback, 174 const ResourceIdCallback& callback,
169 google_apis::GDataErrorCode error, 175 google_apis::GDataErrorCode error,
170 scoped_ptr<google_apis::DocumentFeed> feed); 176 scoped_ptr<google_apis::DocumentFeed> feed);
171 177
172 void DidGetParentDirectoryForCreateDirectory( 178 void DidGetParentDirectoryForCreateDirectory(
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 google_apis::GDataErrorCode error, 239 google_apis::GDataErrorCode error,
234 scoped_ptr<google_apis::DocumentEntry> entry); 240 scoped_ptr<google_apis::DocumentEntry> entry);
235 241
236 void DidDeleteFile(const GDataErrorCallback& callback, 242 void DidDeleteFile(const GDataErrorCallback& callback,
237 google_apis::GDataErrorCode error); 243 google_apis::GDataErrorCode error);
238 244
239 static std::string FormatTitleQuery(const std::string& title); 245 static std::string FormatTitleQuery(const std::string& title);
240 246
241 scoped_ptr<google_apis::DriveServiceInterface> drive_service_; 247 scoped_ptr<google_apis::DriveServiceInterface> drive_service_;
242 scoped_ptr<google_apis::DriveUploaderInterface> drive_uploader_; 248 scoped_ptr<google_apis::DriveUploaderInterface> drive_uploader_;
249 google_apis::GDataWapiUrlGenerator url_generator_;
243 250
244 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncClient); 251 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncClient);
245 }; 252 };
246 253
247 } // namespace sync_file_system 254 } // namespace sync_file_system
248 255
249 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_CLIENT_H_ 256 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698