| 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" | |
| 18 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
| 19 #include "base/values.h" | 18 #include "base/values.h" |
| 20 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 21 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 20 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
| 22 #include "chrome/browser/chromeos/reset/metrics.h" | 21 #include "chrome/browser/chromeos/reset/metrics.h" |
| 23 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 22 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 24 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 25 #include "chromeos/chromeos_switches.h" | 24 #include "chromeos/chromeos_switches.h" |
| 26 #include "chromeos/dbus/dbus_thread_manager.h" | 25 #include "chromeos/dbus/dbus_thread_manager.h" |
| 27 #include "chromeos/dbus/power_manager_client.h" | 26 #include "chromeos/dbus/power_manager_client.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 IDS_SHORT_PRODUCT_NAME); | 216 IDS_SHORT_PRODUCT_NAME); |
| 218 } | 217 } |
| 219 | 218 |
| 220 // Invoked from call to CanRollbackCheck upon completion of the DBus call. | 219 // Invoked from call to CanRollbackCheck upon completion of the DBus call. |
| 221 void ResetScreenHandler::OnRollbackCheck(bool can_rollback) { | 220 void ResetScreenHandler::OnRollbackCheck(bool can_rollback) { |
| 222 VLOG(1) << "Callback from CanRollbackCheck, result " << can_rollback; | 221 VLOG(1) << "Callback from CanRollbackCheck, result " << can_rollback; |
| 223 rollback_available_ = can_rollback; | 222 rollback_available_ = can_rollback; |
| 224 ShowWithParams(); | 223 ShowWithParams(); |
| 225 } | 224 } |
| 226 | 225 |
| 227 // static | |
| 228 void ResetScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) { | |
| 229 registry->RegisterBooleanPref(prefs::kFactoryResetRequested, false); | |
| 230 registry->RegisterBooleanPref(prefs::kRollbackRequested, false); | |
| 231 } | |
| 232 | |
| 233 void ResetScreenHandler::Initialize() { | 226 void ResetScreenHandler::Initialize() { |
| 234 if (!page_is_ready() || !delegate_) | 227 if (!page_is_ready() || !delegate_) |
| 235 return; | 228 return; |
| 236 | 229 |
| 237 if (show_on_init_) { | 230 if (show_on_init_) { |
| 238 Show(); | 231 Show(); |
| 239 show_on_init_ = false; | 232 show_on_init_ = false; |
| 240 } | 233 } |
| 241 } | 234 } |
| 242 | 235 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 base::DictionaryValue params; | 290 base::DictionaryValue params; |
| 298 params.SetInteger("uiState", kErrorUIStateRollback); | 291 params.SetInteger("uiState", kErrorUIStateRollback); |
| 299 ShowScreen(OobeUI::kScreenErrorMessage, ¶ms); | 292 ShowScreen(OobeUI::kScreenErrorMessage, ¶ms); |
| 300 } else if (status.status == | 293 } else if (status.status == |
| 301 UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT) { | 294 UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT) { |
| 302 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | 295 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
| 303 } | 296 } |
| 304 } | 297 } |
| 305 | 298 |
| 306 } // namespace chromeos | 299 } // namespace chromeos |
| OLD | NEW |