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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 runner_->StartOperationWithRetry( | 402 runner_->StartOperationWithRetry( |
403 new RemoveResourceFromDirectoryOperation(operation_registry(), | 403 new RemoveResourceFromDirectoryOperation(operation_registry(), |
404 url_request_context_getter_, | 404 url_request_context_getter_, |
405 url_generator_, | 405 url_generator_, |
406 callback, | 406 callback, |
407 parent_resource_id, | 407 parent_resource_id, |
408 resource_id)); | 408 resource_id)); |
409 } | 409 } |
410 | 410 |
411 void GDataWapiService::InitiateUploadNewFile( | 411 void GDataWapiService::InitiateUploadNewFile( |
412 const FilePath& drive_file_path, | 412 const base::FilePath& drive_file_path, |
413 const std::string& content_type, | 413 const std::string& content_type, |
414 int64 content_length, | 414 int64 content_length, |
415 const GURL& parent_upload_url, | 415 const GURL& parent_upload_url, |
416 const std::string& title, | 416 const std::string& title, |
417 const InitiateUploadCallback& callback) { | 417 const InitiateUploadCallback& callback) { |
418 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 418 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
419 DCHECK(!callback.is_null()); | 419 DCHECK(!callback.is_null()); |
420 | 420 |
421 if (parent_upload_url.is_empty()) { | 421 if (parent_upload_url.is_empty()) { |
422 callback.Run(HTTP_BAD_REQUEST, GURL()); | 422 callback.Run(HTTP_BAD_REQUEST, GURL()); |
423 return; | 423 return; |
424 } | 424 } |
425 | 425 |
426 runner_->StartOperationWithRetry( | 426 runner_->StartOperationWithRetry( |
427 new InitiateUploadNewFileOperation(operation_registry(), | 427 new InitiateUploadNewFileOperation(operation_registry(), |
428 url_request_context_getter_, | 428 url_request_context_getter_, |
429 callback, | 429 callback, |
430 drive_file_path, | 430 drive_file_path, |
431 content_type, | 431 content_type, |
432 content_length, | 432 content_length, |
433 parent_upload_url, | 433 parent_upload_url, |
434 title)); | 434 title)); |
435 } | 435 } |
436 | 436 |
437 void GDataWapiService::InitiateUploadExistingFile( | 437 void GDataWapiService::InitiateUploadExistingFile( |
438 const FilePath& drive_file_path, | 438 const base::FilePath& drive_file_path, |
439 const std::string& content_type, | 439 const std::string& content_type, |
440 int64 content_length, | 440 int64 content_length, |
441 const GURL& upload_url, | 441 const GURL& upload_url, |
442 const std::string& etag, | 442 const std::string& etag, |
443 const InitiateUploadCallback& callback) { | 443 const InitiateUploadCallback& callback) { |
444 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 444 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
445 DCHECK(!callback.is_null()); | 445 DCHECK(!callback.is_null()); |
446 | 446 |
447 if (upload_url.is_empty()) { | 447 if (upload_url.is_empty()) { |
448 callback.Run(HTTP_BAD_REQUEST, GURL()); | 448 callback.Run(HTTP_BAD_REQUEST, GURL()); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 } | 539 } |
540 | 540 |
541 void GDataWapiService::OnProgressUpdate( | 541 void GDataWapiService::OnProgressUpdate( |
542 const OperationProgressStatusList& list) { | 542 const OperationProgressStatusList& list) { |
543 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 543 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
544 FOR_EACH_OBSERVER( | 544 FOR_EACH_OBSERVER( |
545 DriveServiceObserver, observers_, OnProgressUpdate(list)); | 545 DriveServiceObserver, observers_, OnProgressUpdate(list)); |
546 } | 546 } |
547 | 547 |
548 } // namespace google_apis | 548 } // namespace google_apis |
OLD | NEW |