Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(819)

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.cc

Issue 12213110: Implemented screen notifying users about malformed HWID. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removed log message. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #include "chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h"
6
7 #include <string>
8
9 #include "base/bind.h"
10 #include "base/command_line.h"
11 #include "base/values.h"
12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/common/chrome_switches.h"
15 #include "chrome/common/pref_names.h"
16 #include "grit/browser_resources.h"
17 #include "grit/chromium_strings.h"
18 #include "grit/generated_resources.h"
19 #include "ui/base/l10n/l10n_util.h"
20
21 namespace {
22
23 // Reset screen id.
24 const char kWrongHWIDScreen[] = "wrong-hwid";
25
26 } // namespace
27
28 namespace chromeos {
29
30 WrongHWIDScreenHandler::WrongHWIDScreenHandler()
31 : delegate_(NULL), show_on_init_(false) {
32 }
33
34 WrongHWIDScreenHandler::~WrongHWIDScreenHandler() {
35 if (delegate_)
36 delegate_->OnActorDestroyed(this);
37 }
38
39 void WrongHWIDScreenHandler::PrepareToShow() {
40 }
41
42 void WrongHWIDScreenHandler::Show() {
43 if (!page_is_ready()) {
44 show_on_init_ = true;
45 return;
46 }
47 ShowScreen(kWrongHWIDScreen, NULL);
48 }
49
50 void WrongHWIDScreenHandler::Hide() {
51 }
52
53 void WrongHWIDScreenHandler::SetDelegate(Delegate* delegate) {
54 delegate_ = delegate;
55 if (page_is_ready())
56 Initialize();
57 }
58
59 void WrongHWIDScreenHandler::GetLocalizedStrings(
60 base::DictionaryValue* localized_strings) {
61 localized_strings->SetString(
62 "wrongHWIDScreenHeader",
63 l10n_util::GetStringUTF16(IDS_WRONG_HWID_SCREEN_HEADER));
64 localized_strings->SetString(
65 "wrongHWIDMessageFirstPart",
66 l10n_util::GetStringUTF16(IDS_WRONG_HWID_SCREEN_MESSAGE_FIRST_PART));
67 localized_strings->SetString(
68 "wrongHWIDMessageSecondPart",
69 l10n_util::GetStringUTF16(IDS_WRONG_HWID_SCREEN_MESSAGE_SECOND_PART));
70 localized_strings->SetString(
71 "wrongHWIDScreenSkipLink",
72 l10n_util::GetStringUTF16(IDS_WRONG_HWID_SCREEN_SKIP_LINK));
73 }
74
75 void WrongHWIDScreenHandler::Initialize() {
76 if (!page_is_ready() || !delegate_)
77 return;
78
79 if (show_on_init_) {
80 Show();
81 show_on_init_ = false;
82 }
83 }
84
85 void WrongHWIDScreenHandler::RegisterMessages() {
86 web_ui()->RegisterMessageCallback("wrongHWIDOnSkip",
87 base::Bind(&WrongHWIDScreenHandler::HandleOnSkip,
88 base::Unretained(this)));
89 }
90
91 void WrongHWIDScreenHandler::HandleOnSkip(const base::ListValue* args) {
92 if (delegate_)
93 delegate_->OnExit();
94 }
95
96 } // namespace chromeos
97
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698