| 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/chromeos/gdata/gdata.h" | 5 #include "chrome/browser/chromeos/gdata/gdata.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 void DocumentsService::GetAccountMetadata(const GetDataCallback& callback) { | 221 void DocumentsService::GetAccountMetadata(const GetDataCallback& callback) { |
| 222 GetAccountMetadataOperation* operation = | 222 GetAccountMetadataOperation* operation = |
| 223 new GetAccountMetadataOperation(operation_registry_.get(), | 223 new GetAccountMetadataOperation(operation_registry_.get(), |
| 224 profile_, | 224 profile_, |
| 225 callback); | 225 callback); |
| 226 StartOperationOnUIThread(operation); | 226 StartOperationOnUIThread(operation); |
| 227 } | 227 } |
| 228 | 228 |
| 229 void DocumentsService::DownloadDocument( | 229 void DocumentsService::DownloadDocument( |
| 230 const FilePath& virtual_path, | 230 const FilePath& virtual_path, |
| 231 const FilePath& local_cache_path, |
| 231 const GURL& document_url, | 232 const GURL& document_url, |
| 232 DocumentExportFormat format, | 233 DocumentExportFormat format, |
| 233 const DownloadActionCallback& callback) { | 234 const DownloadActionCallback& callback) { |
| 234 DownloadFile( | 235 DownloadFile( |
| 235 virtual_path, | 236 virtual_path, |
| 237 local_cache_path, |
| 236 chrome_browser_net::AppendQueryParameter(document_url, | 238 chrome_browser_net::AppendQueryParameter(document_url, |
| 237 "exportFormat", | 239 "exportFormat", |
| 238 GetExportFormatParam(format)), | 240 GetExportFormatParam(format)), |
| 239 callback); | 241 callback); |
| 240 } | 242 } |
| 241 | 243 |
| 242 void DocumentsService::DownloadFile(const FilePath& virtual_path, | 244 void DocumentsService::DownloadFile(const FilePath& virtual_path, |
| 245 const FilePath& local_cache_path, |
| 243 const GURL& document_url, | 246 const GURL& document_url, |
| 244 const DownloadActionCallback& callback) { | 247 const DownloadActionCallback& callback) { |
| 245 StartOperationOnUIThread( | 248 StartOperationOnUIThread( |
| 246 new DownloadFileOperation(operation_registry_.get(), profile_, callback, | 249 new DownloadFileOperation(operation_registry_.get(), profile_, callback, |
| 247 document_url, virtual_path)); | 250 document_url, virtual_path, local_cache_path)); |
| 248 } | 251 } |
| 249 | 252 |
| 250 void DocumentsService::DeleteDocument(const GURL& document_url, | 253 void DocumentsService::DeleteDocument(const GURL& document_url, |
| 251 const EntryActionCallback& callback) { | 254 const EntryActionCallback& callback) { |
| 252 StartOperationOnUIThread( | 255 StartOperationOnUIThread( |
| 253 new DeleteDocumentOperation(operation_registry_.get(), profile_, callback, | 256 new DeleteDocumentOperation(operation_registry_.get(), profile_, callback, |
| 254 document_url)); | 257 document_url)); |
| 255 } | 258 } |
| 256 | 259 |
| 257 void DocumentsService::CreateDirectory( | 260 void DocumentsService::CreateDirectory( |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 void DocumentsService::RetryOperation(GDataOperationInterface* operation) { | 380 void DocumentsService::RetryOperation(GDataOperationInterface* operation) { |
| 378 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 381 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 379 | 382 |
| 380 gdata_auth_service_->ClearOAuth2Token(); | 383 gdata_auth_service_->ClearOAuth2Token(); |
| 381 // User authentication might have expired - rerun the request to force | 384 // User authentication might have expired - rerun the request to force |
| 382 // auth token refresh. | 385 // auth token refresh. |
| 383 StartOperation(operation); | 386 StartOperation(operation); |
| 384 } | 387 } |
| 385 | 388 |
| 386 } // namespace gdata | 389 } // namespace gdata |
| OLD | NEW |