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 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // Callback used to get the content from DownloadFileRequest. | 56 // Callback used to get the content from DownloadFileRequest. |
57 typedef base::Callback<void( | 57 typedef base::Callback<void( |
58 DriveApiErrorCode error, | 58 DriveApiErrorCode error, |
59 scoped_ptr<std::string> content)> GetContentCallback; | 59 scoped_ptr<std::string> content)> GetContentCallback; |
60 | 60 |
61 // Parses JSON passed in |json|. Returns NULL on failure. | 61 // Parses JSON passed in |json|. Returns NULL on failure. |
62 scoped_ptr<base::Value> ParseJson(const std::string& json); | 62 scoped_ptr<base::Value> ParseJson(const std::string& json); |
63 | 63 |
64 // Generate multipart body. If |predetermined_boundary| is not empty, it uses | 64 // Generate multipart body. If |predetermined_boundary| is not empty, it uses |
65 // the string as boundary. Otherwise it generates random boundary that does not | 65 // the string as boundary. Otherwise it generates random boundary that does not |
66 // conflict with |parts|. | 66 // conflict with |parts|. If |data_offset| is not nullptr, it stores the |
| 67 // index of first byte of each part in multipart body. |
67 void GenerateMultipartBody(MultipartType multipart_type, | 68 void GenerateMultipartBody(MultipartType multipart_type, |
68 const std::string& predetermined_boundary, | 69 const std::string& predetermined_boundary, |
69 const std::vector<ContentTypeAndData>& parts, | 70 const std::vector<ContentTypeAndData>& parts, |
70 ContentTypeAndData* output); | 71 ContentTypeAndData* output, |
| 72 std::vector<uint64>* data_offset); |
71 | 73 |
72 //======================= AuthenticatedRequestInterface ====================== | 74 //======================= AuthenticatedRequestInterface ====================== |
73 | 75 |
74 // An interface class for implementing a request which requires OAuth2 | 76 // An interface class for implementing a request which requires OAuth2 |
75 // authentication. | 77 // authentication. |
76 class AuthenticatedRequestInterface { | 78 class AuthenticatedRequestInterface { |
77 public: | 79 public: |
78 // Called when re-authentication is required. See Start() for details. | 80 // Called when re-authentication is required. See Start() for details. |
79 typedef base::Callback<void(AuthenticatedRequestInterface* request)> | 81 typedef base::Callback<void(AuthenticatedRequestInterface* request)> |
80 ReAuthenticateCallback; | 82 ReAuthenticateCallback; |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 const ProgressCallback progress_callback_; | 616 const ProgressCallback progress_callback_; |
615 const GURL download_url_; | 617 const GURL download_url_; |
616 const base::FilePath output_file_path_; | 618 const base::FilePath output_file_path_; |
617 | 619 |
618 DISALLOW_COPY_AND_ASSIGN(DownloadFileRequestBase); | 620 DISALLOW_COPY_AND_ASSIGN(DownloadFileRequestBase); |
619 }; | 621 }; |
620 | 622 |
621 } // namespace google_apis | 623 } // namespace google_apis |
622 | 624 |
623 #endif // GOOGLE_APIS_DRIVE_BASE_REQUESTS_H_ | 625 #endif // GOOGLE_APIS_DRIVE_BASE_REQUESTS_H_ |
OLD | NEW |