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_API_CALL_FLOW_H_ | 5 #ifndef GOOGLE_APIS_GAIA_OAUTH2_API_CALL_FLOW_H_ |
6 #define GOOGLE_APIS_GAIA_OAUTH2_API_CALL_FLOW_H_ | 6 #define GOOGLE_APIS_GAIA_OAUTH2_API_CALL_FLOW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 const std::string& access_token, | 47 const std::string& access_token, |
48 const std::vector<std::string>& scopes); | 48 const std::vector<std::string>& scopes); |
49 | 49 |
50 virtual ~OAuth2ApiCallFlow(); | 50 virtual ~OAuth2ApiCallFlow(); |
51 | 51 |
52 // Start the flow. | 52 // Start the flow. |
53 virtual void Start(); | 53 virtual void Start(); |
54 | 54 |
55 // OAuth2AccessTokenFetcher implementation. | 55 // OAuth2AccessTokenFetcher implementation. |
56 virtual void OnGetTokenSuccess(const std::string& access_token, | 56 virtual void OnGetTokenSuccess(const std::string& access_token, |
57 const base::Time& expiration_time) OVERRIDE; | 57 const base::Time& expiration_time) override; |
58 virtual void OnGetTokenFailure(const GoogleServiceAuthError& error) OVERRIDE; | 58 virtual void OnGetTokenFailure(const GoogleServiceAuthError& error) override; |
59 | 59 |
60 // net::URLFetcherDelegate implementation. | 60 // net::URLFetcherDelegate implementation. |
61 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 61 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; |
62 | 62 |
63 protected: | 63 protected: |
64 // Template methods for sub-classes. | 64 // Template methods for sub-classes. |
65 | 65 |
66 // Methods to help create HTTP request. | 66 // Methods to help create HTTP request. |
67 virtual GURL CreateApiCallUrl() = 0; | 67 virtual GURL CreateApiCallUrl() = 0; |
68 virtual std::string CreateApiCallBody() = 0; | 68 virtual std::string CreateApiCallBody() = 0; |
69 virtual std::string CreateApiCallBodyContentType(); | 69 virtual std::string CreateApiCallBodyContentType(); |
70 | 70 |
71 // Sub-classes can expose an appropriate observer interface by implementing | 71 // Sub-classes can expose an appropriate observer interface by implementing |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // Whether we have already tried minting an access token once. | 120 // Whether we have already tried minting an access token once. |
121 bool tried_mint_access_token_; | 121 bool tried_mint_access_token_; |
122 | 122 |
123 scoped_ptr<net::URLFetcher> url_fetcher_; | 123 scoped_ptr<net::URLFetcher> url_fetcher_; |
124 scoped_ptr<OAuth2AccessTokenFetcher> oauth2_access_token_fetcher_; | 124 scoped_ptr<OAuth2AccessTokenFetcher> oauth2_access_token_fetcher_; |
125 | 125 |
126 DISALLOW_COPY_AND_ASSIGN(OAuth2ApiCallFlow); | 126 DISALLOW_COPY_AND_ASSIGN(OAuth2ApiCallFlow); |
127 }; | 127 }; |
128 | 128 |
129 #endif // GOOGLE_APIS_GAIA_OAUTH2_API_CALL_FLOW_H_ | 129 #endif // GOOGLE_APIS_GAIA_OAUTH2_API_CALL_FLOW_H_ |
OLD | NEW |