| 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 #ifndef GOOGLE_APIS_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_ | 5 #ifndef GOOGLE_APIS_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_ |
| 6 #define GOOGLE_APIS_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_ | 6 #define GOOGLE_APIS_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 OAuth2MintTokenFlow(Delegate* delegate, const Parameters& parameters); | 102 OAuth2MintTokenFlow(Delegate* delegate, const Parameters& parameters); |
| 103 ~OAuth2MintTokenFlow() override; | 103 ~OAuth2MintTokenFlow() override; |
| 104 | 104 |
| 105 protected: | 105 protected: |
| 106 // Implementation of template methods in OAuth2ApiCallFlow. | 106 // Implementation of template methods in OAuth2ApiCallFlow. |
| 107 GURL CreateApiCallUrl() override; | 107 GURL CreateApiCallUrl() override; |
| 108 std::string CreateApiCallBody() override; | 108 std::string CreateApiCallBody() override; |
| 109 | 109 |
| 110 void ProcessApiCallSuccess(const net::URLFetcher* source) override; | 110 void ProcessApiCallSuccess(const net::URLFetcher* source) override; |
| 111 void ProcessApiCallFailure(const net::URLFetcher* source) override; | 111 void ProcessApiCallFailure(const net::URLFetcher* source) override; |
| 112 net::PartialNetworkTrafficAnnotationTag GetNetworkTrafficAnnotationTag() |
| 113 override; |
| 112 | 114 |
| 113 private: | 115 private: |
| 114 friend class OAuth2MintTokenFlowTest; | 116 friend class OAuth2MintTokenFlowTest; |
| 115 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, CreateApiCallBody); | 117 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, CreateApiCallBody); |
| 116 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ParseIssueAdviceResponse); | 118 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ParseIssueAdviceResponse); |
| 117 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ParseMintTokenResponse); | 119 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ParseMintTokenResponse); |
| 118 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ProcessApiCallSuccess); | 120 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ProcessApiCallSuccess); |
| 119 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ProcessApiCallFailure); | 121 FRIEND_TEST_ALL_PREFIXES(OAuth2MintTokenFlowTest, ProcessApiCallFailure); |
| 120 | 122 |
| 121 void ReportSuccess(const std::string& access_token, int time_to_live); | 123 void ReportSuccess(const std::string& access_token, int time_to_live); |
| 122 void ReportIssueAdviceSuccess(const IssueAdviceInfo& issue_advice); | 124 void ReportIssueAdviceSuccess(const IssueAdviceInfo& issue_advice); |
| 123 void ReportFailure(const GoogleServiceAuthError& error); | 125 void ReportFailure(const GoogleServiceAuthError& error); |
| 124 | 126 |
| 125 static bool ParseIssueAdviceResponse( | 127 static bool ParseIssueAdviceResponse( |
| 126 const base::DictionaryValue* dict, IssueAdviceInfo* issue_advice); | 128 const base::DictionaryValue* dict, IssueAdviceInfo* issue_advice); |
| 127 static bool ParseMintTokenResponse( | 129 static bool ParseMintTokenResponse( |
| 128 const base::DictionaryValue* dict, std::string* access_token, | 130 const base::DictionaryValue* dict, std::string* access_token, |
| 129 int* time_to_live); | 131 int* time_to_live); |
| 130 | 132 |
| 131 Delegate* delegate_; | 133 Delegate* delegate_; |
| 132 Parameters parameters_; | 134 Parameters parameters_; |
| 133 base::WeakPtrFactory<OAuth2MintTokenFlow> weak_factory_; | 135 base::WeakPtrFactory<OAuth2MintTokenFlow> weak_factory_; |
| 134 | 136 |
| 135 DISALLOW_COPY_AND_ASSIGN(OAuth2MintTokenFlow); | 137 DISALLOW_COPY_AND_ASSIGN(OAuth2MintTokenFlow); |
| 136 }; | 138 }; |
| 137 | 139 |
| 138 #endif // GOOGLE_APIS_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_ | 140 #endif // GOOGLE_APIS_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_ |
| OLD | NEW |