Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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 ASH_LOGIN_LOCK_SCREEN_CONTROLLER_H_ | |
| 6 #define ASH_LOGIN_LOCK_SCREEN_CONTROLLER_H_ | |
| 7 | |
| 8 #include "ash/ash_export.h" | |
| 9 #include "ash/public/interfaces/lock_screen.mojom.h" | |
| 10 #include "base/macros.h" | |
| 11 #include "mojo/public/cpp/bindings/binding_set.h" | |
| 12 | |
| 13 namespace ash { | |
| 14 | |
| 15 // LockScreenController implements mojom::LockScreen and wraps the | |
| 16 // mojom::LockScreenClient interface. This lets a consumer of ash provide a | |
| 17 // LockScreenClient, which we will dispatch to if one has been provided to us. | |
| 18 // This could send requests to LockScreenClient and also handle requests from | |
| 19 // LockScreenClient through mojo. | |
| 20 class ASH_EXPORT LockScreenController | |
| 21 : NON_EXPORTED_BASE(public mojom::LockScreen) { | |
| 22 public: | |
| 23 LockScreenController(); | |
| 24 ~LockScreenController() override; | |
| 25 | |
| 26 // Binds the mojom::LockScreen interface to this object. | |
| 27 void BindRequest(mojom::LockScreenRequest request); | |
| 28 | |
| 29 // mojom::LockScreen: | |
| 30 void SetClient(mojom::LockScreenClientPtr client) override; | |
| 31 void ShowErrorMessage(int32_t login_attempts, | |
| 32 const std::string& error_text, | |
| 33 const std::string& help_link_text, | |
| 34 int32_t help_topic_id) override; | |
| 35 void ClearErrors() override; | |
| 36 | |
| 37 // Wrappers around the mojom::SystemTrayClient interface. | |
| 38 // Hash the password and send AuthenticateUser request to LockScreenClient. | |
| 39 // LockScreenClient(chrome) will do the authentication and request to show | |
| 40 // error messages in the lock screen if auth fails. | |
|
xiyuan
2017/05/16 18:22:25
nit: also document what happens if auth succeeds.
xiaoyinh(OOO Sep 11-29)
2017/05/16 21:11:30
Done.
| |
| 41 void AuthenticateUser(const AccountId& account_id, | |
| 42 const std::string& password, | |
| 43 bool authenticated_by_pin); | |
| 44 | |
| 45 private: | |
| 46 void DoAuthenticateUser(const AccountId& account_id, | |
| 47 const std::string& password, | |
| 48 bool authenticated_by_pin, | |
| 49 const std::string& system_salt); | |
| 50 | |
| 51 // Client interface in chrome browser. May be null in tests. | |
| 52 mojom::LockScreenClientPtr lock_screen_client_; | |
| 53 | |
| 54 // Bindings for the LockScreen interface. | |
| 55 mojo::BindingSet<mojom::LockScreen> bindings_; | |
| 56 | |
| 57 DISALLOW_COPY_AND_ASSIGN(LockScreenController); | |
| 58 }; | |
| 59 | |
| 60 } // namspace ash | |
| 61 | |
| 62 #endif // ASH_LOGIN_LOCK_SCREEN_CONTROLLER_H_ | |
| OLD | NEW |