| Index: chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc
|
| diff --git a/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc
|
| index 62aa6e0fd0381521dfe6413b141b091b449129a6..da3063a1a34a435b87a48bf89005232e31881e24 100644
|
| --- a/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc
|
| +++ b/chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc
|
| @@ -6,7 +6,13 @@
|
|
|
| #include <string>
|
|
|
| +#include "base/bind.h"
|
| +#include "base/bind_helpers.h"
|
| +#include "base/callback.h"
|
| #include "base/command_line.h"
|
| +#include "base/file_util.h"
|
| +#include "base/files/file_path.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| #include "base/metrics/histogram.h"
|
| #include "base/prefs/pref_registry_simple.h"
|
| #include "base/prefs/pref_service.h"
|
| @@ -36,6 +42,13 @@
|
|
|
| const int kErrorUIStateRollback = 7;
|
|
|
| +static const char kRollbackFlagFile[] = "/tmp/.enable_rollback_ui";
|
| +
|
| +void CheckRollbackFlagFileExists(bool *file_exists) {
|
| + DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
|
| + *file_exists = base::PathExists(base::FilePath(kRollbackFlagFile));
|
| +}
|
| +
|
| } // namespace
|
|
|
| namespace chromeos {
|
| @@ -110,8 +123,28 @@
|
| if (!restart_required_) // First exec after boot.
|
| reboot_was_requested_ = prefs->GetBoolean(prefs::kFactoryResetRequested);
|
|
|
| - if (CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kDisableRollbackOption)) {
|
| + // Check Rollback flag-file.
|
| + scoped_ptr<bool> file_exists(new bool(false));
|
| + base::Closure checkfile_closure = base::Bind(
|
| + &CheckRollbackFlagFileExists,
|
| + base::Unretained(file_exists.get()));
|
| + base::Closure on_check_done = base::Bind(
|
| + &ResetScreenHandler::OnRollbackFlagFileCheckDone,
|
| + weak_ptr_factory_.GetWeakPtr(),
|
| + base::Passed(file_exists.Pass()));
|
| + if (!content::BrowserThread::PostBlockingPoolTaskAndReply(
|
| + FROM_HERE,
|
| + checkfile_closure,
|
| + on_check_done)) {
|
| + LOG(WARNING) << "Failed to check flag file for Rollback reset option";
|
| + on_check_done.Run();
|
| + }
|
| +}
|
| +
|
| +void ResetScreenHandler::OnRollbackFlagFileCheckDone(
|
| + scoped_ptr<bool> file_exists) {
|
| + if (!(*file_exists) && !CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kEnableRollbackOption)) {
|
| rollback_available_ = false;
|
| ShowWithParams();
|
| } else if (!restart_required_ && reboot_was_requested_) {
|
|
|