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

Side by Side Diff: chrome/browser/google_apis/base_requests.h

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 | « chrome/browser/drive/gdata_wapi_service.cc ('k') | chrome/browser/google_apis/base_requests.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 // This file provides base classes used to issue HTTP requests for Google 5 // This file provides base classes used to issue HTTP requests for Google
6 // APIs. 6 // APIs.
7 7
8 #ifndef CHROME_BROWSER_GOOGLE_APIS_BASE_REQUESTS_H_ 8 #ifndef CHROME_BROWSER_GOOGLE_APIS_BASE_REQUESTS_H_
9 #define CHROME_BROWSER_GOOGLE_APIS_BASE_REQUESTS_H_ 9 #define CHROME_BROWSER_GOOGLE_APIS_BASE_REQUESTS_H_
10 10
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 // Callback type for getting the content from DownloadFileRequest. 431 // Callback type for getting the content from DownloadFileRequest.
432 typedef base::Callback<void( 432 typedef base::Callback<void(
433 GDataErrorCode error, 433 GDataErrorCode error,
434 scoped_ptr<std::string> content)> GetContentCallback; 434 scoped_ptr<std::string> content)> GetContentCallback;
435 435
436 // Callback type for receiving the completion of DownloadFileRequest. 436 // Callback type for receiving the completion of DownloadFileRequest.
437 typedef base::Callback<void(GDataErrorCode error, 437 typedef base::Callback<void(GDataErrorCode error,
438 const base::FilePath& temp_file)> 438 const base::FilePath& temp_file)>
439 DownloadActionCallback; 439 DownloadActionCallback;
440 440
441 // This class performs the request for downloading of a given document/file. 441 // This is a base class for performing the request for downloading a file.
442 class DownloadFileRequest : public UrlFetchRequestBase { 442 class DownloadFileRequestBase : public UrlFetchRequestBase {
443 public: 443 public:
444 // download_action_callback: 444 // download_action_callback:
445 // This callback is called when the download is complete. Must not be null. 445 // This callback is called when the download is complete. Must not be null.
446 // 446 //
447 // get_content_callback: 447 // get_content_callback:
448 // This callback is called when some part of the content is 448 // This callback is called when some part of the content is
449 // read. Used to read the download content progressively. May be null. 449 // read. Used to read the download content progressively. May be null.
450 // 450 //
451 // progress_callback: 451 // progress_callback:
452 // This callback is called for periodically reporting the number of bytes 452 // This callback is called for periodically reporting the number of bytes
453 // downloaded so far. May be null. 453 // downloaded so far. May be null.
454 // 454 //
455 // download_url: 455 // download_url:
456 // Specifies the target file to download. 456 // Specifies the target file to download.
457 // 457 //
458 // output_file_path: 458 // output_file_path:
459 // Specifies the file path to save the downloaded file. 459 // Specifies the file path to save the downloaded file.
460 // 460 //
461 DownloadFileRequest(RequestSender* sender, 461 DownloadFileRequestBase(
462 const DownloadActionCallback& download_action_callback, 462 RequestSender* sender,
463 const GetContentCallback& get_content_callback, 463 const DownloadActionCallback& download_action_callback,
464 const ProgressCallback& progress_callback, 464 const GetContentCallback& get_content_callback,
465 const GURL& download_url, 465 const ProgressCallback& progress_callback,
466 const base::FilePath& output_file_path); 466 const GURL& download_url,
467 virtual ~DownloadFileRequest(); 467 const base::FilePath& output_file_path);
468 virtual ~DownloadFileRequestBase();
468 469
469 protected: 470 protected:
470 // UrlFetchRequestBase overrides. 471 // UrlFetchRequestBase overrides.
471 virtual GURL GetURL() const OVERRIDE; 472 virtual GURL GetURL() const OVERRIDE;
472 virtual bool GetOutputFilePath(base::FilePath* local_file_path) OVERRIDE; 473 virtual bool GetOutputFilePath(base::FilePath* local_file_path) OVERRIDE;
473 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE; 474 virtual void ProcessURLFetchResults(const net::URLFetcher* source) OVERRIDE;
474 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE; 475 virtual void RunCallbackOnPrematureFailure(GDataErrorCode code) OVERRIDE;
475 476
476 // net::URLFetcherDelegate overrides. 477 // net::URLFetcherDelegate overrides.
477 virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source, 478 virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source,
478 int64 current, int64 total) OVERRIDE; 479 int64 current, int64 total) OVERRIDE;
479 virtual bool ShouldSendDownloadData() OVERRIDE; 480 virtual bool ShouldSendDownloadData() OVERRIDE;
480 virtual void OnURLFetchDownloadData( 481 virtual void OnURLFetchDownloadData(
481 const net::URLFetcher* source, 482 const net::URLFetcher* source,
482 scoped_ptr<std::string> download_data) OVERRIDE; 483 scoped_ptr<std::string> download_data) OVERRIDE;
483 484
484 private: 485 private:
485 const DownloadActionCallback download_action_callback_; 486 const DownloadActionCallback download_action_callback_;
486 const GetContentCallback get_content_callback_; 487 const GetContentCallback get_content_callback_;
487 const ProgressCallback progress_callback_; 488 const ProgressCallback progress_callback_;
488 const GURL download_url_; 489 const GURL download_url_;
489 const base::FilePath output_file_path_; 490 const base::FilePath output_file_path_;
490 491
491 DISALLOW_COPY_AND_ASSIGN(DownloadFileRequest); 492 DISALLOW_COPY_AND_ASSIGN(DownloadFileRequestBase);
492 }; 493 };
493 494
494 } // namespace google_apis 495 } // namespace google_apis
495 496
496 #endif // CHROME_BROWSER_GOOGLE_APIS_BASE_REQUESTS_H_ 497 #endif // CHROME_BROWSER_GOOGLE_APIS_BASE_REQUESTS_H_
OLDNEW
« no previous file with comments | « chrome/browser/drive/gdata_wapi_service.cc ('k') | chrome/browser/google_apis/base_requests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698