| 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 CHROME_COMMON_NET_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_ | 5 #ifndef CHROME_COMMON_NET_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_ |
| 6 #define CHROME_COMMON_NET_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_ | 6 #define CHROME_COMMON_NET_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 std::string login_refresh_token; | 82 std::string login_refresh_token; |
| 83 std::string extension_id; | 83 std::string extension_id; |
| 84 std::string client_id; | 84 std::string client_id; |
| 85 std::vector<std::string> scopes; | 85 std::vector<std::string> scopes; |
| 86 Mode mode; | 86 Mode mode; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 class Delegate { | 89 class Delegate { |
| 90 public: | 90 public: |
| 91 Delegate() {} | |
| 92 virtual ~Delegate() {} | |
| 93 virtual void OnMintTokenSuccess(const std::string& access_token) {} | 91 virtual void OnMintTokenSuccess(const std::string& access_token) {} |
| 94 virtual void OnIssueAdviceSuccess(const IssueAdviceInfo& issue_advice) {} | 92 virtual void OnIssueAdviceSuccess(const IssueAdviceInfo& issue_advice) {} |
| 95 virtual void OnMintTokenFailure(const GoogleServiceAuthError& error) {} | 93 virtual void OnMintTokenFailure(const GoogleServiceAuthError& error) {} |
| 94 |
| 95 protected: |
| 96 virtual ~Delegate() {} |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 // An interceptor for tests. | 99 // An interceptor for tests. |
| 99 class InterceptorForTests { | 100 class InterceptorForTests { |
| 100 public: | 101 public: |
| 101 // Returns true if the success callback should be called and false for | 102 // Returns true if the success callback should be called and false for |
| 102 // failures. | 103 // failures. |
| 103 virtual bool DoIntercept(const OAuth2MintTokenFlow* flow, | 104 virtual bool DoIntercept(const OAuth2MintTokenFlow* flow, |
| 104 std::string* access_token, | 105 std::string* access_token, |
| 105 GoogleServiceAuthError* error) = 0; | 106 GoogleServiceAuthError* error) = 0; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 const base::DictionaryValue* dict, std::string* access_token); | 147 const base::DictionaryValue* dict, std::string* access_token); |
| 147 | 148 |
| 148 net::URLRequestContextGetter* context_; | 149 net::URLRequestContextGetter* context_; |
| 149 Delegate* delegate_; | 150 Delegate* delegate_; |
| 150 Parameters parameters_; | 151 Parameters parameters_; |
| 151 | 152 |
| 152 DISALLOW_COPY_AND_ASSIGN(OAuth2MintTokenFlow); | 153 DISALLOW_COPY_AND_ASSIGN(OAuth2MintTokenFlow); |
| 153 }; | 154 }; |
| 154 | 155 |
| 155 #endif // CHROME_COMMON_NET_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_ | 156 #endif // CHROME_COMMON_NET_GAIA_OAUTH2_MINT_TOKEN_FLOW_H_ |
| OLD | NEW |