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

Side by Side Diff: components/proximity_auth/proximity_auth_client.h

Issue 1316543003: Refactor ProximityAuthUIDelegate functions to ProximityAuthClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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_CLIENT_H_ 5 #ifndef COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_CLIENT_H_
6 #define COMPONENTS_PROXIMITY_AUTH_CLIENT_H_ 6 #define COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_CLIENT_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h"
11 #include "components/proximity_auth/cryptauth/proto/cryptauth_api.pb.h"
10 #include "components/proximity_auth/screenlock_state.h" 12 #include "components/proximity_auth/screenlock_state.h"
11 13
14 class PrefService;
15
12 namespace proximity_auth { 16 namespace proximity_auth {
13 17
18 class CryptAuthClientFactory;
19 class CryptAuthDeviceManager;
20 class CryptAuthEnrollmentManager;
21 class SecureMessageDelegate;
22
14 // An interface that needs to be supplied to the Proximity Auth component by its 23 // An interface that needs to be supplied to the Proximity Auth component by its
15 // embedder. There should be one |ProximityAuthClient| per 24 // embedder. There should be one |ProximityAuthClient| per
16 // |content::BrowserContext|. 25 // |content::BrowserContext|.
17 class ProximityAuthClient { 26 class ProximityAuthClient {
18 public: 27 public:
19 virtual ~ProximityAuthClient() {} 28 virtual ~ProximityAuthClient() {}
20 29
21 // Returns the authenticated username. 30 // Returns the authenticated username.
22 virtual std::string GetAuthenticatedUsername() const = 0; 31 virtual std::string GetAuthenticatedUsername() const = 0;
23 32
24 // Updates the user pod on the signin or lock screen to reflect the provided 33 // Updates the user pod on the signin or lock screen to reflect the provided
25 // screenlock state. 34 // screenlock state.
26 virtual void UpdateScreenlockState(ScreenlockState state) = 0; 35 virtual void UpdateScreenlockState(ScreenlockState state) = 0;
27 36
28 // Finalizes an unlock attempt initiated by the user. If |success| is true, 37 // Finalizes an unlock attempt initiated by the user. If |success| is true,
29 // the screen is unlocked; otherwise, the auth attempt is rejected. An auth 38 // the screen is unlocked; otherwise, the auth attempt is rejected. An auth
30 // attempt must be in progress before calling this function. 39 // attempt must be in progress before calling this function.
31 virtual void FinalizeUnlock(bool success) = 0; 40 virtual void FinalizeUnlock(bool success) = 0;
32 41
33 // Finalizes a sign-in attempt initiated by the user. If |success| is true, 42 // Finalizes a sign-in attempt initiated by the user. If |success| is true,
34 // the user is signed in; otherwise, the auth attempt is rejected. An auth 43 // the user is signed in; otherwise, the auth attempt is rejected. An auth
35 // attempt must be in progress before calling this function. 44 // attempt must be in progress before calling this function.
36 virtual void FinalizeSignin(const std::string& secret) = 0; 45 virtual void FinalizeSignin(const std::string& secret) = 0;
46
47 // Returns the PrefService used by the profile.
48 virtual PrefService* GetPrefService() = 0;
49
50 // Returns the SecureMessageDelegate used by the system.
51 virtual scoped_ptr<SecureMessageDelegate> CreateSecureMessageDelegate() = 0;
52
53 // Constructs the CryptAuthClientFactory that can be used for API requests.
54 virtual scoped_ptr<CryptAuthClientFactory> CreateCryptAuthClientFactory() = 0;
55
56 // Constructs the DeviceClassifier message that is sent to CryptAuth for all
57 // API requests.
58 virtual cryptauth::DeviceClassifier GetDeviceClassifier() = 0;
59
60 // Returns the account id of the user.
61 virtual std::string GetAccountId() = 0;
62
63 virtual proximity_auth::CryptAuthEnrollmentManager*
64 GetCryptAuthEnrollmentManager() = 0;
65
66 virtual proximity_auth::CryptAuthDeviceManager*
67 GetCryptAuthDeviceManager() = 0;
37 }; 68 };
38 69
39 } // namespace proximity_auth 70 } // namespace proximity_auth
40 71
41 #endif // COMPONENTS_PROXIMITY_AUTH_CLIENT_H_ 72 #endif // COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698