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 // 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 GOOGLE_APIS_DRIVE_BASE_REQUESTS_H_ | 8 #ifndef GOOGLE_APIS_DRIVE_BASE_REQUESTS_H_ |
9 #define GOOGLE_APIS_DRIVE_BASE_REQUESTS_H_ | 9 #define GOOGLE_APIS_DRIVE_BASE_REQUESTS_H_ |
10 | 10 |
| 11 #include <stdint.h> |
| 12 |
11 #include <string> | 13 #include <string> |
12 #include <vector> | 14 #include <vector> |
13 | 15 |
14 #include "base/callback.h" | 16 #include "base/callback.h" |
15 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
| 18 #include "base/macros.h" |
16 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
17 #include "base/threading/thread_checker.h" | 20 #include "base/threading/thread_checker.h" |
18 #include "google_apis/drive/drive_api_error_codes.h" | 21 #include "google_apis/drive/drive_api_error_codes.h" |
19 #include "net/url_request/url_fetcher.h" | 22 #include "net/url_request/url_fetcher.h" |
20 #include "net/url_request/url_fetcher_delegate.h" | 23 #include "net/url_request/url_fetcher_delegate.h" |
21 #include "net/url_request/url_fetcher_response_writer.h" | 24 #include "net/url_request/url_fetcher_response_writer.h" |
22 #include "url/gurl.h" | 25 #include "url/gurl.h" |
23 | 26 |
24 namespace base { | 27 namespace base { |
25 class Value; | 28 class Value; |
(...skipping 18 matching lines...) Expand all Loading... |
44 | 47 |
45 typedef base::Callback<void(DriveApiErrorCode)> PrepareCallback; | 48 typedef base::Callback<void(DriveApiErrorCode)> PrepareCallback; |
46 | 49 |
47 // Callback used for requests that the server returns FileResource data | 50 // Callback used for requests that the server returns FileResource data |
48 // formatted into JSON value. | 51 // formatted into JSON value. |
49 typedef base::Callback<void(DriveApiErrorCode error, | 52 typedef base::Callback<void(DriveApiErrorCode error, |
50 scoped_ptr<FileResource> entry)> | 53 scoped_ptr<FileResource> entry)> |
51 FileResourceCallback; | 54 FileResourceCallback; |
52 | 55 |
53 // Callback used for DownloadFileRequest and ResumeUploadRequestBase. | 56 // Callback used for DownloadFileRequest and ResumeUploadRequestBase. |
54 typedef base::Callback<void(int64 progress, int64 total)> ProgressCallback; | 57 typedef base::Callback<void(int64_t progress, int64_t total)> ProgressCallback; |
55 | 58 |
56 // Callback used to get the content from DownloadFileRequest. | 59 // Callback used to get the content from DownloadFileRequest. |
57 typedef base::Callback<void( | 60 typedef base::Callback<void( |
58 DriveApiErrorCode error, | 61 DriveApiErrorCode error, |
59 scoped_ptr<std::string> content)> GetContentCallback; | 62 scoped_ptr<std::string> content)> GetContentCallback; |
60 | 63 |
61 // Parses JSON passed in |json|. Returns NULL on failure. | 64 // Parses JSON passed in |json|. Returns NULL on failure. |
62 scoped_ptr<base::Value> ParseJson(const std::string& json); | 65 scoped_ptr<base::Value> ParseJson(const std::string& json); |
63 | 66 |
64 // Generate multipart body. If |predetermined_boundary| is not empty, it uses | 67 // Generate multipart body. If |predetermined_boundary| is not empty, it uses |
65 // the string as boundary. Otherwise it generates random boundary that does not | 68 // the string as boundary. Otherwise it generates random boundary that does not |
66 // conflict with |parts|. If |data_offset| is not nullptr, it stores the | 69 // conflict with |parts|. If |data_offset| is not nullptr, it stores the |
67 // index of first byte of each part in multipart body. | 70 // index of first byte of each part in multipart body. |
68 void GenerateMultipartBody(MultipartType multipart_type, | 71 void GenerateMultipartBody(MultipartType multipart_type, |
69 const std::string& predetermined_boundary, | 72 const std::string& predetermined_boundary, |
70 const std::vector<ContentTypeAndData>& parts, | 73 const std::vector<ContentTypeAndData>& parts, |
71 ContentTypeAndData* output, | 74 ContentTypeAndData* output, |
72 std::vector<uint64>* data_offset); | 75 std::vector<uint64_t>* data_offset); |
73 | 76 |
74 //======================= AuthenticatedRequestInterface ====================== | 77 //======================= AuthenticatedRequestInterface ====================== |
75 | 78 |
76 // An interface class for implementing a request which requires OAuth2 | 79 // An interface class for implementing a request which requires OAuth2 |
77 // authentication. | 80 // authentication. |
78 class AuthenticatedRequestInterface { | 81 class AuthenticatedRequestInterface { |
79 public: | 82 public: |
80 // Called when re-authentication is required. See Start() for details. | 83 // Called when re-authentication is required. See Start() for details. |
81 typedef base::Callback<void(AuthenticatedRequestInterface* request)> | 84 typedef base::Callback<void(AuthenticatedRequestInterface* request)> |
82 ReAuthenticateCallback; | 85 ReAuthenticateCallback; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // Note that this and GetContentFile() cannot be used together. | 188 // Note that this and GetContentFile() cannot be used together. |
186 virtual bool GetContentData(std::string* upload_content_type, | 189 virtual bool GetContentData(std::string* upload_content_type, |
187 std::string* upload_content); | 190 std::string* upload_content); |
188 | 191 |
189 // Used by a derived class to add content data which is the whole file or | 192 // Used by a derived class to add content data which is the whole file or |
190 // a part of the file at |local_file_path|. | 193 // a part of the file at |local_file_path|. |
191 // Returns true if all the arguments are updated for the content being | 194 // Returns true if all the arguments are updated for the content being |
192 // uploaded. | 195 // uploaded. |
193 // Note that this and GetContentData() cannot be used together. | 196 // Note that this and GetContentData() cannot be used together. |
194 virtual bool GetContentFile(base::FilePath* local_file_path, | 197 virtual bool GetContentFile(base::FilePath* local_file_path, |
195 int64* range_offset, | 198 int64_t* range_offset, |
196 int64* range_length, | 199 int64_t* range_length, |
197 std::string* upload_content_type); | 200 std::string* upload_content_type); |
198 | 201 |
199 // Used by a derived class to set an output file path if they want to save | 202 // Used by a derived class to set an output file path if they want to save |
200 // the downloaded content to a file at a specific path. | 203 // the downloaded content to a file at a specific path. |
201 // Sets |get_content_callback|, which is called when some part of the response | 204 // Sets |get_content_callback|, which is called when some part of the response |
202 // is read. | 205 // is read. |
203 virtual void GetOutputFilePath(base::FilePath* local_file_path, | 206 virtual void GetOutputFilePath(base::FilePath* local_file_path, |
204 GetContentCallback* get_content_callback); | 207 GetContentCallback* get_content_callback); |
205 | 208 |
206 // Invoked by OnURLFetchComplete when the request completes without an | 209 // Invoked by OnURLFetchComplete when the request completes without an |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 const std::string& response_body, | 288 const std::string& response_body, |
286 const base::Closure& callback) = 0; | 289 const base::Closure& callback) = 0; |
287 | 290 |
288 // Notifies error. Unlike |NotifyResult|, it must report error | 291 // Notifies error. Unlike |NotifyResult|, it must report error |
289 // synchronously. The instance may be deleted just after calling | 292 // synchronously. The instance may be deleted just after calling |
290 // NotifyError. | 293 // NotifyError. |
291 virtual void NotifyError(DriveApiErrorCode code) = 0; | 294 virtual void NotifyError(DriveApiErrorCode code) = 0; |
292 | 295 |
293 // Notifies progress. | 296 // Notifies progress. |
294 virtual void NotifyUploadProgress(const net::URLFetcher* source, | 297 virtual void NotifyUploadProgress(const net::URLFetcher* source, |
295 int64 current, | 298 int64_t current, |
296 int64 total) = 0; | 299 int64_t total) = 0; |
297 }; | 300 }; |
298 | 301 |
299 //============================ EntryActionRequest ============================ | 302 //============================ EntryActionRequest ============================ |
300 | 303 |
301 // Callback type for requests that return only error status, like: Delete/Move. | 304 // Callback type for requests that return only error status, like: Delete/Move. |
302 typedef base::Callback<void(DriveApiErrorCode error)> EntryActionCallback; | 305 typedef base::Callback<void(DriveApiErrorCode error)> EntryActionCallback; |
303 | 306 |
304 // This class performs a simple action over a given entry (document/file). | 307 // This class performs a simple action over a given entry (document/file). |
305 // It is meant to be used for requests that return no JSON blobs. | 308 // It is meant to be used for requests that return no JSON blobs. |
306 class EntryActionRequest : public UrlFetchRequestBase { | 309 class EntryActionRequest : public UrlFetchRequestBase { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 // | 344 // |
342 class InitiateUploadRequestBase : public UrlFetchRequestBase { | 345 class InitiateUploadRequestBase : public UrlFetchRequestBase { |
343 protected: | 346 protected: |
344 // |callback| will be called with the upload URL, where upload data is | 347 // |callback| will be called with the upload URL, where upload data is |
345 // uploaded to with ResumeUploadRequestBase. It must not be null. | 348 // uploaded to with ResumeUploadRequestBase. It must not be null. |
346 // |content_type| and |content_length| should be the attributes of the | 349 // |content_type| and |content_length| should be the attributes of the |
347 // uploading file. | 350 // uploading file. |
348 InitiateUploadRequestBase(RequestSender* sender, | 351 InitiateUploadRequestBase(RequestSender* sender, |
349 const InitiateUploadCallback& callback, | 352 const InitiateUploadCallback& callback, |
350 const std::string& content_type, | 353 const std::string& content_type, |
351 int64 content_length); | 354 int64_t content_length); |
352 ~InitiateUploadRequestBase() override; | 355 ~InitiateUploadRequestBase() override; |
353 | 356 |
354 // UrlFetchRequestBase overrides. | 357 // UrlFetchRequestBase overrides. |
355 void ProcessURLFetchResults(const net::URLFetcher* source) override; | 358 void ProcessURLFetchResults(const net::URLFetcher* source) override; |
356 void RunCallbackOnPrematureFailure(DriveApiErrorCode code) override; | 359 void RunCallbackOnPrematureFailure(DriveApiErrorCode code) override; |
357 std::vector<std::string> GetExtraRequestHeaders() const override; | 360 std::vector<std::string> GetExtraRequestHeaders() const override; |
358 | 361 |
359 private: | 362 private: |
360 const InitiateUploadCallback callback_; | 363 const InitiateUploadCallback callback_; |
361 const std::string content_type_; | 364 const std::string content_type_; |
362 const int64 content_length_; | 365 const int64_t content_length_; |
363 | 366 |
364 DISALLOW_COPY_AND_ASSIGN(InitiateUploadRequestBase); | 367 DISALLOW_COPY_AND_ASSIGN(InitiateUploadRequestBase); |
365 }; | 368 }; |
366 | 369 |
367 //========================== UploadRangeRequestBase ========================== | 370 //========================== UploadRangeRequestBase ========================== |
368 | 371 |
369 // Struct for response to ResumeUpload and GetUploadStatus. | 372 // Struct for response to ResumeUpload and GetUploadStatus. |
370 struct UploadRangeResponse { | 373 struct UploadRangeResponse { |
371 UploadRangeResponse(); | 374 UploadRangeResponse(); |
372 UploadRangeResponse(DriveApiErrorCode code, | 375 UploadRangeResponse(DriveApiErrorCode code, |
373 int64 start_position_received, | 376 int64_t start_position_received, |
374 int64 end_position_received); | 377 int64_t end_position_received); |
375 ~UploadRangeResponse(); | 378 ~UploadRangeResponse(); |
376 | 379 |
377 DriveApiErrorCode code; | 380 DriveApiErrorCode code; |
378 // The values of "Range" header returned from the server. The values are | 381 // The values of "Range" header returned from the server. The values are |
379 // used to continue uploading more data. These are set to -1 if an upload | 382 // used to continue uploading more data. These are set to -1 if an upload |
380 // is complete. | 383 // is complete. |
381 // |start_position_received| is inclusive and |end_position_received| is | 384 // |start_position_received| is inclusive and |end_position_received| is |
382 // exclusive to follow the common C++ manner, although the response from | 385 // exclusive to follow the common C++ manner, although the response from |
383 // the server has "Range" header in inclusive format at both sides. | 386 // the server has "Range" header in inclusive format at both sides. |
384 int64 start_position_received; | 387 int64_t start_position_received; |
385 int64 end_position_received; | 388 int64_t end_position_received; |
386 }; | 389 }; |
387 | 390 |
388 // Base class for a URL fetch request expecting the response containing the | 391 // Base class for a URL fetch request expecting the response containing the |
389 // current uploading range. This class processes the response containing | 392 // current uploading range. This class processes the response containing |
390 // "Range" header and invoke OnRangeRequestComplete. | 393 // "Range" header and invoke OnRangeRequestComplete. |
391 class UploadRangeRequestBase : public UrlFetchRequestBase { | 394 class UploadRangeRequestBase : public UrlFetchRequestBase { |
392 protected: | 395 protected: |
393 // |upload_url| is the URL of where to upload the file to. | 396 // |upload_url| is the URL of where to upload the file to. |
394 UploadRangeRequestBase(RequestSender* sender, const GURL& upload_url); | 397 UploadRangeRequestBase(RequestSender* sender, const GURL& upload_url); |
395 ~UploadRangeRequestBase() override; | 398 ~UploadRangeRequestBase() override; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 // |buf|. |end_position| is the end of range of contents currently stared in | 450 // |buf|. |end_position| is the end of range of contents currently stared in |
448 // |buf|. This is exclusive. For instance, if you are to upload the first | 451 // |buf|. This is exclusive. For instance, if you are to upload the first |
449 // 500 bytes of data, |start_position| is 0 and |end_position| is 500. | 452 // 500 bytes of data, |start_position| is 0 and |end_position| is 500. |
450 // |content_length| and |content_type| are the length and type of the | 453 // |content_length| and |content_type| are the length and type of the |
451 // file content to be uploaded respectively. | 454 // file content to be uploaded respectively. |
452 // |buf| holds current content to be uploaded. | 455 // |buf| holds current content to be uploaded. |
453 // See also UploadRangeRequestBase's comment for remaining parameters | 456 // See also UploadRangeRequestBase's comment for remaining parameters |
454 // meaning. | 457 // meaning. |
455 ResumeUploadRequestBase(RequestSender* sender, | 458 ResumeUploadRequestBase(RequestSender* sender, |
456 const GURL& upload_location, | 459 const GURL& upload_location, |
457 int64 start_position, | 460 int64_t start_position, |
458 int64 end_position, | 461 int64_t end_position, |
459 int64 content_length, | 462 int64_t content_length, |
460 const std::string& content_type, | 463 const std::string& content_type, |
461 const base::FilePath& local_file_path); | 464 const base::FilePath& local_file_path); |
462 ~ResumeUploadRequestBase() override; | 465 ~ResumeUploadRequestBase() override; |
463 | 466 |
464 // UrlFetchRequestBase overrides. | 467 // UrlFetchRequestBase overrides. |
465 std::vector<std::string> GetExtraRequestHeaders() const override; | 468 std::vector<std::string> GetExtraRequestHeaders() const override; |
466 bool GetContentFile(base::FilePath* local_file_path, | 469 bool GetContentFile(base::FilePath* local_file_path, |
467 int64* range_offset, | 470 int64_t* range_offset, |
468 int64* range_length, | 471 int64_t* range_length, |
469 std::string* upload_content_type) override; | 472 std::string* upload_content_type) override; |
470 | 473 |
471 private: | 474 private: |
472 // The parameters for the request. See ResumeUploadParams for the details. | 475 // The parameters for the request. See ResumeUploadParams for the details. |
473 const int64 start_position_; | 476 const int64_t start_position_; |
474 const int64 end_position_; | 477 const int64_t end_position_; |
475 const int64 content_length_; | 478 const int64_t content_length_; |
476 const std::string content_type_; | 479 const std::string content_type_; |
477 const base::FilePath local_file_path_; | 480 const base::FilePath local_file_path_; |
478 | 481 |
479 DISALLOW_COPY_AND_ASSIGN(ResumeUploadRequestBase); | 482 DISALLOW_COPY_AND_ASSIGN(ResumeUploadRequestBase); |
480 }; | 483 }; |
481 | 484 |
482 //======================== GetUploadStatusRequestBase ======================== | 485 //======================== GetUploadStatusRequestBase ======================== |
483 | 486 |
484 // This class performs the request for getting the current upload status | 487 // This class performs the request for getting the current upload status |
485 // of a file. | 488 // of a file. |
486 // This request calls OnRangeRequestComplete() with: | 489 // This request calls OnRangeRequestComplete() with: |
487 // - HTTP_RESUME_INCOMPLETE and the range of previously uploaded data, | 490 // - HTTP_RESUME_INCOMPLETE and the range of previously uploaded data, |
488 // if a file has been partially uploaded. |value| is not used. | 491 // if a file has been partially uploaded. |value| is not used. |
489 // - HTTP_SUCCESS or HTTP_CREATED (up to the upload mode) and |value| | 492 // - HTTP_SUCCESS or HTTP_CREATED (up to the upload mode) and |value| |
490 // for the uploaded data, if a file has been completely uploaded. | 493 // for the uploaded data, if a file has been completely uploaded. |
491 // See also UploadRangeRequestBase. | 494 // See also UploadRangeRequestBase. |
492 class GetUploadStatusRequestBase : public UploadRangeRequestBase { | 495 class GetUploadStatusRequestBase : public UploadRangeRequestBase { |
493 public: | 496 public: |
494 // |content_length| is the whole data size to be uploaded. | 497 // |content_length| is the whole data size to be uploaded. |
495 // See also UploadRangeRequestBase's constructor comment for other | 498 // See also UploadRangeRequestBase's constructor comment for other |
496 // parameters. | 499 // parameters. |
497 GetUploadStatusRequestBase(RequestSender* sender, | 500 GetUploadStatusRequestBase(RequestSender* sender, |
498 const GURL& upload_url, | 501 const GURL& upload_url, |
499 int64 content_length); | 502 int64_t content_length); |
500 ~GetUploadStatusRequestBase() override; | 503 ~GetUploadStatusRequestBase() override; |
501 | 504 |
502 protected: | 505 protected: |
503 // UrlFetchRequestBase overrides. | 506 // UrlFetchRequestBase overrides. |
504 std::vector<std::string> GetExtraRequestHeaders() const override; | 507 std::vector<std::string> GetExtraRequestHeaders() const override; |
505 | 508 |
506 private: | 509 private: |
507 const int64 content_length_; | 510 const int64_t content_length_; |
508 | 511 |
509 DISALLOW_COPY_AND_ASSIGN(GetUploadStatusRequestBase); | 512 DISALLOW_COPY_AND_ASSIGN(GetUploadStatusRequestBase); |
510 }; | 513 }; |
511 | 514 |
512 //=========================== MultipartUploadRequestBase======================= | 515 //=========================== MultipartUploadRequestBase======================= |
513 | 516 |
514 // This class provides base implementation for performing the request for | 517 // This class provides base implementation for performing the request for |
515 // uploading a file by multipart body. | 518 // uploading a file by multipart body. |
516 class MultipartUploadRequestBase : public BatchableDelegate { | 519 class MultipartUploadRequestBase : public BatchableDelegate { |
517 public: | 520 public: |
518 // Set boundary. Only tests can use this method. | 521 // Set boundary. Only tests can use this method. |
519 void SetBoundaryForTesting(const std::string& boundary); | 522 void SetBoundaryForTesting(const std::string& boundary); |
520 | 523 |
521 protected: | 524 protected: |
522 // |callback| will be called with the file resource.upload URL. | 525 // |callback| will be called with the file resource.upload URL. |
523 // |content_type| and |content_length| should be the attributes of the | 526 // |content_type| and |content_length| should be the attributes of the |
524 // uploading file. Other parameters are optional and can be empty or null | 527 // uploading file. Other parameters are optional and can be empty or null |
525 // depending on Upload URL provided by the subclasses. | 528 // depending on Upload URL provided by the subclasses. |
526 MultipartUploadRequestBase(base::SequencedTaskRunner* blocking_task_runner, | 529 MultipartUploadRequestBase(base::SequencedTaskRunner* blocking_task_runner, |
527 const std::string& metadata_json, | 530 const std::string& metadata_json, |
528 const std::string& content_type, | 531 const std::string& content_type, |
529 int64 content_length, | 532 int64_t content_length, |
530 const base::FilePath& local_file_path, | 533 const base::FilePath& local_file_path, |
531 const FileResourceCallback& callback, | 534 const FileResourceCallback& callback, |
532 const ProgressCallback& progress_callback); | 535 const ProgressCallback& progress_callback); |
533 ~MultipartUploadRequestBase() override; | 536 ~MultipartUploadRequestBase() override; |
534 | 537 |
535 // BatchableDelegate. | 538 // BatchableDelegate. |
536 std::vector<std::string> GetExtraRequestHeaders() const override; | 539 std::vector<std::string> GetExtraRequestHeaders() const override; |
537 void Prepare(const PrepareCallback& callback) override; | 540 void Prepare(const PrepareCallback& callback) override; |
538 bool GetContentData(std::string* upload_content_type, | 541 bool GetContentData(std::string* upload_content_type, |
539 std::string* upload_content) override; | 542 std::string* upload_content) override; |
540 void NotifyResult(DriveApiErrorCode code, | 543 void NotifyResult(DriveApiErrorCode code, |
541 const std::string& body, | 544 const std::string& body, |
542 const base::Closure& callback) override; | 545 const base::Closure& callback) override; |
543 void NotifyError(DriveApiErrorCode code) override; | 546 void NotifyError(DriveApiErrorCode code) override; |
544 void NotifyUploadProgress(const net::URLFetcher* source, | 547 void NotifyUploadProgress(const net::URLFetcher* source, |
545 int64 current, | 548 int64_t current, |
546 int64 total) override; | 549 int64_t total) override; |
547 // Parses the response value and invokes |callback_| with |FileResource|. | 550 // Parses the response value and invokes |callback_| with |FileResource|. |
548 void OnDataParsed(DriveApiErrorCode code, | 551 void OnDataParsed(DriveApiErrorCode code, |
549 const base::Closure& callback, | 552 const base::Closure& callback, |
550 scoped_ptr<base::Value> value); | 553 scoped_ptr<base::Value> value); |
551 | 554 |
552 private: | 555 private: |
553 // Continues to rest part of |Start| method after determining boundary string | 556 // Continues to rest part of |Start| method after determining boundary string |
554 // of multipart/related. | 557 // of multipart/related. |
555 void OnPrepareUploadContent(const PrepareCallback& callback, | 558 void OnPrepareUploadContent(const PrepareCallback& callback, |
556 std::string* upload_content_type, | 559 std::string* upload_content_type, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 protected: | 622 protected: |
620 // UrlFetchRequestBase overrides. | 623 // UrlFetchRequestBase overrides. |
621 GURL GetURL() const override; | 624 GURL GetURL() const override; |
622 void GetOutputFilePath(base::FilePath* local_file_path, | 625 void GetOutputFilePath(base::FilePath* local_file_path, |
623 GetContentCallback* get_content_callback) override; | 626 GetContentCallback* get_content_callback) override; |
624 void ProcessURLFetchResults(const net::URLFetcher* source) override; | 627 void ProcessURLFetchResults(const net::URLFetcher* source) override; |
625 void RunCallbackOnPrematureFailure(DriveApiErrorCode code) override; | 628 void RunCallbackOnPrematureFailure(DriveApiErrorCode code) override; |
626 | 629 |
627 // net::URLFetcherDelegate overrides. | 630 // net::URLFetcherDelegate overrides. |
628 void OnURLFetchDownloadProgress(const net::URLFetcher* source, | 631 void OnURLFetchDownloadProgress(const net::URLFetcher* source, |
629 int64 current, | 632 int64_t current, |
630 int64 total) override; | 633 int64_t total) override; |
631 | 634 |
632 private: | 635 private: |
633 const DownloadActionCallback download_action_callback_; | 636 const DownloadActionCallback download_action_callback_; |
634 const GetContentCallback get_content_callback_; | 637 const GetContentCallback get_content_callback_; |
635 const ProgressCallback progress_callback_; | 638 const ProgressCallback progress_callback_; |
636 const GURL download_url_; | 639 const GURL download_url_; |
637 const base::FilePath output_file_path_; | 640 const base::FilePath output_file_path_; |
638 | 641 |
639 DISALLOW_COPY_AND_ASSIGN(DownloadFileRequestBase); | 642 DISALLOW_COPY_AND_ASSIGN(DownloadFileRequestBase); |
640 }; | 643 }; |
641 | 644 |
642 } // namespace google_apis | 645 } // namespace google_apis |
643 | 646 |
644 #endif // GOOGLE_APIS_DRIVE_BASE_REQUESTS_H_ | 647 #endif // GOOGLE_APIS_DRIVE_BASE_REQUESTS_H_ |
OLD | NEW |