Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / webui / chromeos / login / wrong_hwid_screen_handler.cc
blob3937c95e22d79c8a3811257da7da79f3865ef1c8
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/wrong_hwid_screen_handler.h"
7 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
8 #include "chrome/grit/generated_resources.h"
9 #include "components/login/localized_values_builder.h"
11 namespace {
13 const char kJsScreenPath[] = "login.WrongHWIDScreen";
15 } // namespace
17 namespace chromeos {
19 WrongHWIDScreenHandler::WrongHWIDScreenHandler()
20 : BaseScreenHandler(kJsScreenPath),
21 delegate_(NULL),
22 show_on_init_(false) {
25 WrongHWIDScreenHandler::~WrongHWIDScreenHandler() {
26 if (delegate_)
27 delegate_->OnActorDestroyed(this);
30 void WrongHWIDScreenHandler::PrepareToShow() {
33 void WrongHWIDScreenHandler::Show() {
34 if (!page_is_ready()) {
35 show_on_init_ = true;
36 return;
38 ShowScreen(OobeUI::kScreenWrongHWID, NULL);
41 void WrongHWIDScreenHandler::Hide() {
44 void WrongHWIDScreenHandler::SetDelegate(Delegate* delegate) {
45 delegate_ = delegate;
46 if (page_is_ready())
47 Initialize();
50 void WrongHWIDScreenHandler::DeclareLocalizedValues(
51 ::login::LocalizedValuesBuilder* builder) {
52 builder->Add("wrongHWIDScreenHeader", IDS_WRONG_HWID_SCREEN_HEADER);
53 builder->Add("wrongHWIDMessageFirstPart",
54 IDS_WRONG_HWID_SCREEN_MESSAGE_FIRST_PART);
55 builder->Add("wrongHWIDMessageSecondPart",
56 IDS_WRONG_HWID_SCREEN_MESSAGE_SECOND_PART);
57 builder->Add("wrongHWIDScreenSkipLink",
58 IDS_WRONG_HWID_SCREEN_SKIP_LINK);
61 void WrongHWIDScreenHandler::Initialize() {
62 if (!page_is_ready() || !delegate_)
63 return;
65 if (show_on_init_) {
66 Show();
67 show_on_init_ = false;
71 void WrongHWIDScreenHandler::RegisterMessages() {
72 AddCallback("wrongHWIDOnSkip", &WrongHWIDScreenHandler::HandleOnSkip);
75 void WrongHWIDScreenHandler::HandleOnSkip() {
76 if (delegate_)
77 delegate_->OnExit();
80 } // namespace chromeos