Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2831)

Unified Diff: chrome/browser/ui/webui/chromeos/login/reset_screen_handler.cc

Issue 344963003: Revert of Flag covering Rollback removed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h ('k') | chromeos/chromeos_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_) {
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h ('k') | chromeos/chromeos_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698