OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/login/ui/models/user_board_model.h" | 7 #include "chrome/browser/chromeos/login/ui/models/user_board_model.h" |
8 #include "components/login/localized_values_builder.h" | 8 #include "components/login/localized_values_builder.h" |
| 9 #include "components/user_manager/user_id.h" |
9 | 10 |
10 namespace chromeos { | 11 namespace chromeos { |
11 | 12 |
12 UserBoardScreenHandler::UserBoardScreenHandler() : model_(nullptr) { | 13 UserBoardScreenHandler::UserBoardScreenHandler() : model_(nullptr) { |
13 } | 14 } |
14 | 15 |
15 UserBoardScreenHandler::~UserBoardScreenHandler() { | 16 UserBoardScreenHandler::~UserBoardScreenHandler() { |
16 } | 17 } |
17 | 18 |
18 void UserBoardScreenHandler::DeclareLocalizedValues( | 19 void UserBoardScreenHandler::DeclareLocalizedValues( |
(...skipping 11 matching lines...) Expand all Loading... |
30 void UserBoardScreenHandler::Initialize() { | 31 void UserBoardScreenHandler::Initialize() { |
31 } | 32 } |
32 | 33 |
33 //----------------- Handlers | 34 //----------------- Handlers |
34 | 35 |
35 void UserBoardScreenHandler::HandleGetUsers() { | 36 void UserBoardScreenHandler::HandleGetUsers() { |
36 CHECK(model_); | 37 CHECK(model_); |
37 model_->SendUserList(); | 38 model_->SendUserList(); |
38 } | 39 } |
39 | 40 |
40 void UserBoardScreenHandler::HandleHardlockPod(const std::string& user_id) { | 41 void UserBoardScreenHandler::HandleHardlockPod(const std::string& user_email) { |
41 CHECK(model_); | 42 CHECK(model_); |
42 model_->HardLockPod(user_id); | 43 model_->HardLockPod(user_manager::UserID::FromUserEmail(user_email)); |
43 } | 44 } |
44 | 45 |
45 void UserBoardScreenHandler::HandleAttemptUnlock(const std::string& user_id) { | 46 void UserBoardScreenHandler::HandleAttemptUnlock(const std::string& user_email)
{ |
46 CHECK(model_); | 47 CHECK(model_); |
47 model_->AttemptEasyUnlock(user_id); | 48 model_->AttemptEasyUnlock(user_manager::UserID::FromUserEmail(user_email)); |
48 } | 49 } |
49 | 50 |
50 void UserBoardScreenHandler::HandleRecordClickOnLockIcon( | 51 void UserBoardScreenHandler::HandleRecordClickOnLockIcon( |
51 const std::string& user_id) { | 52 const std::string& user_email) { |
52 CHECK(model_); | 53 CHECK(model_); |
53 model_->RecordClickOnLockIcon(user_id); | 54 model_->RecordClickOnLockIcon(user_manager::UserID::FromUserEmail(user_email))
; |
54 } | 55 } |
55 | 56 |
56 //----------------- API | 57 //----------------- API |
57 | 58 |
58 void UserBoardScreenHandler::SetPublicSessionDisplayName( | 59 void UserBoardScreenHandler::SetPublicSessionDisplayName( |
59 const std::string& user_id, | 60 const user_manager::UserID& user_id, |
60 const std::string& display_name) { | 61 const std::string& display_name) { |
61 CallJS("login.AccountPickerScreen.setPublicSessionDisplayName", user_id, | 62 CallJS("login.AccountPickerScreen.setPublicSessionDisplayName", user_id.GetUse
rEmail(), |
62 display_name); | 63 display_name); |
63 } | 64 } |
64 | 65 |
65 void UserBoardScreenHandler::SetPublicSessionLocales( | 66 void UserBoardScreenHandler::SetPublicSessionLocales( |
66 const std::string& user_id, | 67 const user_manager::UserID& user_id, |
67 scoped_ptr<base::ListValue> locales, | 68 scoped_ptr<base::ListValue> locales, |
68 const std::string& default_locale, | 69 const std::string& default_locale, |
69 bool multiple_recommended_locales) { | 70 bool multiple_recommended_locales) { |
70 CallJS("login.AccountPickerScreen.setPublicSessionLocales", user_id, *locales, | 71 CallJS("login.AccountPickerScreen.setPublicSessionLocales", user_id.GetUserEma
il(), *locales, |
71 default_locale, multiple_recommended_locales); | 72 default_locale, multiple_recommended_locales); |
72 } | 73 } |
73 | 74 |
74 void UserBoardScreenHandler::ShowBannerMessage(const base::string16& message) { | 75 void UserBoardScreenHandler::ShowBannerMessage(const base::string16& message) { |
75 CallJS("login.AccountPickerScreen.showBannerMessage", message); | 76 CallJS("login.AccountPickerScreen.showBannerMessage", message); |
76 } | 77 } |
77 | 78 |
78 void UserBoardScreenHandler::ShowUserPodCustomIcon( | 79 void UserBoardScreenHandler::ShowUserPodCustomIcon( |
79 const std::string& user_id, | 80 const user_manager::UserID& user_id, |
80 const base::DictionaryValue& icon) { | 81 const base::DictionaryValue& icon) { |
81 CallJS("login.AccountPickerScreen.showUserPodCustomIcon", user_id, icon); | 82 CallJS("login.AccountPickerScreen.showUserPodCustomIcon", user_id.GetUserEmail
(), icon); |
82 } | 83 } |
83 | 84 |
84 void UserBoardScreenHandler::HideUserPodCustomIcon(const std::string& user_id) { | 85 void UserBoardScreenHandler::HideUserPodCustomIcon(const user_manager::UserID& u
ser_id) { |
85 CallJS("login.AccountPickerScreen.hideUserPodCustomIcon", user_id); | 86 CallJS("login.AccountPickerScreen.hideUserPodCustomIcon", user_id.GetUserEmail
()); |
86 } | 87 } |
87 | 88 |
88 void UserBoardScreenHandler::SetAuthType( | 89 void UserBoardScreenHandler::SetAuthType( |
89 const std::string& user_id, | 90 const user_manager::UserID& user_id, |
90 proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, | 91 proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, |
91 const base::string16& initial_value) { | 92 const base::string16& initial_value) { |
92 CallJS("login.AccountPickerScreen.setAuthType", user_id, | 93 CallJS("login.AccountPickerScreen.setAuthType", user_id.GetUserEmail(), |
93 static_cast<int>(auth_type), base::StringValue(initial_value)); | 94 static_cast<int>(auth_type), base::StringValue(initial_value)); |
94 } | 95 } |
95 | 96 |
96 void UserBoardScreenHandler::Bind(UserBoardModel& model) { | 97 void UserBoardScreenHandler::Bind(UserBoardModel& model) { |
97 model_ = &model; | 98 model_ = &model; |
98 BaseScreenHandler::SetBaseScreen(model_); | 99 BaseScreenHandler::SetBaseScreen(model_); |
99 } | 100 } |
100 | 101 |
101 void UserBoardScreenHandler::Unbind() { | 102 void UserBoardScreenHandler::Unbind() { |
102 model_ = nullptr; | 103 model_ = nullptr; |
103 BaseScreenHandler::SetBaseScreen(nullptr); | 104 BaseScreenHandler::SetBaseScreen(nullptr); |
104 } | 105 } |
105 | 106 |
106 } // namespace chromeos | 107 } // namespace chromeos |
OLD | NEW |