| 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_CRYPTAUTH_ACCESS_TOKEN_FETCHER_IMPL_H | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ACCESS_TOKEN_FETCHER_IMPL_H |
| 6 #define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ACCESS_TOKEN_FETCHER_IMPL_H | 6 #define COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ACCESS_TOKEN_FETCHER_IMPL_H |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/callback.h" | 10 #include "base/callback.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "components/proximity_auth/cryptauth/cryptauth_access_token_fetcher.h" | 12 #include "components/proximity_auth/cryptauth/cryptauth_access_token_fetcher.h" |
| 12 #include "google_apis/gaia/oauth2_token_service.h" | 13 #include "google_apis/gaia/oauth2_token_service.h" |
| 13 | 14 |
| 14 namespace proximity_auth { | 15 namespace proximity_auth { |
| 15 | 16 |
| 16 // Implementation of CryptAuthAccessTokenFetcher fetching an access token for a | 17 // Implementation of CryptAuthAccessTokenFetcher fetching an access token for a |
| 17 // given account using the provided OAuth2TokenService. | 18 // given account using the provided OAuth2TokenService. |
| 18 class CryptAuthAccessTokenFetcherImpl : public CryptAuthAccessTokenFetcher, | 19 class CryptAuthAccessTokenFetcherImpl : public CryptAuthAccessTokenFetcher, |
| 19 public OAuth2TokenService::Consumer { | 20 public OAuth2TokenService::Consumer { |
| 20 public: | 21 public: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 38 // Not owned. | 39 // Not owned. |
| 39 OAuth2TokenService* token_service_; | 40 OAuth2TokenService* token_service_; |
| 40 | 41 |
| 41 // The account id for whom to mint the token. | 42 // The account id for whom to mint the token. |
| 42 std::string account_id_; | 43 std::string account_id_; |
| 43 | 44 |
| 44 // True if FetchAccessToken() has been called. | 45 // True if FetchAccessToken() has been called. |
| 45 bool fetch_started_; | 46 bool fetch_started_; |
| 46 | 47 |
| 47 // Stores the request from |token_service_| to mint the token. | 48 // Stores the request from |token_service_| to mint the token. |
| 48 scoped_ptr<OAuth2TokenService::Request> token_request_; | 49 std::unique_ptr<OAuth2TokenService::Request> token_request_; |
| 49 | 50 |
| 50 // Callback to invoke when the token fetch succeeds or fails. | 51 // Callback to invoke when the token fetch succeeds or fails. |
| 51 AccessTokenCallback callback_; | 52 AccessTokenCallback callback_; |
| 52 | 53 |
| 53 DISALLOW_COPY_AND_ASSIGN(CryptAuthAccessTokenFetcherImpl); | 54 DISALLOW_COPY_AND_ASSIGN(CryptAuthAccessTokenFetcherImpl); |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 } // namespace proximity_auth | 57 } // namespace proximity_auth |
| 57 | 58 |
| 58 #endif // COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ACCESS_TOKEN_FETCHER_IMPL_H | 59 #endif // COMPONENTS_PROXIMITY_AUTH_CRYPTAUTH_ACCESS_TOKEN_FETCHER_IMPL_H |
| OLD | NEW |