| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_CRYPTAUTH_CRYPTAUTH_API_CALL_FLOW_H_ | 5 #ifndef COMPONENTS_CRYPTAUTH_CRYPTAUTH_API_CALL_FLOW_H_ |
| 6 #define COMPONENTS_CRYPTAUTH_CRYPTAUTH_API_CALL_FLOW_H_ | 6 #define COMPONENTS_CRYPTAUTH_CRYPTAUTH_API_CALL_FLOW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // result_callback: Called when the flow completes successfully with a | 33 // result_callback: Called when the flow completes successfully with a |
| 34 // serialized response proto. | 34 // serialized response proto. |
| 35 // error_callback: Called when the flow completes with an error. | 35 // error_callback: Called when the flow completes with an error. |
| 36 virtual void Start(const GURL& request_url, | 36 virtual void Start(const GURL& request_url, |
| 37 net::URLRequestContextGetter* context, | 37 net::URLRequestContextGetter* context, |
| 38 const std::string& access_token, | 38 const std::string& access_token, |
| 39 const std::string& serialized_request, | 39 const std::string& serialized_request, |
| 40 const ResultCallback& result_callback, | 40 const ResultCallback& result_callback, |
| 41 const ErrorCallback& error_callback); | 41 const ErrorCallback& error_callback); |
| 42 | 42 |
| 43 void SetPartialNetworkTrafficAnnotation( |
| 44 const net::PartialNetworkTrafficAnnotationTag& |
| 45 partial_traffic_annotation) { |
| 46 partial_network_annotation_.reset( |
| 47 new net::PartialNetworkTrafficAnnotationTag( |
| 48 partial_traffic_annotation)); |
| 49 } |
| 50 |
| 43 protected: | 51 protected: |
| 44 // Reduce the visibility of OAuth2ApiCallFlow::Start() to avoid exposing | 52 // Reduce the visibility of OAuth2ApiCallFlow::Start() to avoid exposing |
| 45 // overloaded methods. | 53 // overloaded methods. |
| 46 using OAuth2ApiCallFlow::Start; | 54 using OAuth2ApiCallFlow::Start; |
| 47 | 55 |
| 48 // google_apis::OAuth2ApiCallFlow: | 56 // google_apis::OAuth2ApiCallFlow: |
| 49 GURL CreateApiCallUrl() override; | 57 GURL CreateApiCallUrl() override; |
| 50 std::string CreateApiCallBody() override; | 58 std::string CreateApiCallBody() override; |
| 51 std::string CreateApiCallBodyContentType() override; | 59 std::string CreateApiCallBodyContentType() override; |
| 52 net::URLFetcher::RequestType GetRequestTypeForBody( | 60 net::URLFetcher::RequestType GetRequestTypeForBody( |
| 53 const std::string& body) override; | 61 const std::string& body) override; |
| 54 void ProcessApiCallSuccess(const net::URLFetcher* source) override; | 62 void ProcessApiCallSuccess(const net::URLFetcher* source) override; |
| 55 void ProcessApiCallFailure(const net::URLFetcher* source) override; | 63 void ProcessApiCallFailure(const net::URLFetcher* source) override; |
| 64 net::PartialNetworkTrafficAnnotationTag GetNetworkTrafficAnnotationTag() |
| 65 override; |
| 56 | 66 |
| 57 private: | 67 private: |
| 58 // The URL of the CryptAuth endpoint serving the request. | 68 // The URL of the CryptAuth endpoint serving the request. |
| 59 GURL request_url_; | 69 GURL request_url_; |
| 60 | 70 |
| 61 // Serialized request message proto that will be sent in the API request. | 71 // Serialized request message proto that will be sent in the API request. |
| 62 std::string serialized_request_; | 72 std::string serialized_request_; |
| 63 | 73 |
| 64 // Callback invoked with the serialized response message proto when the flow | 74 // Callback invoked with the serialized response message proto when the flow |
| 65 // completes successfully. | 75 // completes successfully. |
| 66 ResultCallback result_callback_; | 76 ResultCallback result_callback_; |
| 67 | 77 |
| 68 // Callback invoked with an error message when the flow fails. | 78 // Callback invoked with an error message when the flow fails. |
| 69 ErrorCallback error_callback_; | 79 ErrorCallback error_callback_; |
| 70 | 80 |
| 81 std::unique_ptr<net::PartialNetworkTrafficAnnotationTag> |
| 82 partial_network_annotation_; |
| 83 |
| 71 DISALLOW_COPY_AND_ASSIGN(CryptAuthApiCallFlow); | 84 DISALLOW_COPY_AND_ASSIGN(CryptAuthApiCallFlow); |
| 72 }; | 85 }; |
| 73 | 86 |
| 74 } // namespace cryptauth | 87 } // namespace cryptauth |
| 75 | 88 |
| 76 #endif // COMPONENTS_CRYPTAUTH_CRYPTAUTH_API_CALL_FLOW_H_ | 89 #endif // COMPONENTS_CRYPTAUTH_CRYPTAUTH_API_CALL_FLOW_H_ |
| OLD | NEW |