Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / components / proximity_auth / cryptauth / cryptauth_access_token_fetcher.h
blob6287dfeabd21e7800072a735e72b2cf831eaa1d0
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_PROXIMITY_AUTH_CRYPT_AUTH_ACCESS_TOKEN_FETCHER_H
6 #define COMPONENTS_PROXIMITY_AUTH_CRYPT_AUTH_ACCESS_TOKEN_FETCHER_H
8 #include <string>
10 #include "base/callback_forward.h"
12 namespace proximity_auth {
14 // Simple interface for fetching the OAuth2 access token that authorizes
15 // CryptAuth API calls. Do not reuse this after calling FetchAccessToken();
16 // instead, create a new instance.
17 class CryptAuthAccessTokenFetcher {
18 public:
19 virtual ~CryptAuthAccessTokenFetcher() {}
21 // Fetches the access token asynchronously, invoking the callback upon
22 // completion. If the fetch fails, the callback will be invoked with an empty
23 // string.
24 typedef base::Callback<void(const std::string&)> AccessTokenCallback;
25 virtual void FetchAccessToken(const AccessTokenCallback& callback) = 0;
28 } // namespace proximity_auth
30 #endif // COMPONENTS_PROXIMITY_AUTH_CRYPT_AUTH_ACCESS_TOKEN_FETCHER_H