Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(574)

Side by Side Diff: chrome/browser/drive/drive_api_service.cc

Issue 18211008: Add resource ID based download requests in {GDataWapi/Drive} requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reorder parameters. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/drive/gdata_wapi_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/drive_api_service.h" 5 #include "chrome/browser/drive/drive_api_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"
11 #include "base/message_loop/message_loop_proxy.h" 11 #include "base/message_loop/message_loop_proxy.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/task_runner_util.h" 13 #include "base/task_runner_util.h"
14 #include "base/threading/sequenced_worker_pool.h" 14 #include "base/threading/sequenced_worker_pool.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/drive/drive_api_util.h" 16 #include "chrome/browser/drive/drive_api_util.h"
17 #include "chrome/browser/google_apis/auth_service.h" 17 #include "chrome/browser/google_apis/auth_service.h"
18 #include "chrome/browser/google_apis/drive_api_parser.h" 18 #include "chrome/browser/google_apis/drive_api_parser.h"
19 #include "chrome/browser/google_apis/drive_api_requests.h" 19 #include "chrome/browser/google_apis/drive_api_requests.h"
20 #include "chrome/browser/google_apis/gdata_wapi_parser.h" 20 #include "chrome/browser/google_apis/gdata_wapi_parser.h"
21 #include "chrome/browser/google_apis/request_sender.h" 21 #include "chrome/browser/google_apis/request_sender.h"
22 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
23 23
24 using content::BrowserThread; 24 using content::BrowserThread;
25 using google_apis::AppList; 25 using google_apis::AppList;
26 using google_apis::AuthorizeAppCallback; 26 using google_apis::AuthorizeAppCallback;
27 using google_apis::CancelCallback; 27 using google_apis::CancelCallback;
28 using google_apis::ChangeList; 28 using google_apis::ChangeList;
29 using google_apis::DownloadActionCallback; 29 using google_apis::DownloadActionCallback;
30 using google_apis::DownloadFileRequest; 30 using google_apis::DownloadFileRequestBase;
31 using google_apis::EntryActionCallback; 31 using google_apis::EntryActionCallback;
32 using google_apis::FileList; 32 using google_apis::FileList;
33 using google_apis::FileResource; 33 using google_apis::FileResource;
34 using google_apis::GDATA_OTHER_ERROR; 34 using google_apis::GDATA_OTHER_ERROR;
35 using google_apis::GDATA_PARSE_ERROR; 35 using google_apis::GDATA_PARSE_ERROR;
36 using google_apis::GDataErrorCode; 36 using google_apis::GDataErrorCode;
37 using google_apis::GetAboutRequest; 37 using google_apis::GetAboutRequest;
38 using google_apis::GetAboutResourceCallback; 38 using google_apis::GetAboutResourceCallback;
39 using google_apis::GetAppListCallback; 39 using google_apis::GetAppListCallback;
40 using google_apis::GetApplistRequest; 40 using google_apis::GetApplistRequest;
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 CancelCallback DriveAPIService::DownloadFile( 471 CancelCallback DriveAPIService::DownloadFile(
472 const base::FilePath& local_cache_path, 472 const base::FilePath& local_cache_path,
473 const GURL& download_url, 473 const GURL& download_url,
474 const DownloadActionCallback& download_action_callback, 474 const DownloadActionCallback& download_action_callback,
475 const GetContentCallback& get_content_callback, 475 const GetContentCallback& get_content_callback,
476 const ProgressCallback& progress_callback) { 476 const ProgressCallback& progress_callback) {
477 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 477 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
478 DCHECK(!download_action_callback.is_null()); 478 DCHECK(!download_action_callback.is_null());
479 // get_content_callback may be null. 479 // get_content_callback may be null.
480 480
481 // TODO(kinaba): crbug.com/254025: use resource_id based download request.
481 return sender_->StartRequestWithRetry( 482 return sender_->StartRequestWithRetry(
482 new DownloadFileRequest(sender_.get(), 483 new DownloadFileRequestBase(sender_.get(),
483 download_action_callback, 484 download_action_callback,
484 get_content_callback, 485 get_content_callback,
485 progress_callback, 486 progress_callback,
486 download_url, 487 download_url,
487 local_cache_path)); 488 local_cache_path));
488 } 489 }
489 490
490 CancelCallback DriveAPIService::DeleteResource( 491 CancelCallback DriveAPIService::DeleteResource(
491 const std::string& resource_id, 492 const std::string& resource_id,
492 const std::string& etag, 493 const std::string& etag,
493 const EntryActionCallback& callback) { 494 const EntryActionCallback& callback) {
494 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 495 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
495 DCHECK(!callback.is_null()); 496 DCHECK(!callback.is_null());
496 497
497 return sender_->StartRequestWithRetry(new TrashResourceRequest( 498 return sender_->StartRequestWithRetry(new TrashResourceRequest(
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 if (CanSendRequest()) { 741 if (CanSendRequest()) {
741 FOR_EACH_OBSERVER( 742 FOR_EACH_OBSERVER(
742 DriveServiceObserver, observers_, OnReadyToSendRequests()); 743 DriveServiceObserver, observers_, OnReadyToSendRequests());
743 } else if (!HasRefreshToken()) { 744 } else if (!HasRefreshToken()) {
744 FOR_EACH_OBSERVER( 745 FOR_EACH_OBSERVER(
745 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); 746 DriveServiceObserver, observers_, OnRefreshTokenInvalid());
746 } 747 }
747 } 748 }
748 749
749 } // namespace drive 750 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/drive/gdata_wapi_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698