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/drive/gdata_wapi_service.h" | 5 #include "chrome/browser/drive/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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 DCHECK(!download_action_callback.is_null()); | 317 DCHECK(!download_action_callback.is_null()); |
318 // get_content_callback and progress_callback may be null. | 318 // get_content_callback and progress_callback may be null. |
319 | 319 |
320 return sender_->StartRequestWithRetry( | 320 return sender_->StartRequestWithRetry( |
321 new DownloadFileRequest(sender_.get(), | 321 new DownloadFileRequest(sender_.get(), |
322 url_request_context_getter_, | 322 url_request_context_getter_, |
323 download_action_callback, | 323 download_action_callback, |
324 get_content_callback, | 324 get_content_callback, |
325 progress_callback, | 325 progress_callback, |
326 download_url, | 326 download_url, |
327 virtual_path, | |
328 local_cache_path)); | 327 local_cache_path)); |
329 } | 328 } |
330 | 329 |
331 CancelCallback GDataWapiService::DeleteResource( | 330 CancelCallback GDataWapiService::DeleteResource( |
332 const std::string& resource_id, | 331 const std::string& resource_id, |
333 const std::string& etag, | 332 const std::string& etag, |
334 const EntryActionCallback& callback) { | 333 const EntryActionCallback& callback) { |
335 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 334 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
336 DCHECK(!callback.is_null()); | 335 DCHECK(!callback.is_null()); |
337 | 336 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 const InitiateUploadCallback& callback) { | 468 const InitiateUploadCallback& callback) { |
470 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 469 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
471 DCHECK(!callback.is_null()); | 470 DCHECK(!callback.is_null()); |
472 DCHECK(!parent_resource_id.empty()); | 471 DCHECK(!parent_resource_id.empty()); |
473 | 472 |
474 return sender_->StartRequestWithRetry( | 473 return sender_->StartRequestWithRetry( |
475 new InitiateUploadNewFileRequest(sender_.get(), | 474 new InitiateUploadNewFileRequest(sender_.get(), |
476 url_request_context_getter_, | 475 url_request_context_getter_, |
477 url_generator_, | 476 url_generator_, |
478 callback, | 477 callback, |
479 drive_file_path, | |
480 content_type, | 478 content_type, |
481 content_length, | 479 content_length, |
482 parent_resource_id, | 480 parent_resource_id, |
483 title)); | 481 title)); |
484 } | 482 } |
485 | 483 |
486 CancelCallback GDataWapiService::InitiateUploadExistingFile( | 484 CancelCallback GDataWapiService::InitiateUploadExistingFile( |
487 const base::FilePath& drive_file_path, | 485 const base::FilePath& drive_file_path, |
488 const std::string& content_type, | 486 const std::string& content_type, |
489 int64 content_length, | 487 int64 content_length, |
490 const std::string& resource_id, | 488 const std::string& resource_id, |
491 const std::string& etag, | 489 const std::string& etag, |
492 const InitiateUploadCallback& callback) { | 490 const InitiateUploadCallback& callback) { |
493 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 491 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
494 DCHECK(!callback.is_null()); | 492 DCHECK(!callback.is_null()); |
495 DCHECK(!resource_id.empty()); | 493 DCHECK(!resource_id.empty()); |
496 | 494 |
497 return sender_->StartRequestWithRetry( | 495 return sender_->StartRequestWithRetry( |
498 new InitiateUploadExistingFileRequest(sender_.get(), | 496 new InitiateUploadExistingFileRequest(sender_.get(), |
499 url_request_context_getter_, | 497 url_request_context_getter_, |
500 url_generator_, | 498 url_generator_, |
501 callback, | 499 callback, |
502 drive_file_path, | |
503 content_type, | 500 content_type, |
504 content_length, | 501 content_length, |
505 resource_id, | 502 resource_id, |
506 etag)); | 503 etag)); |
507 } | 504 } |
508 | 505 |
509 CancelCallback GDataWapiService::ResumeUpload( | 506 CancelCallback GDataWapiService::ResumeUpload( |
510 const base::FilePath& drive_file_path, | 507 const base::FilePath& drive_file_path, |
511 const GURL& upload_url, | 508 const GURL& upload_url, |
512 int64 start_position, | 509 int64 start_position, |
513 int64 end_position, | 510 int64 end_position, |
514 int64 content_length, | 511 int64 content_length, |
515 const std::string& content_type, | 512 const std::string& content_type, |
516 const base::FilePath& local_file_path, | 513 const base::FilePath& local_file_path, |
517 const UploadRangeCallback& callback, | 514 const UploadRangeCallback& callback, |
518 const ProgressCallback& progress_callback) { | 515 const ProgressCallback& progress_callback) { |
519 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 516 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
520 DCHECK(!callback.is_null()); | 517 DCHECK(!callback.is_null()); |
521 | 518 |
522 return sender_->StartRequestWithRetry( | 519 return sender_->StartRequestWithRetry( |
523 new ResumeUploadRequest(sender_.get(), | 520 new ResumeUploadRequest(sender_.get(), |
524 url_request_context_getter_, | 521 url_request_context_getter_, |
525 callback, | 522 callback, |
526 progress_callback, | 523 progress_callback, |
527 drive_file_path, | |
528 upload_url, | 524 upload_url, |
529 start_position, | 525 start_position, |
530 end_position, | 526 end_position, |
531 content_length, | 527 content_length, |
532 content_type, | 528 content_type, |
533 local_file_path)); | 529 local_file_path)); |
534 } | 530 } |
535 | 531 |
536 CancelCallback GDataWapiService::GetUploadStatus( | 532 CancelCallback GDataWapiService::GetUploadStatus( |
537 const base::FilePath& drive_file_path, | 533 const base::FilePath& drive_file_path, |
538 const GURL& upload_url, | 534 const GURL& upload_url, |
539 int64 content_length, | 535 int64 content_length, |
540 const UploadRangeCallback& callback) { | 536 const UploadRangeCallback& callback) { |
541 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 537 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
542 DCHECK(!callback.is_null()); | 538 DCHECK(!callback.is_null()); |
543 | 539 |
544 return sender_->StartRequestWithRetry( | 540 return sender_->StartRequestWithRetry( |
545 new GetUploadStatusRequest(sender_.get(), | 541 new GetUploadStatusRequest(sender_.get(), |
546 url_request_context_getter_, | 542 url_request_context_getter_, |
547 callback, | 543 callback, |
548 drive_file_path, | |
549 upload_url, | 544 upload_url, |
550 content_length)); | 545 content_length)); |
551 } | 546 } |
552 | 547 |
553 CancelCallback GDataWapiService::AuthorizeApp( | 548 CancelCallback GDataWapiService::AuthorizeApp( |
554 const std::string& resource_id, | 549 const std::string& resource_id, |
555 const std::string& app_id, | 550 const std::string& app_id, |
556 const AuthorizeAppCallback& callback) { | 551 const AuthorizeAppCallback& callback) { |
557 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 552 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
558 DCHECK(!callback.is_null()); | 553 DCHECK(!callback.is_null()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 if (CanSendRequest()) { | 589 if (CanSendRequest()) { |
595 FOR_EACH_OBSERVER( | 590 FOR_EACH_OBSERVER( |
596 DriveServiceObserver, observers_, OnReadyToSendRequests()); | 591 DriveServiceObserver, observers_, OnReadyToSendRequests()); |
597 } else if (!HasRefreshToken()) { | 592 } else if (!HasRefreshToken()) { |
598 FOR_EACH_OBSERVER( | 593 FOR_EACH_OBSERVER( |
599 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); | 594 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); |
600 } | 595 } |
601 } | 596 } |
602 | 597 |
603 } // namespace google_apis | 598 } // namespace google_apis |
OLD | NEW |