OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_NET_ONC_UTILS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_ONC_UTILS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_NET_ONC_UTILS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NET_ONC_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "components/onc/onc_constants.h" | 11 #include "components/onc/onc_constants.h" |
12 | 12 |
13 class PrefService; | 13 class PrefService; |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class DictionaryValue; | 16 class DictionaryValue; |
17 class ListValue; | 17 class ListValue; |
18 } | 18 } |
19 | 19 |
| 20 namespace user_manager { |
| 21 class User; |
| 22 } |
| 23 |
20 namespace chromeos { | 24 namespace chromeos { |
21 | 25 |
22 class NetworkState; | 26 class NetworkState; |
23 class User; | |
24 | 27 |
25 namespace onc { | 28 namespace onc { |
26 | 29 |
27 // Translates |onc_proxy_settings|, which has to be a valid ONC ProxySettings | 30 // Translates |onc_proxy_settings|, which has to be a valid ONC ProxySettings |
28 // dictionary, to a ProxyConfig dictionary (see | 31 // dictionary, to a ProxyConfig dictionary (see |
29 // chrome/browser/prefs/proxy_config_dictionary.h). | 32 // chrome/browser/prefs/proxy_config_dictionary.h). |
30 // | 33 // |
31 // This function is used to translate ONC ProxySettings to the "ProxyConfig" | 34 // This function is used to translate ONC ProxySettings to the "ProxyConfig" |
32 // field of the Shill configuration. | 35 // field of the Shill configuration. |
33 scoped_ptr<base::DictionaryValue> ConvertOncProxySettingsToProxyConfig( | 36 scoped_ptr<base::DictionaryValue> ConvertOncProxySettingsToProxyConfig( |
34 const base::DictionaryValue& onc_proxy_settings); | 37 const base::DictionaryValue& onc_proxy_settings); |
35 | 38 |
36 // Replaces string placeholders in |network_configs|, which must be a list of | 39 // Replaces string placeholders in |network_configs|, which must be a list of |
37 // ONC NetworkConfigurations. Currently only user name placeholders are | 40 // ONC NetworkConfigurations. Currently only user name placeholders are |
38 // implemented, which are replaced by attributes of the logged-in user with | 41 // implemented, which are replaced by attributes of the logged-in user with |
39 // |hashed_username|. | 42 // |hashed_username|. |
40 void ExpandStringPlaceholdersInNetworksForUser( | 43 void ExpandStringPlaceholdersInNetworksForUser( |
41 const chromeos::User* user, | 44 const user_manager::User* user, |
42 base::ListValue* network_configs); | 45 base::ListValue* network_configs); |
43 | 46 |
44 void ImportNetworksForUser(const chromeos::User* user, | 47 void ImportNetworksForUser(const user_manager::User* user, |
45 const base::ListValue& network_configs, | 48 const base::ListValue& network_configs, |
46 std::string* error); | 49 std::string* error); |
47 | 50 |
48 // Looks up the policy for |guid| for the current active user and sets | 51 // Looks up the policy for |guid| for the current active user and sets |
49 // |global_config| (if not NULL) and |onc_source| (if not NULL) accordingly. If | 52 // |global_config| (if not NULL) and |onc_source| (if not NULL) accordingly. If |
50 // |guid| is empty, returns NULL and sets the |global_config| and |onc_source| | 53 // |guid| is empty, returns NULL and sets the |global_config| and |onc_source| |
51 // if a policy is found. | 54 // if a policy is found. |
52 const base::DictionaryValue* FindPolicyForActiveUser( | 55 const base::DictionaryValue* FindPolicyForActiveUser( |
53 const std::string& guid, | 56 const std::string& guid, |
54 ::onc::ONCSource* onc_source); | 57 ::onc::ONCSource* onc_source); |
(...skipping 18 matching lines...) Expand all Loading... |
73 | 76 |
74 // Convenience function to check only whether a policy for a network exists. | 77 // Convenience function to check only whether a policy for a network exists. |
75 bool HasPolicyForNetwork(const PrefService* profile_prefs, | 78 bool HasPolicyForNetwork(const PrefService* profile_prefs, |
76 const PrefService* local_state_prefs, | 79 const PrefService* local_state_prefs, |
77 const NetworkState& network); | 80 const NetworkState& network); |
78 | 81 |
79 } // namespace onc | 82 } // namespace onc |
80 } // namespace chromeos | 83 } // namespace chromeos |
81 | 84 |
82 #endif // CHROME_BROWSER_CHROMEOS_NET_ONC_UTILS_H_ | 85 #endif // CHROME_BROWSER_CHROMEOS_NET_ONC_UTILS_H_ |
OLD | NEW |