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