| 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 | 9 |
| 10 namespace chromeos { | 10 namespace chromeos { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 void UserBoardScreenHandler::Initialize() { | 30 void UserBoardScreenHandler::Initialize() { |
| 31 } | 31 } |
| 32 | 32 |
| 33 //----------------- Handlers | 33 //----------------- Handlers |
| 34 | 34 |
| 35 void UserBoardScreenHandler::HandleGetUsers() { | 35 void UserBoardScreenHandler::HandleGetUsers() { |
| 36 CHECK(model_); | 36 CHECK(model_); |
| 37 model_->SendUserList(); | 37 model_->SendUserList(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void UserBoardScreenHandler::HandleHardlockPod(const std::string& user_id) { | 40 void UserBoardScreenHandler::HandleHardlockPod(const AccountId& account_id) { |
| 41 CHECK(model_); | 41 CHECK(model_); |
| 42 model_->HardLockPod(user_id); | 42 model_->HardLockPod(account_id); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void UserBoardScreenHandler::HandleAttemptUnlock(const std::string& user_id) { | 45 void UserBoardScreenHandler::HandleAttemptUnlock(const AccountId& account_id) { |
| 46 CHECK(model_); | 46 CHECK(model_); |
| 47 model_->AttemptEasyUnlock(user_id); | 47 model_->AttemptEasyUnlock(account_id); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void UserBoardScreenHandler::HandleRecordClickOnLockIcon( | 50 void UserBoardScreenHandler::HandleRecordClickOnLockIcon( |
| 51 const std::string& user_id) { | 51 const AccountId& account_id) { |
| 52 CHECK(model_); | 52 CHECK(model_); |
| 53 model_->RecordClickOnLockIcon(user_id); | 53 model_->RecordClickOnLockIcon(account_id); |
| 54 } | 54 } |
| 55 | 55 |
| 56 //----------------- API | 56 //----------------- API |
| 57 | 57 |
| 58 void UserBoardScreenHandler::SetPublicSessionDisplayName( | 58 void UserBoardScreenHandler::SetPublicSessionDisplayName( |
| 59 const std::string& user_id, | 59 const AccountId& account_id, |
| 60 const std::string& display_name) { | 60 const std::string& display_name) { |
| 61 CallJS("login.AccountPickerScreen.setPublicSessionDisplayName", user_id, | 61 CallJS("login.AccountPickerScreen.setPublicSessionDisplayName", account_id, |
| 62 display_name); | 62 display_name); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void UserBoardScreenHandler::SetPublicSessionLocales( | 65 void UserBoardScreenHandler::SetPublicSessionLocales( |
| 66 const std::string& user_id, | 66 const AccountId& account_id, |
| 67 scoped_ptr<base::ListValue> locales, | 67 scoped_ptr<base::ListValue> locales, |
| 68 const std::string& default_locale, | 68 const std::string& default_locale, |
| 69 bool multiple_recommended_locales) { | 69 bool multiple_recommended_locales) { |
| 70 CallJS("login.AccountPickerScreen.setPublicSessionLocales", user_id, *locales, | 70 CallJS("login.AccountPickerScreen.setPublicSessionLocales", account_id, |
| 71 default_locale, multiple_recommended_locales); | 71 *locales, default_locale, multiple_recommended_locales); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void UserBoardScreenHandler::ShowBannerMessage(const base::string16& message) { | 74 void UserBoardScreenHandler::ShowBannerMessage(const base::string16& message) { |
| 75 CallJS("login.AccountPickerScreen.showBannerMessage", message); | 75 CallJS("login.AccountPickerScreen.showBannerMessage", message); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void UserBoardScreenHandler::ShowUserPodCustomIcon( | 78 void UserBoardScreenHandler::ShowUserPodCustomIcon( |
| 79 const std::string& user_id, | 79 const AccountId& account_id, |
| 80 const base::DictionaryValue& icon) { | 80 const base::DictionaryValue& icon) { |
| 81 CallJS("login.AccountPickerScreen.showUserPodCustomIcon", user_id, icon); | 81 CallJS("login.AccountPickerScreen.showUserPodCustomIcon", account_id, icon); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void UserBoardScreenHandler::HideUserPodCustomIcon(const std::string& user_id) { | 84 void UserBoardScreenHandler::HideUserPodCustomIcon( |
| 85 CallJS("login.AccountPickerScreen.hideUserPodCustomIcon", user_id); | 85 const AccountId& account_id) { |
| 86 CallJS("login.AccountPickerScreen.hideUserPodCustomIcon", account_id); |
| 86 } | 87 } |
| 87 | 88 |
| 88 void UserBoardScreenHandler::SetAuthType( | 89 void UserBoardScreenHandler::SetAuthType( |
| 89 const std::string& user_id, | 90 const AccountId& account_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", account_id, |
| 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 |