Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / webui / chromeos / login / user_board_screen_handler.cc
blob18c0ac30d71253997b2b4a0b93dcbc8711f41c2f
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);
26 AddCallback("recordClickOnLockIcon",
27 &UserBoardScreenHandler::HandleRecordClickOnLockIcon);
30 void UserBoardScreenHandler::Initialize() {
33 //----------------- Handlers
35 void UserBoardScreenHandler::HandleGetUsers() {
36 CHECK(model_);
37 model_->SendUserList();
40 void UserBoardScreenHandler::HandleHardlockPod(const std::string& user_id) {
41 CHECK(model_);
42 model_->HardLockPod(user_id);
45 void UserBoardScreenHandler::HandleAttemptUnlock(const std::string& user_id) {
46 CHECK(model_);
47 model_->AttemptEasyUnlock(user_id);
50 void UserBoardScreenHandler::HandleRecordClickOnLockIcon(
51 const std::string& user_id) {
52 CHECK(model_);
53 model_->RecordClickOnLockIcon(user_id);
56 //----------------- API
58 void UserBoardScreenHandler::SetPublicSessionDisplayName(
59 const std::string& user_id,
60 const std::string& display_name) {
61 CallJS("login.AccountPickerScreen.setPublicSessionDisplayName", user_id,
62 display_name);
65 void UserBoardScreenHandler::SetPublicSessionLocales(
66 const std::string& user_id,
67 scoped_ptr<base::ListValue> locales,
68 const std::string& default_locale,
69 bool multiple_recommended_locales) {
70 CallJS("login.AccountPickerScreen.setPublicSessionLocales", user_id, *locales,
71 default_locale, multiple_recommended_locales);
74 void UserBoardScreenHandler::ShowBannerMessage(const base::string16& message) {
75 CallJS("login.AccountPickerScreen.showBannerMessage", message);
78 void UserBoardScreenHandler::ShowUserPodCustomIcon(
79 const std::string& user_id,
80 const base::DictionaryValue& icon) {
81 CallJS("login.AccountPickerScreen.showUserPodCustomIcon", user_id, icon);
84 void UserBoardScreenHandler::HideUserPodCustomIcon(const std::string& user_id) {
85 CallJS("login.AccountPickerScreen.hideUserPodCustomIcon", user_id);
88 void UserBoardScreenHandler::SetAuthType(
89 const std::string& user_id,
90 proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type,
91 const base::string16& initial_value) {
92 CallJS("login.AccountPickerScreen.setAuthType", user_id,
93 static_cast<int>(auth_type), base::StringValue(initial_value));
96 void UserBoardScreenHandler::Bind(UserBoardModel& model) {
97 model_ = &model;
98 BaseScreenHandler::SetBaseScreen(model_);
101 void UserBoardScreenHandler::Unbind() {
102 model_ = nullptr;
103 BaseScreenHandler::SetBaseScreen(nullptr);
106 } // namespace chromeos