OLD | NEW |
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 144 |
144 // Deletes the file identified by |resource_id|. | 145 // Deletes the file identified by |resource_id|. |
145 // |remote_file_md5| represents the expected hash value of the file to be | 146 // |remote_file_md5| represents the expected hash value of the file to be |
146 // deleted from Drive. If |remote_file_md5| is different from the actual | 147 // deleted from Drive. If |remote_file_md5| is different from the actual |
147 // value, cancels the deletion and invokes |callback| with | 148 // value, cancels the deletion and invokes |callback| with |
148 // GDataErrorCode::HTTP_CONFLICT immediately. | 149 // GDataErrorCode::HTTP_CONFLICT immediately. |
149 void DeleteFile(const std::string& resource_id, | 150 void DeleteFile(const std::string& resource_id, |
150 const std::string& remote_file_md5, | 151 const std::string& remote_file_md5, |
151 const GDataErrorCallback& callback); | 152 const GDataErrorCallback& callback); |
152 | 153 |
| 154 static std::string OriginToDirectoryTitle(const GURL& origin); |
| 155 static GURL DirectoryTitleToOrigin(const std::string& title); |
| 156 |
| 157 // Convers |resource_id| to corresponing resource link. |
| 158 GURL ResourceIdToResourceLink(const std::string& resource_id) const; |
| 159 |
153 private: | 160 private: |
154 friend class DriveFileSyncClientTest; | 161 friend class DriveFileSyncClientTest; |
155 friend class DriveFileSyncServiceTest; | 162 friend class DriveFileSyncServiceTest; |
156 | 163 |
157 // Constructor for test use. | 164 // Constructor for test use. |
158 DriveFileSyncClient( | 165 DriveFileSyncClient( |
159 Profile* profile, | 166 Profile* profile, |
160 scoped_ptr<google_apis::DriveServiceInterface> drive_service, | 167 scoped_ptr<google_apis::DriveServiceInterface> drive_service, |
161 scoped_ptr<google_apis::DriveUploaderInterface> drive_uploader); | 168 scoped_ptr<google_apis::DriveUploaderInterface> drive_uploader); |
162 | 169 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 google_apis::GDataErrorCode error, | 237 google_apis::GDataErrorCode error, |
231 scoped_ptr<google_apis::DocumentEntry> entry); | 238 scoped_ptr<google_apis::DocumentEntry> entry); |
232 | 239 |
233 void DidDeleteFile(const GDataErrorCallback& callback, | 240 void DidDeleteFile(const GDataErrorCallback& callback, |
234 google_apis::GDataErrorCode error); | 241 google_apis::GDataErrorCode error); |
235 | 242 |
236 static std::string FormatTitleQuery(const std::string& title); | 243 static std::string FormatTitleQuery(const std::string& title); |
237 | 244 |
238 scoped_ptr<google_apis::DriveServiceInterface> drive_service_; | 245 scoped_ptr<google_apis::DriveServiceInterface> drive_service_; |
239 scoped_ptr<google_apis::DriveUploaderInterface> drive_uploader_; | 246 scoped_ptr<google_apis::DriveUploaderInterface> drive_uploader_; |
| 247 google_apis::GDataWapiUrlGenerator url_generator_; |
240 | 248 |
241 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncClient); | 249 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncClient); |
242 }; | 250 }; |
243 | 251 |
244 } // namespace sync_file_system | 252 } // namespace sync_file_system |
245 | 253 |
246 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_CLIENT_H_ | 254 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_CLIENT_H_ |
OLD | NEW |