| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 IDS_SHORT_PRODUCT_NAME); | 215 IDS_SHORT_PRODUCT_NAME); |
| 215 } | 216 } |
| 216 | 217 |
| 217 // Invoked from call to CanRollbackCheck upon completion of the DBus call. | 218 // Invoked from call to CanRollbackCheck upon completion of the DBus call. |
| 218 void ResetScreenHandler::OnRollbackCheck(bool can_rollback) { | 219 void ResetScreenHandler::OnRollbackCheck(bool can_rollback) { |
| 219 VLOG(1) << "Callback from CanRollbackCheck, result " << can_rollback; | 220 VLOG(1) << "Callback from CanRollbackCheck, result " << can_rollback; |
| 220 rollback_available_ = can_rollback; | 221 rollback_available_ = can_rollback; |
| 221 ShowWithParams(); | 222 ShowWithParams(); |
| 222 } | 223 } |
| 223 | 224 |
| 225 // static |
| 226 void ResetScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) { |
| 227 registry->RegisterBooleanPref(prefs::kFactoryResetRequested, false); |
| 228 registry->RegisterBooleanPref(prefs::kRollbackRequested, false); |
| 229 } |
| 230 |
| 224 void ResetScreenHandler::Initialize() { | 231 void ResetScreenHandler::Initialize() { |
| 225 if (!page_is_ready() || !delegate_) | 232 if (!page_is_ready() || !delegate_) |
| 226 return; | 233 return; |
| 227 | 234 |
| 228 if (show_on_init_) { | 235 if (show_on_init_) { |
| 229 Show(); | 236 Show(); |
| 230 show_on_init_ = false; | 237 show_on_init_ = false; |
| 231 } | 238 } |
| 232 } | 239 } |
| 233 | 240 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 base::DictionaryValue params; | 289 base::DictionaryValue params; |
| 283 params.SetInteger("uiState", kErrorUIStateRollback); | 290 params.SetInteger("uiState", kErrorUIStateRollback); |
| 284 ShowScreen(OobeUI::kScreenErrorMessage, ¶ms); | 291 ShowScreen(OobeUI::kScreenErrorMessage, ¶ms); |
| 285 } else if (status.status == | 292 } else if (status.status == |
| 286 UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT) { | 293 UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT) { |
| 287 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | 294 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
| 288 } | 295 } |
| 289 } | 296 } |
| 290 | 297 |
| 291 } // namespace chromeos | 298 } // namespace chromeos |
| OLD | NEW |