Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "base/memory/weak_ptr.h" | |
| 11 #include "chrome/browser/chromeos/login/ui/views/user_board_view.h" | |
| 10 #include "mojo/public/cpp/bindings/binding.h" | 12 #include "mojo/public/cpp/bindings/binding.h" |
| 11 | 13 |
| 12 // Handles method calls delegated back to chrome from ash. Also notifies ash of | 14 // Handles method calls delegated back to chrome from ash. Also notifies ash of |
| 13 // relevant state changes in chrome. | 15 // relevant state changes in chrome. |
| 14 class LockScreenClient : public ash::mojom::LockScreenClient { | 16 class LockScreenClient : public ash::mojom::LockScreenClient, |
| 17 public chromeos::UserBoardView { | |
| 15 public: | 18 public: |
| 16 LockScreenClient(); | 19 LockScreenClient(); |
| 17 ~LockScreenClient() override; | 20 ~LockScreenClient() override; |
| 18 | 21 |
| 22 class Delegate { | |
|
jdufault
2017/05/26 18:59:10
Add comment - what is the purpose of this delegate
xiaoyinh(OOO Sep 11-29)
2017/05/30 22:23:50
Done. Let me know if this is clear to you.
| |
| 23 public: | |
| 24 Delegate(); | |
| 25 virtual ~Delegate(); | |
| 26 virtual void HandleAttemptUnlock(const AccountId& account_id) = 0; | |
| 27 virtual void HandleHardlockPod(const AccountId& account_id) = 0; | |
| 28 virtual void HandleRecordClickOnLockIcon(const AccountId& account_id) = 0; | |
| 29 | |
| 30 private: | |
| 31 DISALLOW_COPY_AND_ASSIGN(Delegate); | |
| 32 }; | |
| 33 | |
| 19 static LockScreenClient* Get(); | 34 static LockScreenClient* Get(); |
| 20 | 35 |
| 21 // ash::mojom::LockScreenClient: | 36 // ash::mojom::LockScreenClient: |
| 22 void AuthenticateUser(const AccountId& account_id, | 37 void AuthenticateUser(const AccountId& account_id, |
| 23 const std::string& hashed_password, | 38 const std::string& hashed_password, |
| 24 bool authenticated_by_pin) override; | 39 bool authenticated_by_pin) override; |
| 40 void AttemptUnlock(const AccountId& account_id) override; | |
| 41 void HardlockPod(const AccountId& account_id) override; | |
| 42 void RecordClickOnLockIcon(const AccountId& account_id) override; | |
| 43 | |
| 44 // UserBoardView: | |
| 45 void SetPublicSessionDisplayName(const AccountId& account_id, | |
| 46 const std::string& display_name) override{}; | |
| 47 void SetPublicSessionLocales(const AccountId& account_id, | |
| 48 std::unique_ptr<base::ListValue> locales, | |
| 49 const std::string& default_locale, | |
| 50 bool multiple_recommended_locales) override{}; | |
| 51 void ShowBannerMessage(const base::string16& message) override{}; | |
| 52 void ShowUserPodCustomIcon(const AccountId& account_id, | |
| 53 const base::DictionaryValue& icon) override; | |
| 54 void HideUserPodCustomIcon(const AccountId& account_id) override; | |
| 55 void SetAuthType( | |
| 56 const AccountId& account_id, | |
| 57 proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, | |
| 58 const base::string16& initial_value) override; | |
| 59 void Bind(chromeos::UserSelectionScreen* screen) override{}; | |
| 60 void Unbind() override{}; | |
| 61 base::WeakPtr<UserBoardView> GetWeakPtr() override; | |
| 25 | 62 |
| 26 // Wrappers around the mojom::SystemTray interface. | 63 // Wrappers around the mojom::SystemTray interface. |
| 27 void ShowErrorMessage(int32_t login_attempts, | 64 void ShowErrorMessage(int32_t login_attempts, |
| 28 const std::string& error_text, | 65 const std::string& error_text, |
| 29 const std::string& help_link_text, | 66 const std::string& help_link_text, |
| 30 int32_t help_topic_id); | 67 int32_t help_topic_id); |
| 31 void ClearErrors(); | 68 void ClearErrors(); |
| 69 void LoadUsers(const base::ListValue& users_list, bool show_guest); | |
| 70 void SetDelegate(Delegate* delegate); | |
| 32 | 71 |
| 33 private: | 72 private: |
| 34 // Lock screen mojo service in ash. | 73 // Lock screen mojo service in ash. |
| 35 ash::mojom::LockScreenPtr lock_screen_; | 74 ash::mojom::LockScreenPtr lock_screen_; |
| 36 | 75 |
| 37 // Binds this object to the client interface. | 76 // Binds this object to the client interface. |
| 38 mojo::Binding<ash::mojom::LockScreenClient> binding_; | 77 mojo::Binding<ash::mojom::LockScreenClient> binding_; |
| 78 Delegate* delegate_ = nullptr; | |
| 39 | 79 |
| 40 DISALLOW_COPY_AND_ASSIGN(LockScreenClient); | 80 DISALLOW_COPY_AND_ASSIGN(LockScreenClient); |
| 41 }; | 81 }; |
| 42 | 82 |
| 43 #endif // CHROME_BROWSER_UI_ASH_LOCK_SCREEN_CLIENT_H_ | 83 #endif // CHROME_BROWSER_UI_ASH_LOCK_SCREEN_CLIENT_H_ |
| OLD | NEW |