1 // Copyright 2015 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 #include "components/proximity_auth/cryptauth/cryptauth_client_factory.h"
7 #include "components/proximity_auth/cryptauth/cryptauth_account_token_fetcher.h"
9 namespace proximity_auth
{
11 CryptAuthClientFactory::CryptAuthClientFactory(
12 OAuth2TokenService
* token_service
,
13 const std::string
& account_id
,
14 scoped_refptr
<net::URLRequestContextGetter
> url_request_context
,
15 const cryptauth::DeviceClassifier
& device_classifier
)
16 : token_service_(token_service
),
17 account_id_(account_id
),
18 url_request_context_(url_request_context
),
19 device_classifier_(device_classifier
) {
22 CryptAuthClientFactory::~CryptAuthClientFactory() {
25 scoped_ptr
<CryptAuthClient
> CryptAuthClientFactory::CreateInstance() {
26 scoped_ptr
<CryptAuthAccessTokenFetcher
> access_token_fetcher(
27 new CryptAuthAccountTokenFetcher(token_service_
, account_id_
));
28 return make_scoped_ptr(new CryptAuthClient(
29 access_token_fetcher
.Pass(), url_request_context_
, device_classifier_
));
32 } // namespace proximity_auth