OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_PROXIMITY_AUTH_CRYPT_AUTH_ACCESS_TOKEN_FETCHER_H | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_CRYPT_AUTH_ACCESS_TOKEN_FETCHER_H |
6 #define COMPONENTS_PROXIMITY_AUTH_CRYPT_AUTH_ACCESS_TOKEN_FETCHER_H | 6 #define COMPONENTS_PROXIMITY_AUTH_CRYPT_AUTH_ACCESS_TOKEN_FETCHER_H |
7 | 7 |
8 #include "base/callback.h" | |
Ilya Sherman
2014/12/11 02:53:21
nit: Please include callback_forward.h instead.
Tim Song
2014/12/12 20:48:44
Done.
| |
9 | |
8 namespace proximity_auth { | 10 namespace proximity_auth { |
9 | 11 |
10 // Simple interface for fetching the OAuth2 access token that authorizes | 12 // Simple interface for fetching the OAuth2 access token that authorizes |
11 // CryptAuth API calls. | 13 // CryptAuth API calls. Do not reuse this after calling FetchAccessToken(); |
14 // instead, create a new instance. | |
12 class CryptAuthAccessTokenFetcher { | 15 class CryptAuthAccessTokenFetcher { |
13 public: | 16 public: |
14 virtual ~CryptAuthAccessTokenFetcher() {} | 17 virtual ~CryptAuthAccessTokenFetcher() {} |
15 | 18 |
16 // Fetches the access token asynchronously, invoking the callback upon | 19 // Fetches the access token asynchronously, invoking the callback upon |
17 // completion. If the fetch fails, the callback will be invoked with an empty | 20 // completion. If the fetch fails, the callback will be invoked with an empty |
18 // string. | 21 // string. |
19 typedef base::Callback<void(const std::string&)> AccessTokenCallback; | 22 typedef base::Callback<void(const std::string&)> AccessTokenCallback; |
20 virtual void FetchAccessToken(const AccessTokenCallback& callback) = 0; | 23 virtual void FetchAccessToken(const AccessTokenCallback& callback) = 0; |
21 }; | 24 }; |
22 | 25 |
23 } // namespace proximity_auth | 26 } // namespace proximity_auth |
24 | 27 |
25 #endif // COMPONENTS_PROXIMITY_AUTH_CRYPT_AUTH_ACCESS_TOKEN_FETCHER_H | 28 #endif // COMPONENTS_PROXIMITY_AUTH_CRYPT_AUTH_ACCESS_TOKEN_FETCHER_H |
OLD | NEW |