Index: chrome/browser/chromeos/login/startup_utils.cc |
diff --git a/chrome/browser/chromeos/login/startup_utils.cc b/chrome/browser/chromeos/login/startup_utils.cc |
index 7656ba403261a32c72270e5462e7b73e8a3d2427..f90457ca51879eabc3e978e5298d598a725c707d 100644 |
--- a/chrome/browser/chromeos/login/startup_utils.cc |
+++ b/chrome/browser/chromeos/login/startup_utils.cc |
@@ -12,6 +12,7 @@ |
#include "base/prefs/pref_service.h" |
#include "base/sys_info.h" |
#include "base/threading/thread_restrictions.h" |
+#include "base/time/time.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
#include "chrome/common/chrome_paths.h" |
@@ -87,6 +88,7 @@ void StartupUtils::MarkOobeCompleted() { |
SaveBoolPreferenceForced(prefs::kEnrollmentRecoveryRequired, false); |
} |
+// static |
void StartupUtils::SaveOobePendingScreen(const std::string& screen) { |
SaveStringPreferenceForced(prefs::kOobeScreenPending, screen); |
} |
@@ -95,7 +97,8 @@ void StartupUtils::SaveOobePendingScreen(const std::string& screen) { |
// completed. |
// On chrome device, returns /home/chronos/.oobe_completed. |
// On Linux desktop, returns {DIR_USER_DATA}/.oobe_completed. |
-static base::FilePath GetOobeCompleteFlagPath() { |
+// static |
+base::FilePath StartupUtils::GetOobeCompleteFlagPath() { |
// The constant is defined here so it won't be referenced directly. |
const char kOobeCompleteFlagFilePath[] = "/home/chronos/.oobe_completed"; |
@@ -108,9 +111,19 @@ static base::FilePath GetOobeCompleteFlagPath() { |
} |
} |
+base::TimeDelta StartupUtils::GetTimeSinceOobeFileCreation() { |
+ const base::FilePath oobe_timestamp_file = |
+ StartupUtils::GetOobeCompleteFlagPath(); |
achuithb
2015/09/18 16:39:11
Don't think you need StartupUtils::
Greg Levin
2015/09/18 18:49:27
Done.
|
+ base::File::Info fileInfo; |
+ if (base::GetFileInfo(oobe_timestamp_file, &fileInfo)) |
+ return base::Time::Now() - fileInfo.creation_time; |
+ return base::TimeDelta(); |
+} |
+ |
static void CreateOobeCompleteFlagFile() { |
// Create flag file for boot-time init scripts. |
- base::FilePath oobe_complete_path = GetOobeCompleteFlagPath(); |
+ const base::FilePath oobe_complete_path = |
+ StartupUtils::GetOobeCompleteFlagPath(); |
if (!base::PathExists(oobe_complete_path)) { |
FILE* oobe_flag_file = base::OpenFile(oobe_complete_path, "w+b"); |
if (oobe_flag_file == NULL) |