Add ICU message format support
[chromium-blink-merge.git] / chrome / browser / chromeos / net / onc_utils.h
blobbbcafb146dcaa40edfa46b946d3c85e08780a7f2
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.
5 #ifndef CHROME_BROWSER_CHROMEOS_NET_ONC_UTILS_H_
6 #define CHROME_BROWSER_CHROMEOS_NET_ONC_UTILS_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "components/onc/onc_constants.h"
13 class PrefService;
15 namespace base {
16 class DictionaryValue;
17 class ListValue;
20 namespace user_manager {
21 class User;
24 namespace chromeos {
26 class NetworkState;
28 namespace onc {
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);
38 void ImportNetworksForUser(const user_manager::User* user,
39 const base::ListValue& network_configs,
40 std::string* error);
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);
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);
54 // Convenvience function to retrieve the "AllowOnlyPolicyNetworksToAutoconnect"
55 // setting from the global network configuration (see
56 // GetGlobalConfigFromPolicy).
57 bool PolicyAllowsOnlyPolicyNetworksToAutoconnect(bool for_active_user);
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);
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);
73 } // namespace onc
74 } // namespace chromeos
76 #endif // CHROME_BROWSER_CHROMEOS_NET_ONC_UTILS_H_