1 // Copyright (c) 2012 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/reset_screen_handler.h"
9 #include "base/prefs/pref_registry_simple.h"
10 #include "base/values.h"
11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/chromeos/login/help_app_launcher.h"
13 #include "chrome/browser/chromeos/login/screens/reset_model.h"
14 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
15 #include "chrome/common/pref_names.h"
16 #include "chrome/grit/chromium_strings.h"
17 #include "chrome/grit/generated_resources.h"
18 #include "chromeos/dbus/session_manager_client.h"
19 #include "components/login/localized_values_builder.h"
23 const char kJsScreenPath
[] = "login.ResetScreen";
29 ResetScreenHandler::ResetScreenHandler()
30 : BaseScreenHandler(kJsScreenPath
),
32 show_on_init_(false) {
35 ResetScreenHandler::~ResetScreenHandler() {
37 model_
->OnViewDestroyed(this);
40 void ResetScreenHandler::PrepareToShow() {
43 void ResetScreenHandler::Show() {
44 if (!page_is_ready()) {
48 ShowScreen(OobeUI::kScreenOobeReset
, NULL
);
51 void ResetScreenHandler::Hide() {
54 void ResetScreenHandler::DeclareLocalizedValues(
55 ::login::LocalizedValuesBuilder
* builder
) {
56 builder
->Add("resetScreenTitle", IDS_RESET_SCREEN_TITLE
);
57 builder
->Add("resetScreenAccessibleTitle", IDS_RESET_SCREEN_TITLE
);
58 builder
->Add("resetScreenIconTitle", IDS_RESET_SCREEN_ICON_TITLE
);
59 builder
->Add("cancelButton", IDS_CANCEL
);
61 builder
->Add("resetButtonRestart", IDS_RELAUNCH_BUTTON
);
62 builder
->Add("resetButtonPowerwash", IDS_RESET_SCREEN_POWERWASH
);
63 builder
->Add("resetButtonPowerwashAndRollback",
64 IDS_RESET_SCREEN_POWERWASH_AND_REVERT
);
66 builder
->Add("resetWarningDataDetails",
67 IDS_RESET_SCREEN_WARNING_DETAILS_DATA
);
68 builder
->Add("resetRestartMessage", IDS_RESET_SCREEN_RESTART_MSG
);
69 builder
->AddF("resetRevertPromise",
70 IDS_RESET_SCREEN_PREPARING_REVERT_PROMISE
,
71 IDS_SHORT_PRODUCT_NAME
);
72 builder
->AddF("resetRevertSpinnerMessage",
73 IDS_RESET_SCREEN_PREPARING_REVERT_SPINNER_MESSAGE
,
74 IDS_SHORT_PRODUCT_NAME
);
76 // Variants for screen title.
77 builder
->AddF("resetWarningTitle",
78 IDS_RESET_SCREEN_WARNING_MSG
,
79 IDS_SHORT_PRODUCT_NAME
);
81 // Variants for screen message.
82 builder
->AddF("resetPowerwashWarningDetails",
83 IDS_RESET_SCREEN_WARNING_POWERWASH_MSG
,
84 IDS_SHORT_PRODUCT_NAME
);
85 builder
->AddF("resetPowerwashRollbackWarningDetails",
86 IDS_RESET_SCREEN_WARNING_POWERWASH_AND_ROLLBACK_MSG
,
87 IDS_SHORT_PRODUCT_NAME
);
89 builder
->Add("confirmPowerwashTitle", IDS_RESET_SCREEN_POPUP_POWERWASH_TITLE
);
90 builder
->Add("confirmRollbackTitle", IDS_RESET_SCREEN_POPUP_ROLLBACK_TITLE
);
91 builder
->Add("confirmPowerwashMessage",
92 IDS_RESET_SCREEN_POPUP_POWERWASH_TEXT
);
93 builder
->Add("confirmRollbackMessage", IDS_RESET_SCREEN_POPUP_ROLLBACK_TEXT
);
94 builder
->Add("confirmResetButton", IDS_RESET_SCREEN_POPUP_CONFIRM_BUTTON
);
98 void ResetScreenHandler::RegisterPrefs(PrefRegistrySimple
* registry
) {
99 registry
->RegisterBooleanPref(prefs::kFactoryResetRequested
, false);
102 void ResetScreenHandler::Initialize() {
103 if (!page_is_ready())
108 show_on_init_
= false;
112 void ResetScreenHandler::Bind(ResetModel
& model
) {
114 BaseScreenHandler::SetBaseScreen(model_
);
117 void ResetScreenHandler::Unbind() {
119 BaseScreenHandler::SetBaseScreen(nullptr);
122 } // namespace chromeos