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 #ifndef COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_CLIENT_H_
6 #define COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_CLIENT_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "components/proximity_auth/cryptauth/proto/cryptauth_api.pb.h"
12 #include "components/proximity_auth/screenlock_state.h"
16 namespace proximity_auth
{
18 class CryptAuthClientFactory
;
19 class CryptAuthDeviceManager
;
20 class CryptAuthEnrollmentManager
;
21 class SecureMessageDelegate
;
23 // An interface that needs to be supplied to the Proximity Auth component by its
24 // embedder. There should be one |ProximityAuthClient| per
25 // |content::BrowserContext|.
26 class ProximityAuthClient
{
28 virtual ~ProximityAuthClient() {}
30 // Returns the authenticated username.
31 virtual std::string
GetAuthenticatedUsername() const = 0;
33 // Updates the user pod on the signin or lock screen to reflect the provided
35 virtual void UpdateScreenlockState(ScreenlockState state
) = 0;
37 // Finalizes an unlock attempt initiated by the user. If |success| is true,
38 // the screen is unlocked; otherwise, the auth attempt is rejected. An auth
39 // attempt must be in progress before calling this function.
40 virtual void FinalizeUnlock(bool success
) = 0;
42 // Finalizes a sign-in attempt initiated by the user. If |success| is true,
43 // the user is signed in; otherwise, the auth attempt is rejected. An auth
44 // attempt must be in progress before calling this function.
45 virtual void FinalizeSignin(const std::string
& secret
) = 0;
47 // Returns the PrefService used by the profile.
48 virtual PrefService
* GetPrefService() = 0;
50 // Returns the SecureMessageDelegate used by the system.
51 virtual scoped_ptr
<SecureMessageDelegate
> CreateSecureMessageDelegate() = 0;
53 // Constructs the CryptAuthClientFactory that can be used for API requests.
54 virtual scoped_ptr
<CryptAuthClientFactory
> CreateCryptAuthClientFactory() = 0;
56 // Constructs the DeviceClassifier message that is sent to CryptAuth for all
58 virtual cryptauth::DeviceClassifier
GetDeviceClassifier() = 0;
60 // Returns the account id of the user.
61 virtual std::string
GetAccountId() = 0;
63 virtual proximity_auth::CryptAuthEnrollmentManager
*
64 GetCryptAuthEnrollmentManager() = 0;
66 virtual proximity_auth::CryptAuthDeviceManager
*
67 GetCryptAuthDeviceManager() = 0;
70 } // namespace proximity_auth
72 #endif // COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_CLIENT_H_