OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/file_util.h" | 13 #include "base/file_util.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/prefs/pref_registry_simple.h" |
17 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
18 #include "base/values.h" | 19 #include "base/values.h" |
19 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
20 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 21 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
21 #include "chrome/browser/chromeos/reset/metrics.h" | 22 #include "chrome/browser/chromeos/reset/metrics.h" |
22 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 23 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
23 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
24 #include "chromeos/chromeos_switches.h" | 25 #include "chromeos/chromeos_switches.h" |
25 #include "chromeos/dbus/dbus_thread_manager.h" | 26 #include "chromeos/dbus/dbus_thread_manager.h" |
26 #include "chromeos/dbus/power_manager_client.h" | 27 #include "chromeos/dbus/power_manager_client.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 IDS_SHORT_PRODUCT_NAME); | 217 IDS_SHORT_PRODUCT_NAME); |
217 } | 218 } |
218 | 219 |
219 // Invoked from call to CanRollbackCheck upon completion of the DBus call. | 220 // Invoked from call to CanRollbackCheck upon completion of the DBus call. |
220 void ResetScreenHandler::OnRollbackCheck(bool can_rollback) { | 221 void ResetScreenHandler::OnRollbackCheck(bool can_rollback) { |
221 VLOG(1) << "Callback from CanRollbackCheck, result " << can_rollback; | 222 VLOG(1) << "Callback from CanRollbackCheck, result " << can_rollback; |
222 rollback_available_ = can_rollback; | 223 rollback_available_ = can_rollback; |
223 ShowWithParams(); | 224 ShowWithParams(); |
224 } | 225 } |
225 | 226 |
| 227 // static |
| 228 void ResetScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) { |
| 229 registry->RegisterBooleanPref(prefs::kFactoryResetRequested, false); |
| 230 registry->RegisterBooleanPref(prefs::kRollbackRequested, false); |
| 231 } |
| 232 |
226 void ResetScreenHandler::Initialize() { | 233 void ResetScreenHandler::Initialize() { |
227 if (!page_is_ready() || !delegate_) | 234 if (!page_is_ready() || !delegate_) |
228 return; | 235 return; |
229 | 236 |
230 if (show_on_init_) { | 237 if (show_on_init_) { |
231 Show(); | 238 Show(); |
232 show_on_init_ = false; | 239 show_on_init_ = false; |
233 } | 240 } |
234 } | 241 } |
235 | 242 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 base::DictionaryValue params; | 297 base::DictionaryValue params; |
291 params.SetInteger("uiState", kErrorUIStateRollback); | 298 params.SetInteger("uiState", kErrorUIStateRollback); |
292 ShowScreen(OobeUI::kScreenErrorMessage, ¶ms); | 299 ShowScreen(OobeUI::kScreenErrorMessage, ¶ms); |
293 } else if (status.status == | 300 } else if (status.status == |
294 UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT) { | 301 UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT) { |
295 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | 302 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
296 } | 303 } |
297 } | 304 } |
298 | 305 |
299 } // namespace chromeos | 306 } // namespace chromeos |
OLD | NEW |