Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / chromeos / login / screens / device_disabled_screen.cc
blobc3bfcfc6e3fa54bdef350137f5152b4149f3334e
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/chromeos/login/screens/device_disabled_screen.h"
7 #include <string>
9 #include "base/logging.h"
10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/browser_process_platform_part.h"
12 #include "chrome/browser/chromeos/login/wizard_controller.h"
14 namespace chromeos {
16 DeviceDisabledScreen::DeviceDisabledScreen(
17 BaseScreenDelegate* base_screen_delegate,
18 DeviceDisabledScreenActor* actor)
19 : BaseScreen(base_screen_delegate),
20 actor_(actor),
21 device_disabling_manager_(g_browser_process->platform_part()->
22 device_disabling_manager()),
23 showing_(false) {
24 DCHECK(actor_);
25 if (actor_)
26 actor_->SetDelegate(this);
27 device_disabling_manager_->AddObserver(this);
30 DeviceDisabledScreen::~DeviceDisabledScreen() {
31 if (actor_)
32 actor_->SetDelegate(nullptr);
33 device_disabling_manager_->RemoveObserver(this);
36 void DeviceDisabledScreen::PrepareToShow() {
39 void DeviceDisabledScreen::Show() {
40 if (!actor_ || showing_)
41 return;
43 showing_ = true;
44 actor_->Show();
47 void DeviceDisabledScreen::Hide() {
48 if (!showing_)
49 return;
50 showing_ = false;
52 if (actor_)
53 actor_->Hide();
56 std::string DeviceDisabledScreen::GetName() const {
57 return WizardController::kDeviceDisabledScreenName;
60 void DeviceDisabledScreen::OnActorDestroyed(DeviceDisabledScreenActor* actor) {
61 if (actor_ == actor)
62 actor_ = nullptr;
65 const std::string& DeviceDisabledScreen::GetEnrollmentDomain() const {
66 return device_disabling_manager_->enrollment_domain();
69 const std::string& DeviceDisabledScreen::GetMessage() const {
70 return device_disabling_manager_->disabled_message();
73 void DeviceDisabledScreen::OnDisabledMessageChanged(
74 const std::string& disabled_message) {
75 if (actor_)
76 actor_->UpdateMessage(disabled_message);
79 } // namespace chromeos