| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 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 CHROME_BROWSER_CHROMEOS_NET_ONC_UTILS_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_NET_ONC_UTILS_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "components/onc/onc_constants.h" | |
| 12 | |
| 13 class PrefService; | |
| 14 | |
| 15 namespace base { | |
| 16 class DictionaryValue; | |
| 17 class ListValue; | |
| 18 } | |
| 19 | |
| 20 namespace user_manager { | |
| 21 class User; | |
| 22 } | |
| 23 | |
| 24 namespace chromeos { | |
| 25 | |
| 26 class NetworkState; | |
| 27 | |
| 28 namespace onc { | |
| 29 | |
| 30 // Replaces string placeholders in |network_configs|, which must be a list of | |
| 31 // ONC NetworkConfigurations. Currently only user name placeholders are | |
| 32 // implemented, which are replaced by attributes of the logged-in user with | |
| 33 // |hashed_username|. | |
| 34 void ExpandStringPlaceholdersInNetworksForUser( | |
| 35 const user_manager::User* user, | |
| 36 base::ListValue* network_configs); | |
| 37 | |
| 38 void ImportNetworksForUser(const user_manager::User* user, | |
| 39 const base::ListValue& network_configs, | |
| 40 std::string* error); | |
| 41 | |
| 42 // Looks up the policy for |guid| for the current active user and sets | |
| 43 // |global_config| (if not NULL) and |onc_source| (if not NULL) accordingly. If | |
| 44 // |guid| is empty, returns NULL and sets the |global_config| and |onc_source| | |
| 45 // if a policy is found. | |
| 46 const base::DictionaryValue* FindPolicyForActiveUser( | |
| 47 const std::string& guid, | |
| 48 ::onc::ONCSource* onc_source); | |
| 49 | |
| 50 // Returns the global network configuration section of the active user's network | |
| 51 // policy (if |for_active_user| is true) or of the device policy. | |
| 52 const base::DictionaryValue* GetGlobalConfigFromPolicy(bool for_active_user); | |
| 53 | |
| 54 // Convenvience function to retrieve the "AllowOnlyPolicyNetworksToAutoconnect" | |
| 55 // setting from the global network configuration (see | |
| 56 // GetGlobalConfigFromPolicy). | |
| 57 bool PolicyAllowsOnlyPolicyNetworksToAutoconnect(bool for_active_user); | |
| 58 | |
| 59 // Returns the effective (user or device) policy for network |network|. Both | |
| 60 // |profile_prefs| and |local_state_prefs| might be NULL. Returns NULL if no | |
| 61 // applicable policy is found. Sets |onc_source| accordingly. | |
| 62 const base::DictionaryValue* GetPolicyForNetwork( | |
| 63 const PrefService* profile_prefs, | |
| 64 const PrefService* local_state_prefs, | |
| 65 const NetworkState& network, | |
| 66 ::onc::ONCSource* onc_source); | |
| 67 | |
| 68 // Convenience function to check only whether a policy for a network exists. | |
| 69 bool HasPolicyForNetwork(const PrefService* profile_prefs, | |
| 70 const PrefService* local_state_prefs, | |
| 71 const NetworkState& network); | |
| 72 | |
| 73 } // namespace onc | |
| 74 } // namespace chromeos | |
| 75 | |
| 76 #endif // CHROME_BROWSER_CHROMEOS_NET_ONC_UTILS_H_ | |
| OLD | NEW |