OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_UI_ASH_LOCK_SCREEN_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LOCK_SCREEN_CLIENT_H_ |
6 #define CHROME_BROWSER_UI_ASH_LOCK_SCREEN_CLIENT_H_ | 6 #define CHROME_BROWSER_UI_ASH_LOCK_SCREEN_CLIENT_H_ |
7 | 7 |
8 #include "ash/public/interfaces/lock_screen.mojom.h" | 8 #include "ash/public/interfaces/lock_screen.mojom.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "mojo/public/cpp/bindings/binding.h" | 10 #include "mojo/public/cpp/bindings/binding.h" |
| 11 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 12 |
| 13 using AuthenticateUserCallback = |
| 14 ash::mojom::LockScreenClient::AuthenticateUserCallback; |
11 | 15 |
12 // Handles method calls sent from ash to chrome. Also sends messages from chrome | 16 // Handles method calls sent from ash to chrome. Also sends messages from chrome |
13 // to ash. | 17 // to ash. |
14 class LockScreenClient : public ash::mojom::LockScreenClient { | 18 class LockScreenClient : public ash::mojom::LockScreenClient { |
15 public: | 19 public: |
16 LockScreenClient(); | 20 LockScreenClient(); |
17 ~LockScreenClient() override; | 21 ~LockScreenClient() override; |
18 | 22 |
19 // Handles method calls coming from ash into chrome. | 23 // Handles method calls coming from ash into chrome. |
20 class Delegate { | 24 class Delegate { |
21 public: | 25 public: |
22 Delegate(); | 26 Delegate(); |
23 virtual ~Delegate(); | 27 virtual ~Delegate(); |
| 28 virtual void HandleAuthenticateUser(const AccountId& account_id, |
| 29 const std::string& hashed_password, |
| 30 bool authenticated_by_pin, |
| 31 AuthenticateUserCallback callback) = 0; |
24 virtual void HandleAttemptUnlock(const AccountId& account_id) = 0; | 32 virtual void HandleAttemptUnlock(const AccountId& account_id) = 0; |
25 virtual void HandleHardlockPod(const AccountId& account_id) = 0; | 33 virtual void HandleHardlockPod(const AccountId& account_id) = 0; |
26 virtual void HandleRecordClickOnLockIcon(const AccountId& account_id) = 0; | 34 virtual void HandleRecordClickOnLockIcon(const AccountId& account_id) = 0; |
| 35 virtual void HandleOnFocusPod(const AccountId& account_id) = 0; |
| 36 virtual void HandleOnNoPodFocused() = 0; |
27 | 37 |
28 private: | 38 private: |
29 DISALLOW_COPY_AND_ASSIGN(Delegate); | 39 DISALLOW_COPY_AND_ASSIGN(Delegate); |
30 }; | 40 }; |
31 | 41 |
32 static LockScreenClient* Get(); | 42 static LockScreenClient* Get(); |
33 | 43 |
34 // ash::mojom::LockScreenClient: | 44 // ash::mojom::LockScreenClient: |
35 void AuthenticateUser(const AccountId& account_id, | 45 void AuthenticateUser(const AccountId& account_id, |
36 const std::string& hashed_password, | 46 const std::string& hashed_password, |
37 bool authenticated_by_pin, | 47 bool authenticated_by_pin, |
38 AuthenticateUserCallback callback) override; | 48 AuthenticateUserCallback callback) override; |
39 void AttemptUnlock(const AccountId& account_id) override; | 49 void AttemptUnlock(const AccountId& account_id) override; |
40 void HardlockPod(const AccountId& account_id) override; | 50 void HardlockPod(const AccountId& account_id) override; |
41 void RecordClickOnLockIcon(const AccountId& account_id) override; | 51 void RecordClickOnLockIcon(const AccountId& account_id) override; |
| 52 void OnFocusPod(const AccountId& account_id) override; |
| 53 void OnNoPodFocused() override; |
| 54 void LoadWallpaper(const AccountId& account_id) override; |
| 55 void SignOutUser() override; |
| 56 void OnMaxIncorrectPasswordAttempted(const AccountId& account_id) override; |
42 | 57 |
43 // Wrappers around the mojom::LockScreen interface. | 58 // Wrappers around the mojom::LockScreen interface. |
44 void ShowLockScreen(ash::mojom::LockScreen::ShowLockScreenCallback on_shown); | 59 void ShowLockScreen(ash::mojom::LockScreen::ShowLockScreenCallback on_shown); |
45 void ShowErrorMessage(int32_t login_attempts, | 60 void ShowErrorMessage(int32_t login_attempts, |
46 const std::string& error_text, | 61 const std::string& error_text, |
47 const std::string& help_link_text, | 62 const std::string& help_link_text, |
48 int32_t help_topic_id); | 63 int32_t help_topic_id); |
49 void ClearErrors(); | 64 void ClearErrors(); |
50 void ShowUserPodCustomIcon(const AccountId& account_id, | 65 void ShowUserPodCustomIcon(const AccountId& account_id, |
51 ash::mojom::UserPodCustomIconOptionsPtr icon); | 66 ash::mojom::UserPodCustomIconOptionsPtr icon); |
52 void HideUserPodCustomIcon(const AccountId& account_id); | 67 void HideUserPodCustomIcon(const AccountId& account_id); |
53 void SetAuthType(const AccountId& account_id, | 68 void SetAuthType(const AccountId& account_id, |
54 ash::mojom::AuthType auth_type, | 69 ash::mojom::AuthType auth_type, |
55 const base::string16& initial_value); | 70 const base::string16& initial_value); |
56 void LoadUsers(std::unique_ptr<base::ListValue> users_list, bool show_guest); | 71 void LoadUsers(std::unique_ptr<base::ListValue> users_list, bool show_guest); |
| 72 void SetPinEnabledForUser(const AccountId& account_id, bool is_enabled); |
57 | 73 |
58 void SetDelegate(Delegate* delegate); | 74 void SetDelegate(Delegate* delegate); |
59 | 75 |
60 private: | 76 private: |
61 // Lock screen mojo service in ash. | 77 // Lock screen mojo service in ash. |
62 ash::mojom::LockScreenPtr lock_screen_; | 78 ash::mojom::LockScreenPtr lock_screen_; |
63 | 79 |
64 // Binds this object to the client interface. | 80 // Binds this object to the client interface. |
65 mojo::Binding<ash::mojom::LockScreenClient> binding_; | 81 mojo::Binding<ash::mojom::LockScreenClient> binding_; |
66 Delegate* delegate_ = nullptr; | 82 Delegate* delegate_ = nullptr; |
67 | 83 |
68 DISALLOW_COPY_AND_ASSIGN(LockScreenClient); | 84 DISALLOW_COPY_AND_ASSIGN(LockScreenClient); |
69 }; | 85 }; |
70 | 86 |
71 #endif // CHROME_BROWSER_UI_ASH_LOCK_SCREEN_CLIENT_H_ | 87 #endif // CHROME_BROWSER_UI_ASH_LOCK_SCREEN_CLIENT_H_ |
OLD | NEW |