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, or request to clear |
| 41 // errors if auth succeeds. |
| 42 void AuthenticateUser(const AccountId& account_id, |
| 43 const std::string& password, |
| 44 bool authenticated_by_pin); |
| 45 |
| 46 private: |
| 47 void DoAuthenticateUser(const AccountId& account_id, |
| 48 const std::string& password, |
| 49 bool authenticated_by_pin, |
| 50 const std::string& system_salt); |
| 51 |
| 52 // Client interface in chrome browser. May be null in tests. |
| 53 mojom::LockScreenClientPtr lock_screen_client_; |
| 54 |
| 55 // Bindings for the LockScreen interface. |
| 56 mojo::BindingSet<mojom::LockScreen> bindings_; |
| 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(LockScreenController); |
| 59 }; |
| 60 |
| 61 } // namspace ash |
| 62 |
| 63 #endif // ASH_LOGIN_LOCK_SCREEN_CONTROLLER_H_ |
OLD | NEW |