Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / ui / webui / chromeos / login / device_disabled_screen_handler.cc
blobad5b5dab2ce1ce0f17bc05b9aae83677d4b1dede
1 // Copyright 2014 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/device_disabled_screen_handler.h"
7 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
8 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
9 #include "chrome/grit/generated_resources.h"
10 #include "components/login/localized_values_builder.h"
12 namespace {
14 const char kJsScreenPath[] = "login.DeviceDisabledScreen";
16 } // namespace
18 namespace chromeos {
20 DeviceDisabledScreenHandler::DeviceDisabledScreenHandler()
21 : BaseScreenHandler(kJsScreenPath),
22 delegate_(NULL),
23 show_on_init_(false) {
26 DeviceDisabledScreenHandler::~DeviceDisabledScreenHandler() {
27 if (delegate_)
28 delegate_->OnActorDestroyed(this);
31 void DeviceDisabledScreenHandler::Show() {
32 if (!page_is_ready()) {
33 show_on_init_ = true;
34 return;
37 if (delegate_) {
38 CallJS("setEnrollmentDomain", delegate_->GetEnrollmentDomain());
39 CallJS("setMessage", delegate_->GetMessage());
41 ShowScreen(OobeUI::kScreenDeviceDisabled, NULL);
44 void DeviceDisabledScreenHandler::Hide() {
45 show_on_init_ = false;
48 void DeviceDisabledScreenHandler::SetDelegate(Delegate* delegate) {
49 delegate_ = delegate;
50 if (page_is_ready())
51 Initialize();
54 void DeviceDisabledScreenHandler::UpdateMessage(const std::string& message) {
55 if (page_is_ready())
56 CallJS("setMessage", message);
59 void DeviceDisabledScreenHandler::DeclareLocalizedValues(
60 ::login::LocalizedValuesBuilder* builder) {
61 builder->Add("deviceDisabledHeading", IDS_DEVICE_DISABLED_HEADING);
62 builder->Add("deviceDisabledExplanationWithDomain",
63 IDS_DEVICE_DISABLED_EXPLANATION_WITH_DOMAIN);
64 builder->Add("deviceDisabledExplanationWithoutDomain",
65 IDS_DEVICE_DISABLED_EXPLANATION_WITHOUT_DOMAIN);
68 void DeviceDisabledScreenHandler::Initialize() {
69 if (!page_is_ready() || !delegate_)
70 return;
72 if (show_on_init_) {
73 Show();
74 show_on_init_ = false;
78 void DeviceDisabledScreenHandler::RegisterMessages() {
81 } // namespace chromeos