blob: e94df93fb1e85ff6c3cf647854b6ba52ac811e92 [file] [log] [blame]
Alex Deymoc705cc82014-02-19 11:15:00 -08001// Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "update_engine/policy_manager/chromeos_policy.h"
6#include "update_engine/policy_manager/policy_manager.h"
Alex Deymo2de23f52014-02-26 14:30:13 -08007#include "update_engine/policy_manager/real_state.h"
Alex Deymoc705cc82014-02-19 11:15:00 -08008
9namespace chromeos_policy_manager {
10
11template <typename T>
12bool InitProvider(scoped_ptr<T>* handle_ptr, T* provider) {
13 handle_ptr->reset(provider);
14 return handle_ptr->get() && (*handle_ptr)->Init();
15}
16
17bool PolicyManager::Init() {
18 // TODO(deymo): Make it possible to replace this policy with a different
19 // implementation with a build-time flag.
20 policy_.reset(new ChromeOSPolicy());
21
Alex Deymo2de23f52014-02-26 14:30:13 -080022 state_.reset(new RealState());
Alex Deymoc705cc82014-02-19 11:15:00 -080023
Alex Deymo2de23f52014-02-26 14:30:13 -080024 return state_->Init();
Alex Deymoc705cc82014-02-19 11:15:00 -080025}
26
27} // namespace chromeos_policy_manager