blob: c8e7d4e1d50e7f2d3dbdd600c3d6e59f0fbb1a69 [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
Alex Deymoc705cc82014-02-19 11:15:00 -08005#include "update_engine/policy_manager/policy_manager.h"
Alex Deymo7b948f02014-03-10 17:01:10 -07006
7#include "update_engine/policy_manager/chromeos_policy.h"
Alex Deymo94c06162014-03-21 20:34:46 -07008#include "update_engine/policy_manager/state.h"
Alex Deymoc705cc82014-02-19 11:15:00 -08009
Alex Deymo7b948f02014-03-10 17:01:10 -070010using base::Closure;
11
Alex Deymoc705cc82014-02-19 11:15:00 -080012namespace chromeos_policy_manager {
13
14template <typename T>
15bool InitProvider(scoped_ptr<T>* handle_ptr, T* provider) {
Alex Deymo53556ec2014-03-17 10:05:57 -070016 handle_ptr->reset(provider);
17 return handle_ptr->get() && (*handle_ptr)->Init();
Alex Deymoc705cc82014-02-19 11:15:00 -080018}
19
Gilad Arnold308c1012014-03-12 15:37:06 -070020bool PolicyManager::Init(State* state) {
Alex Deymoc705cc82014-02-19 11:15:00 -080021 // TODO(deymo): Make it possible to replace this policy with a different
22 // implementation with a build-time flag.
23 policy_.reset(new ChromeOSPolicy());
24
Gilad Arnold308c1012014-03-12 15:37:06 -070025 state_.reset(state);
Alex Deymoc705cc82014-02-19 11:15:00 -080026
Gilad Arnold308c1012014-03-12 15:37:06 -070027 return true;
Alex Deymoc705cc82014-02-19 11:15:00 -080028}
29
Alex Deymoc705cc82014-02-19 11:15:00 -080030} // namespace chromeos_policy_manager