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