| 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 #include "chrome/browser/google_apis/gdata_wapi_service.h" | 5 #include "chrome/browser/google_apis/gdata_wapi_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 const gdata::GetDataCallback& callback) { | 178 const gdata::GetDataCallback& callback) { |
| 179 // For WAPI, AccountMetadata includes Drive application information. | 179 // For WAPI, AccountMetadata includes Drive application information. |
| 180 GetAccountMetadata(callback); | 180 GetAccountMetadata(callback); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void GDataWapiService::DownloadDocument( | 183 void GDataWapiService::DownloadDocument( |
| 184 const FilePath& virtual_path, | 184 const FilePath& virtual_path, |
| 185 const FilePath& local_cache_path, | 185 const FilePath& local_cache_path, |
| 186 const GURL& document_url, | 186 const GURL& document_url, |
| 187 DocumentExportFormat format, | 187 DocumentExportFormat format, |
| 188 const std::string& etag, |
| 188 const gdata::DownloadActionCallback& callback) { | 189 const gdata::DownloadActionCallback& callback) { |
| 189 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 190 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 190 | 191 |
| 191 DownloadFile( | 192 DownloadFile( |
| 192 virtual_path, | 193 virtual_path, |
| 193 local_cache_path, | 194 local_cache_path, |
| 194 chrome_common_net::AppendQueryParameter(document_url, | 195 chrome_common_net::AppendQueryParameter(document_url, |
| 195 "exportFormat", | 196 "exportFormat", |
| 196 GetExportFormatParam(format)), | 197 GetExportFormatParam(format)), |
| 198 etag, |
| 197 callback, | 199 callback, |
| 198 gdata::GetContentCallback()); | 200 gdata::GetContentCallback()); |
| 199 } | 201 } |
| 200 | 202 |
| 201 void GDataWapiService::DownloadFile( | 203 void GDataWapiService::DownloadFile( |
| 202 const FilePath& virtual_path, | 204 const FilePath& virtual_path, |
| 203 const FilePath& local_cache_path, | 205 const FilePath& local_cache_path, |
| 204 const GURL& document_url, | 206 const GURL& document_url, |
| 207 const std::string& etag, |
| 205 const gdata::DownloadActionCallback& download_action_callback, | 208 const gdata::DownloadActionCallback& download_action_callback, |
| 206 const gdata::GetContentCallback& get_content_callback) { | 209 const gdata::GetContentCallback& get_content_callback) { |
| 207 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 210 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 208 | 211 |
| 209 runner_->StartOperationWithRetry( | 212 runner_->StartOperationWithRetry( |
| 210 new gdata::DownloadFileOperation(operation_registry(), | 213 new gdata::DownloadFileOperation(operation_registry(), |
| 211 download_action_callback, | 214 download_action_callback, |
| 212 get_content_callback, document_url, | 215 get_content_callback, document_url, |
| 213 virtual_path, local_cache_path)); | 216 virtual_path, local_cache_path, |
| 217 etag)); |
| 214 } | 218 } |
| 215 | 219 |
| 216 void GDataWapiService::DeleteDocument( | 220 void GDataWapiService::DeleteDocument( |
| 217 const GURL& document_url, | 221 const GURL& document_url, |
| 222 const std::string& etag, |
| 218 const gdata::EntryActionCallback& callback) { | 223 const gdata::EntryActionCallback& callback) { |
| 219 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 224 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 220 | 225 |
| 221 runner_->StartOperationWithRetry( | 226 runner_->StartOperationWithRetry( |
| 222 new gdata::DeleteDocumentOperation(operation_registry(), callback, | 227 new gdata::DeleteDocumentOperation(operation_registry(), callback, |
| 223 document_url)); | 228 document_url, etag)); |
| 224 } | 229 } |
| 225 | 230 |
| 226 void GDataWapiService::CreateDirectory( | 231 void GDataWapiService::CreateDirectory( |
| 227 const GURL& parent_content_url, | 232 const GURL& parent_content_url, |
| 228 const FilePath::StringType& directory_name, | 233 const FilePath::StringType& directory_name, |
| 229 const gdata::GetDataCallback& callback) { | 234 const gdata::GetDataCallback& callback) { |
| 230 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 235 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 231 | 236 |
| 232 runner_->StartOperationWithRetry( | 237 runner_->StartOperationWithRetry( |
| 233 new gdata::CreateDirectoryOperation(operation_registry(), callback, | 238 new gdata::CreateDirectoryOperation(operation_registry(), callback, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 DriveServiceObserver, observers_, OnProgressUpdate(list)); | 355 DriveServiceObserver, observers_, OnProgressUpdate(list)); |
| 351 } | 356 } |
| 352 | 357 |
| 353 void GDataWapiService::OnAuthenticationFailed(gdata::GDataErrorCode error) { | 358 void GDataWapiService::OnAuthenticationFailed(gdata::GDataErrorCode error) { |
| 354 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 359 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 355 FOR_EACH_OBSERVER( | 360 FOR_EACH_OBSERVER( |
| 356 DriveServiceObserver, observers_, OnAuthenticationFailed(error)); | 361 DriveServiceObserver, observers_, OnAuthenticationFailed(error)); |
| 357 } | 362 } |
| 358 | 363 |
| 359 } // namespace drive | 364 } // namespace drive |
| OLD | NEW |