| 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 { |
| 11 | 11 |
| 12 UserBoardScreenHandler::UserBoardScreenHandler() : model_(nullptr) { | 12 UserBoardScreenHandler::UserBoardScreenHandler() : model_(nullptr) { |
| 13 } | 13 } |
| 14 | 14 |
| 15 UserBoardScreenHandler::~UserBoardScreenHandler() { | 15 UserBoardScreenHandler::~UserBoardScreenHandler() { |
| 16 } | 16 } |
| 17 | 17 |
| 18 void UserBoardScreenHandler::DeclareLocalizedValues( | 18 void UserBoardScreenHandler::DeclareLocalizedValues( |
| 19 ::login::LocalizedValuesBuilder* builder) { | 19 ::login::LocalizedValuesBuilder* builder) { |
| 20 } | 20 } |
| 21 | 21 |
| 22 void UserBoardScreenHandler::RegisterMessages() { | 22 void UserBoardScreenHandler::RegisterMessages() { |
| 23 AddCallback("getUsers", &UserBoardScreenHandler::HandleGetUsers); | 23 AddCallback("getUsers", &UserBoardScreenHandler::HandleGetUsers); |
| 24 AddCallback("attemptUnlock", &UserBoardScreenHandler::HandleAttemptUnlock); | 24 AddCallback("attemptUnlock", &UserBoardScreenHandler::HandleAttemptUnlock); |
| 25 AddCallback("hardlockPod", &UserBoardScreenHandler::HandleHardlockPod); | 25 AddCallback("hardlockPod", &UserBoardScreenHandler::HandleHardlockPod); |
| 26 AddCallback("recordClickOnLockIcon", |
| 27 &UserBoardScreenHandler::HandleRecordClickOnLockIcon); |
| 26 } | 28 } |
| 27 | 29 |
| 28 void UserBoardScreenHandler::Initialize() { | 30 void UserBoardScreenHandler::Initialize() { |
| 29 } | 31 } |
| 30 | 32 |
| 31 //----------------- Handlers | 33 //----------------- Handlers |
| 32 | 34 |
| 33 void UserBoardScreenHandler::HandleGetUsers() { | 35 void UserBoardScreenHandler::HandleGetUsers() { |
| 34 CHECK(model_); | 36 CHECK(model_); |
| 35 model_->SendUserList(); | 37 model_->SendUserList(); |
| 36 } | 38 } |
| 37 | 39 |
| 38 void UserBoardScreenHandler::HandleHardlockPod(const std::string& user_id) { | 40 void UserBoardScreenHandler::HandleHardlockPod(const std::string& user_id) { |
| 39 CHECK(model_); | 41 CHECK(model_); |
| 40 model_->HardLockPod(user_id); | 42 model_->HardLockPod(user_id); |
| 41 } | 43 } |
| 42 | 44 |
| 43 void UserBoardScreenHandler::HandleAttemptUnlock(const std::string& user_id) { | 45 void UserBoardScreenHandler::HandleAttemptUnlock(const std::string& user_id) { |
| 44 CHECK(model_); | 46 CHECK(model_); |
| 45 model_->AttemptEasyUnlock(user_id); | 47 model_->AttemptEasyUnlock(user_id); |
| 46 } | 48 } |
| 47 | 49 |
| 50 void UserBoardScreenHandler::HandleRecordClickOnLockIcon( |
| 51 const std::string& user_id) { |
| 52 CHECK(model_); |
| 53 model_->RecordClickOnLockIcon(user_id); |
| 54 } |
| 55 |
| 48 //----------------- API | 56 //----------------- API |
| 49 | 57 |
| 50 void UserBoardScreenHandler::SetPublicSessionDisplayName( | 58 void UserBoardScreenHandler::SetPublicSessionDisplayName( |
| 51 const std::string& user_id, | 59 const std::string& user_id, |
| 52 const std::string& display_name) { | 60 const std::string& display_name) { |
| 53 CallJS("login.AccountPickerScreen.setPublicSessionDisplayName", user_id, | 61 CallJS("login.AccountPickerScreen.setPublicSessionDisplayName", user_id, |
| 54 display_name); | 62 display_name); |
| 55 } | 63 } |
| 56 | 64 |
| 57 void UserBoardScreenHandler::SetPublicSessionLocales( | 65 void UserBoardScreenHandler::SetPublicSessionLocales( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 model_ = &model; | 97 model_ = &model; |
| 90 BaseScreenHandler::SetBaseScreen(model_); | 98 BaseScreenHandler::SetBaseScreen(model_); |
| 91 } | 99 } |
| 92 | 100 |
| 93 void UserBoardScreenHandler::Unbind() { | 101 void UserBoardScreenHandler::Unbind() { |
| 94 model_ = nullptr; | 102 model_ = nullptr; |
| 95 BaseScreenHandler::SetBaseScreen(nullptr); | 103 BaseScreenHandler::SetBaseScreen(nullptr); |
| 96 } | 104 } |
| 97 | 105 |
| 98 } // namespace chromeos | 106 } // namespace chromeos |
| OLD | NEW |