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" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // |remote_file_md5| represents the expected hash value of the file to be | 129 // |remote_file_md5| represents the expected hash value of the file to be |
130 // updated on Drive. If |remote_file_md5| is different from the actual value, | 130 // updated on Drive. If |remote_file_md5| is different from the actual value, |
131 // cancels the upload and invokes |callback| with | 131 // cancels the upload and invokes |callback| with |
132 // GDataErrorCode::HTTP_CONFLICT immediately. | 132 // GDataErrorCode::HTTP_CONFLICT immediately. |
133 void UploadExistingFile(const std::string& resource_id, | 133 void UploadExistingFile(const std::string& resource_id, |
134 const std::string& remote_file_md5, | 134 const std::string& remote_file_md5, |
135 const FilePath& local_file_path, | 135 const FilePath& local_file_path, |
136 int64 file_size, | 136 int64 file_size, |
137 const UploadFileCallback& callback); | 137 const UploadFileCallback& callback); |
138 | 138 |
| 139 // Returns true if the user is authenticated. |
| 140 bool IsAuthenticated() const { |
| 141 return drive_service_->HasRefreshToken(); |
| 142 } |
| 143 |
139 // Deletes the file identified by |resource_id|. | 144 // Deletes the file identified by |resource_id|. |
140 // |remote_file_md5| represents the expected hash value of the file to be | 145 // |remote_file_md5| represents the expected hash value of the file to be |
141 // deleted from Drive. If |remote_file_md5| is different from the actual | 146 // deleted from Drive. If |remote_file_md5| is different from the actual |
142 // value, cancels the deletion and invokes |callback| with | 147 // value, cancels the deletion and invokes |callback| with |
143 // GDataErrorCode::HTTP_CONFLICT immediately. | 148 // GDataErrorCode::HTTP_CONFLICT immediately. |
144 void DeleteFile(const std::string& resource_id, | 149 void DeleteFile(const std::string& resource_id, |
145 const std::string& remote_file_md5, | 150 const std::string& remote_file_md5, |
146 const GDataErrorCallback& callback); | 151 const GDataErrorCallback& callback); |
147 | 152 |
148 private: | 153 private: |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 237 |
233 scoped_ptr<google_apis::DriveServiceInterface> drive_service_; | 238 scoped_ptr<google_apis::DriveServiceInterface> drive_service_; |
234 scoped_ptr<google_apis::DriveUploaderInterface> drive_uploader_; | 239 scoped_ptr<google_apis::DriveUploaderInterface> drive_uploader_; |
235 | 240 |
236 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncClient); | 241 DISALLOW_COPY_AND_ASSIGN(DriveFileSyncClient); |
237 }; | 242 }; |
238 | 243 |
239 } // namespace sync_file_system | 244 } // namespace sync_file_system |
240 | 245 |
241 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_CLIENT_H_ | 246 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_FILE_SYNC_CLIENT_H_ |
OLD | NEW |