Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: components/proximity_auth/cryptauth/cryptauth_client_factory.h

Issue 1066453002: Refactor CryptAuth component to be more testable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cryptauth_securemessage
Patch Set: rename tests Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef COMPONENTS_PROXIMITY_AUTH_CRYPT_AUTH_CLIENT_FACTORY_H
6 #define COMPONENTS_PROXIMITY_AUTH_CRYPT_AUTH_CLIENT_FACTORY_H
7
8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "components/proximity_auth/cryptauth/cryptauth_client.h"
11 #include "components/proximity_auth/cryptauth/proto/cryptauth_api.pb.h"
12 #include "google_apis/gaia/oauth2_token_service.h"
13 #include "net/url_request/url_request_context_getter.h"
14
15 namespace proximity_auth {
16
17 class CryptAuthClient;
18
19 // Factory for creating CryptAuthClient instances. Because each CryptAuthClient
20 // instance can only be used for one API call, this class helps making multiple
21 // requests in sequence or parallel easier.
22 class CryptAuthClientFactory {
23 public:
24 // Creates the factory.
25 // |token_service|: Gets the user's access token.
26 // Needs to outlive this object.
27 // |account_id|: The account id of the user.
28 // |url_request_context|: The request context to make the HTTP requests.
29 // |device_classifier|: Contains basic device information of the client.
30 CryptAuthClientFactory(
31 OAuth2TokenService* token_service,
32 const std::string& account_id,
33 scoped_refptr<net::URLRequestContextGetter> url_request_context,
34 const cryptauth::DeviceClassifier& device_classifier);
35 virtual ~CryptAuthClientFactory();
36
37 // Creates and returns a CryptAuthClient instance that is owned by the caller.
38 scoped_ptr<CryptAuthClient> CreateInstance();
39
40 private:
41 OAuth2TokenService* token_service_;
42 const std::string account_id_;
43 const scoped_refptr<net::URLRequestContextGetter> url_request_context_;
44 const cryptauth::DeviceClassifier device_classifier_;
45
46 DISALLOW_COPY_AND_ASSIGN(CryptAuthClientFactory);
47 };
48
49 } // namespace proximity_auth
50
51 #endif // COMPONENTS_PROXIMITY_AUTH_CRYPT_AUTH_CLIENT_FACTORY_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698