1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h"
#include <string>
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/login/help_app_launcher.h"
#include "chrome/browser/chromeos/login/screens/reset_model.h"
#include "chrome/browser/ui/webui/chromeos/login/oobe_screen.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/dbus/session_manager_client.h"
#include "components/login/localized_values_builder.h"
#include "components/prefs/pref_registry_simple.h"
#include "grit/components_strings.h"
namespace {
const char kJsScreenPath[] = "login.ResetScreen";
} // namespace
namespace chromeos {
ResetScreenHandler::ResetScreenHandler()
: BaseScreenHandler(kJsScreenPath),
model_(nullptr),
show_on_init_(false) {
}
ResetScreenHandler::~ResetScreenHandler() {
if (model_)
model_->OnViewDestroyed(this);
}
void ResetScreenHandler::PrepareToShow() {
}
void ResetScreenHandler::Show() {
if (!page_is_ready()) {
show_on_init_ = true;
return;
}
ShowScreen(OobeScreen::SCREEN_OOBE_RESET);
}
void ResetScreenHandler::Hide() {
}
void ResetScreenHandler::DeclareLocalizedValues(
::login::LocalizedValuesBuilder* builder) {
builder->Add("resetScreenTitle", IDS_RESET_SCREEN_TITLE);
builder->Add("resetScreenAccessibleTitle", IDS_RESET_SCREEN_TITLE);
builder->Add("resetScreenIconTitle", IDS_RESET_SCREEN_ICON_TITLE);
builder->Add("cancelButton", IDS_CANCEL);
builder->Add("resetButtonRestart", IDS_RELAUNCH_BUTTON);
builder->Add("resetButtonPowerwash", IDS_RESET_SCREEN_POWERWASH);
builder->Add("resetButtonPowerwashAndRollback",
IDS_RESET_SCREEN_POWERWASH_AND_REVERT);
builder->Add("resetWarningDataDetails",
IDS_RESET_SCREEN_WARNING_DETAILS_DATA);
builder->Add("resetRestartMessage", IDS_RESET_SCREEN_RESTART_MSG);
builder->AddF("resetRevertPromise",
IDS_RESET_SCREEN_PREPARING_REVERT_PROMISE,
IDS_SHORT_PRODUCT_NAME);
builder->AddF("resetRevertSpinnerMessage",
IDS_RESET_SCREEN_PREPARING_REVERT_SPINNER_MESSAGE,
IDS_SHORT_PRODUCT_NAME);
// Variants for screen title.
builder->AddF("resetWarningTitle",
IDS_RESET_SCREEN_WARNING_MSG,
IDS_SHORT_PRODUCT_NAME);
// Variants for screen message.
builder->AddF("resetPowerwashWarningDetails",
IDS_RESET_SCREEN_WARNING_POWERWASH_MSG,
IDS_SHORT_PRODUCT_NAME);
builder->AddF("resetPowerwashRollbackWarningDetails",
IDS_RESET_SCREEN_WARNING_POWERWASH_AND_ROLLBACK_MSG,
IDS_SHORT_PRODUCT_NAME);
builder->Add("confirmPowerwashTitle", IDS_RESET_SCREEN_POPUP_POWERWASH_TITLE);
builder->Add("confirmRollbackTitle", IDS_RESET_SCREEN_POPUP_ROLLBACK_TITLE);
builder->Add("confirmPowerwashMessage",
IDS_RESET_SCREEN_POPUP_POWERWASH_TEXT);
builder->Add("confirmRollbackMessage", IDS_RESET_SCREEN_POPUP_ROLLBACK_TEXT);
builder->Add("confirmResetButton", IDS_RESET_SCREEN_POPUP_CONFIRM_BUTTON);
}
// static
void ResetScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) {
registry->RegisterBooleanPref(prefs::kFactoryResetRequested, false);
}
void ResetScreenHandler::Initialize() {
if (!page_is_ready())
return;
if (show_on_init_) {
Show();
show_on_init_ = false;
}
}
void ResetScreenHandler::Bind(ResetModel& model) {
model_ = &model;
BaseScreenHandler::SetBaseScreen(model_);
}
void ResetScreenHandler::Unbind() {
model_ = nullptr;
BaseScreenHandler::SetBaseScreen(nullptr);
}
} // namespace chromeos
|