| 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 | 11 |
| 12 // Handles method calls delegated back to chrome from ash. Also notifies ash of | 12 // Handles method calls sent from ash to chrome. Also sends messages from chrome |
| 13 // relevant state changes in chrome. | 13 // to ash. |
| 14 class LockScreenClient : public ash::mojom::LockScreenClient { | 14 class LockScreenClient : public ash::mojom::LockScreenClient { |
| 15 public: | 15 public: |
| 16 LockScreenClient(); | 16 LockScreenClient(); |
| 17 ~LockScreenClient() override; | 17 ~LockScreenClient() override; |
| 18 | 18 |
| 19 // Handles method calls coming from ash into chrome. | 19 // Handles method calls coming from ash into chrome. |
| 20 class Delegate { | 20 class Delegate { |
| 21 public: | 21 public: |
| 22 Delegate(); | 22 Delegate(); |
| 23 virtual ~Delegate(); | 23 virtual ~Delegate(); |
| 24 virtual void HandleAttemptUnlock(const AccountId& account_id) = 0; | 24 virtual void HandleAttemptUnlock(const AccountId& account_id) = 0; |
| 25 virtual void HandleHardlockPod(const AccountId& account_id) = 0; | 25 virtual void HandleHardlockPod(const AccountId& account_id) = 0; |
| 26 virtual void HandleRecordClickOnLockIcon(const AccountId& account_id) = 0; | 26 virtual void HandleRecordClickOnLockIcon(const AccountId& account_id) = 0; |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 DISALLOW_COPY_AND_ASSIGN(Delegate); | 29 DISALLOW_COPY_AND_ASSIGN(Delegate); |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 static LockScreenClient* Get(); | 32 static LockScreenClient* Get(); |
| 33 | 33 |
| 34 // ash::mojom::LockScreenClient: | 34 // ash::mojom::LockScreenClient: |
| 35 void AuthenticateUser(const AccountId& account_id, | 35 void AuthenticateUser(const AccountId& account_id, |
| 36 const std::string& hashed_password, | 36 const std::string& hashed_password, |
| 37 bool authenticated_by_pin) override; | 37 bool authenticated_by_pin, |
| 38 AuthenticateUserCallback callback) override; |
| 38 void AttemptUnlock(const AccountId& account_id) override; | 39 void AttemptUnlock(const AccountId& account_id) override; |
| 39 void HardlockPod(const AccountId& account_id) override; | 40 void HardlockPod(const AccountId& account_id) override; |
| 40 void RecordClickOnLockIcon(const AccountId& account_id) override; | 41 void RecordClickOnLockIcon(const AccountId& account_id) override; |
| 41 | 42 |
| 42 // Wrappers around the mojom::LockScreen interface. | 43 // Wrappers around the mojom::LockScreen interface. |
| 44 void ShowLockScreen(ash::mojom::LockScreen::ShowLockScreenCallback on_shown); |
| 43 void ShowErrorMessage(int32_t login_attempts, | 45 void ShowErrorMessage(int32_t login_attempts, |
| 44 const std::string& error_text, | 46 const std::string& error_text, |
| 45 const std::string& help_link_text, | 47 const std::string& help_link_text, |
| 46 int32_t help_topic_id); | 48 int32_t help_topic_id); |
| 47 void ClearErrors(); | 49 void ClearErrors(); |
| 48 void ShowUserPodCustomIcon(const AccountId& account_id, | 50 void ShowUserPodCustomIcon(const AccountId& account_id, |
| 49 ash::mojom::UserPodCustomIconOptionsPtr icon); | 51 ash::mojom::UserPodCustomIconOptionsPtr icon); |
| 50 void HideUserPodCustomIcon(const AccountId& account_id); | 52 void HideUserPodCustomIcon(const AccountId& account_id); |
| 51 void SetAuthType(const AccountId& account_id, | 53 void SetAuthType(const AccountId& account_id, |
| 52 ash::mojom::AuthType auth_type, | 54 ash::mojom::AuthType auth_type, |
| 53 const base::string16& initial_value); | 55 const base::string16& initial_value); |
| 54 void LoadUsers(std::unique_ptr<base::ListValue> users_list, bool show_guest); | 56 void LoadUsers(std::unique_ptr<base::ListValue> users_list, bool show_guest); |
| 55 | 57 |
| 56 void SetDelegate(Delegate* delegate); | 58 void SetDelegate(Delegate* delegate); |
| 57 | 59 |
| 58 private: | 60 private: |
| 59 // Lock screen mojo service in ash. | 61 // Lock screen mojo service in ash. |
| 60 ash::mojom::LockScreenPtr lock_screen_; | 62 ash::mojom::LockScreenPtr lock_screen_; |
| 61 | 63 |
| 62 // Binds this object to the client interface. | 64 // Binds this object to the client interface. |
| 63 mojo::Binding<ash::mojom::LockScreenClient> binding_; | 65 mojo::Binding<ash::mojom::LockScreenClient> binding_; |
| 64 Delegate* delegate_ = nullptr; | 66 Delegate* delegate_ = nullptr; |
| 65 | 67 |
| 66 DISALLOW_COPY_AND_ASSIGN(LockScreenClient); | 68 DISALLOW_COPY_AND_ASSIGN(LockScreenClient); |
| 67 }; | 69 }; |
| 68 | 70 |
| 69 #endif // CHROME_BROWSER_UI_ASH_LOCK_SCREEN_CLIENT_H_ | 71 #endif // CHROME_BROWSER_UI_ASH_LOCK_SCREEN_CLIENT_H_ |
| OLD | NEW |