ProfilePolicyConnectorFactory: Refactoring from Profile to BrowserContext.
[chromium-blink-merge.git] / chrome / browser / ui / webui / chromeos / login / user_board_screen_handler.cc
blobe810a2c5d44c5b3b995b946bc90203dc7d4e6cc2
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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h"
7 #include "chrome/browser/chromeos/login/ui/models/user_board_model.h"
8 #include "components/login/localized_values_builder.h"
10 namespace chromeos {
12 UserBoardScreenHandler::UserBoardScreenHandler() : model_(nullptr) {
15 UserBoardScreenHandler::~UserBoardScreenHandler() {
18 void UserBoardScreenHandler::DeclareLocalizedValues(
19 ::login::LocalizedValuesBuilder* builder) {
22 void UserBoardScreenHandler::RegisterMessages() {
23 AddCallback("getUsers", &UserBoardScreenHandler::HandleGetUsers);
24 AddCallback("attemptUnlock", &UserBoardScreenHandler::HandleAttemptUnlock);
25 AddCallback("hardlockPod", &UserBoardScreenHandler::HandleHardlockPod);
28 void UserBoardScreenHandler::Initialize() {
31 //----------------- Handlers
33 void UserBoardScreenHandler::HandleGetUsers() {
34 CHECK(model_);
35 model_->SendUserList();
38 void UserBoardScreenHandler::HandleHardlockPod(const std::string& user_id) {
39 CHECK(model_);
40 model_->HardLockPod(user_id);
43 void UserBoardScreenHandler::HandleAttemptUnlock(const std::string& user_id) {
44 CHECK(model_);
45 model_->AttemptEasyUnlock(user_id);
48 //----------------- API
50 void UserBoardScreenHandler::SetPublicSessionDisplayName(
51 const std::string& user_id,
52 const std::string& display_name) {
53 CallJS("login.AccountPickerScreen.setPublicSessionDisplayName", user_id,
54 display_name);
57 void UserBoardScreenHandler::SetPublicSessionLocales(
58 const std::string& user_id,
59 scoped_ptr<base::ListValue> locales,
60 const std::string& default_locale,
61 bool multiple_recommended_locales) {
62 CallJS("login.AccountPickerScreen.setPublicSessionLocales", user_id, *locales,
63 default_locale, multiple_recommended_locales);
66 void UserBoardScreenHandler::ShowBannerMessage(const base::string16& message) {
67 CallJS("login.AccountPickerScreen.showBannerMessage", message);
70 void UserBoardScreenHandler::ShowUserPodCustomIcon(
71 const std::string& user_id,
72 const base::DictionaryValue& icon) {
73 CallJS("login.AccountPickerScreen.showUserPodCustomIcon", user_id, icon);
76 void UserBoardScreenHandler::HideUserPodCustomIcon(const std::string& user_id) {
77 CallJS("login.AccountPickerScreen.hideUserPodCustomIcon", user_id);
80 void UserBoardScreenHandler::SetAuthType(
81 const std::string& user_id,
82 ScreenlockBridge::LockHandler::AuthType auth_type,
83 const base::string16& initial_value) {
84 CallJS("login.AccountPickerScreen.setAuthType", user_id,
85 static_cast<int>(auth_type), base::StringValue(initial_value));
88 void UserBoardScreenHandler::Bind(UserBoardModel& model) {
89 model_ = &model;
90 BaseScreenHandler::SetBaseScreen(model_);
93 void UserBoardScreenHandler::Unbind() {
94 model_ = nullptr;
95 BaseScreenHandler::SetBaseScreen(nullptr);
98 } // namespace chromeos