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

Unified Diff: chrome/browser/chromeos/login/wizard_controller.cc

Issue 9704064: chromeos: Do not check /home/chronos/.oobe_complete on Linux desktop (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: polish Created 8 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/wizard_controller.cc
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index 900889127e09dff085336fbed86c3fcf0a1ff288..588a02386a6ef7c45231dc38ca106c799798a4cd 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/chromeos/login/wizard_controller.h"
#include <signal.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <string>
@@ -36,6 +37,7 @@
#include "chrome/browser/chromeos/login/update_screen.h"
#include "chrome/browser/chromeos/login/user_image_screen.h"
#include "chrome/browser/chromeos/login/user_manager.h"
+#include "chrome/browser/chromeos/system/runtime_environment.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/options/options_util.h"
@@ -66,9 +68,6 @@ const char kOobeComplete[] = "OobeComplete";
// A boolean pref of the device registered flag (second part after first login).
const char kDeviceRegistered[] = "DeviceRegistered";
-// Path to flag file indicating that both parts of OOBE were completed.
-const char kOobeCompleteFlagFilePath[] = "/home/chronos/.oobe_completed";
-
// Time in seconds that we wait for the device to reboot.
// If reboot didn't happen, ask user to reboot device manually.
const int kWaitForRebootTimeSec = 3;
@@ -586,13 +585,32 @@ void WizardController::MarkOobeCompleted() {
SaveBoolPreferenceForced(kOobeComplete, true);
}
+// Returns the path to flag file indicating that both parts of OOBE were
+// completed.
+// On chrome device, returns /home/chronos/.oobe_completed.
+// On Linux desktop, returns $HOME/.oobe_completed.
+static FilePath GetOobeCompleteFlagPath() {
+ // The constant is defined here so it won't be referenced directly.
+ const char kOobeCompleteFlagFilePath[] = "/home/chronos/.oobe_completed";
+
+ if (system::runtime_environment::IsRunningOnChromeOS()) {
+ return FilePath(kOobeCompleteFlagFilePath);
+ } else {
+ const char* home = getenv("HOME");
+ // Unlikely but if HOME is not defined, use the current directory.
+ if (!home)
+ home = "";
+ return FilePath(home).AppendASCII(".oobe_completed");
+ }
+}
+
static void CreateOobeCompleteFlagFile() {
// Create flag file for boot-time init scripts.
- FilePath oobe_complete_path(kOobeCompleteFlagFilePath);
+ FilePath oobe_complete_path = GetOobeCompleteFlagPath();
if (!file_util::PathExists(oobe_complete_path)) {
FILE* oobe_flag_file = file_util::OpenFile(oobe_complete_path, "w+b");
if (oobe_flag_file == NULL)
- DLOG(WARNING) << kOobeCompleteFlagFilePath << " doesn't exist.";
+ DLOG(WARNING) << oobe_complete_path.value() << " doesn't exist.";
else
file_util::CloseFile(oobe_flag_file);
}
@@ -614,7 +632,8 @@ bool WizardController::IsDeviceRegistered() {
// Pref is not set. For compatibility check flag file. It causes blocking
// IO on UI thread. But it's required for update from old versions.
base::ThreadRestrictions::ScopedAllowIO allow_io;
- FilePath oobe_complete_flag_file_path(kOobeCompleteFlagFilePath);
+ FilePath oobe_complete_flag_file_path = GetOobeCompleteFlagPath();
+ DVLOG(1) << "Checking " << oobe_complete_flag_file_path.value();
bool file_exists = file_util::PathExists(oobe_complete_flag_file_path);
SaveIntegerPreferenceForced(kDeviceRegistered, file_exists ? 1 : 0);
return file_exists;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698