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