| // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #include <base/file_util.h> |
| |
| #include "update_engine/system_state.h" |
| |
| namespace chromeos_update_engine { |
| |
| static const char kOOBECompletedMarker[] = "/home/chronos/.oobe_completed"; |
| static const char kPrefsDirectory[] = "/var/lib/update_engine/prefs"; |
| |
| RealSystemState::RealSystemState() |
| : device_policy_(NULL), |
| connection_manager_(this) {} |
| |
| bool RealSystemState::Initialize() { |
| metrics_lib_.Init(); |
| |
| if (!prefs_.Init(FilePath(kPrefsDirectory))) { |
| LOG(ERROR) << "Failed to initialize preferences."; |
| return false; |
| } |
| |
| if (!payload_state_.Initialize(&prefs_)) |
| return false; |
| |
| // All is well. Initialization successful. |
| return true; |
| } |
| |
| bool RealSystemState::IsOOBEComplete() { |
| return file_util::PathExists(FilePath(kOOBECompletedMarker)); |
| } |
| |
| } // namespace chromeos_update_engine |