policy_util.h revision 58537e28ecd584eab876aee8be7156509866d23a
1// Copyright 2013 The Chromium 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#ifndef CHROMEOS_NETWORK_POLICY_UTIL_H_ 6#define CHROMEOS_NETWORK_POLICY_UTIL_H_ 7 8#include <map> 9#include <string> 10 11#include "base/memory/scoped_ptr.h" 12 13namespace base { 14class DictionaryValue; 15} 16 17namespace chromeos { 18 19struct NetworkProfile; 20 21namespace policy_util { 22 23typedef std::map<std::string, const base::DictionaryValue*> GuidToPolicyMap; 24 25// Creates a Shill property dictionary from the given arguments. The resulting 26// dictionary will be sent to Shill by the caller. Depending on the profile 27// type, |policy| is interpreted as the user or device policy and |settings| as 28// the user or shared settings. |policy| or |settings| can be NULL, but not 29// both. 30scoped_ptr<base::DictionaryValue> CreateShillConfiguration( 31 const NetworkProfile& profile, 32 const std::string& guid, 33 const base::DictionaryValue* policy, 34 const base::DictionaryValue* settings); 35 36// Returns the policy from |policies| matching |actual_network|, if any exists. 37// Returns NULL otherwise. |actual_network| must be part of a ONC 38// NetworkConfiguration. 39const base::DictionaryValue* FindMatchingPolicy( 40 const GuidToPolicyMap& policies, 41 const base::DictionaryValue& actual_network); 42 43} // namespace policy_util 44 45} // namespace chromeos 46 47#endif // CHROMEOS_NETWORK_POLICY_UTIL_H_ 48