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 #include "chrome/browser/chromeos/net/onc_utils.h" | 5 #include "chrome/browser/chromeos/net/onc_utils.h" |
6 | 6 |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
13 #include "chromeos/network/managed_network_configuration_handler.h" | 13 #include "chromeos/network/managed_network_configuration_handler.h" |
14 #include "chromeos/network/network_configuration_handler.h" | 14 #include "chromeos/network/network_configuration_handler.h" |
15 #include "chromeos/network/network_handler.h" | 15 #include "chromeos/network/network_handler.h" |
16 #include "chromeos/network/network_profile.h" | 16 #include "chromeos/network/network_profile.h" |
17 #include "chromeos/network/network_profile_handler.h" | 17 #include "chromeos/network/network_profile_handler.h" |
18 #include "chromeos/network/network_state.h" | 18 #include "chromeos/network/network_state.h" |
19 #include "chromeos/network/network_state_handler.h" | 19 #include "chromeos/network/network_state_handler.h" |
20 #include "chromeos/network/network_ui_data.h" | 20 #include "chromeos/network/network_ui_data.h" |
21 #include "chromeos/network/onc/onc_normalizer.h" | 21 #include "chromeos/network/onc/onc_normalizer.h" |
22 #include "chromeos/network/onc/onc_signature.h" | 22 #include "chromeos/network/onc/onc_signature.h" |
23 #include "chromeos/network/onc/onc_translator.h" | 23 #include "chromeos/network/onc/onc_translator.h" |
24 #include "chromeos/network/onc/onc_utils.h" | 24 #include "chromeos/network/onc/onc_utils.h" |
| 25 #include "components/onc/onc_pref_names.h" |
25 #include "components/prefs/pref_service.h" | 26 #include "components/prefs/pref_service.h" |
26 #include "components/user_manager/user.h" | 27 #include "components/user_manager/user.h" |
27 #include "components/user_manager/user_manager.h" | 28 #include "components/user_manager/user_manager.h" |
28 #include "third_party/cros_system_api/dbus/service_constants.h" | 29 #include "third_party/cros_system_api/dbus/service_constants.h" |
29 #include "url/gurl.h" | 30 #include "url/gurl.h" |
30 | 31 |
31 namespace chromeos { | 32 namespace chromeos { |
32 namespace onc { | 33 namespace onc { |
33 | 34 |
34 namespace { | 35 namespace { |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 | 311 |
311 const base::DictionaryValue* GetPolicyForNetwork( | 312 const base::DictionaryValue* GetPolicyForNetwork( |
312 const PrefService* profile_prefs, | 313 const PrefService* profile_prefs, |
313 const PrefService* local_state_prefs, | 314 const PrefService* local_state_prefs, |
314 const NetworkState& network, | 315 const NetworkState& network, |
315 ::onc::ONCSource* onc_source) { | 316 ::onc::ONCSource* onc_source) { |
316 VLOG(2) << "GetPolicyForNetwork: " << network.path(); | 317 VLOG(2) << "GetPolicyForNetwork: " << network.path(); |
317 *onc_source = ::onc::ONC_SOURCE_NONE; | 318 *onc_source = ::onc::ONC_SOURCE_NONE; |
318 | 319 |
319 const base::DictionaryValue* network_policy = GetPolicyForNetworkFromPref( | 320 const base::DictionaryValue* network_policy = GetPolicyForNetworkFromPref( |
320 profile_prefs, prefs::kOpenNetworkConfiguration, network); | 321 profile_prefs, ::onc::prefs::kOpenNetworkConfiguration, network); |
321 if (network_policy) { | 322 if (network_policy) { |
322 VLOG(1) << "Network " << network.path() << " is managed by user policy."; | 323 VLOG(1) << "Network " << network.path() << " is managed by user policy."; |
323 *onc_source = ::onc::ONC_SOURCE_USER_POLICY; | 324 *onc_source = ::onc::ONC_SOURCE_USER_POLICY; |
324 return network_policy; | 325 return network_policy; |
325 } | 326 } |
326 network_policy = GetPolicyForNetworkFromPref( | 327 network_policy = GetPolicyForNetworkFromPref( |
327 local_state_prefs, prefs::kDeviceOpenNetworkConfiguration, network); | 328 local_state_prefs, ::onc::prefs::kDeviceOpenNetworkConfiguration, |
| 329 network); |
328 if (network_policy) { | 330 if (network_policy) { |
329 VLOG(1) << "Network " << network.path() << " is managed by device policy."; | 331 VLOG(1) << "Network " << network.path() << " is managed by device policy."; |
330 *onc_source = ::onc::ONC_SOURCE_DEVICE_POLICY; | 332 *onc_source = ::onc::ONC_SOURCE_DEVICE_POLICY; |
331 return network_policy; | 333 return network_policy; |
332 } | 334 } |
333 VLOG(2) << "Network " << network.path() << " is unmanaged."; | 335 VLOG(2) << "Network " << network.path() << " is unmanaged."; |
334 return NULL; | 336 return NULL; |
335 } | 337 } |
336 | 338 |
337 bool HasPolicyForNetwork(const PrefService* profile_prefs, | 339 bool HasPolicyForNetwork(const PrefService* profile_prefs, |
338 const PrefService* local_state_prefs, | 340 const PrefService* local_state_prefs, |
339 const NetworkState& network) { | 341 const NetworkState& network) { |
340 ::onc::ONCSource ignored_onc_source; | 342 ::onc::ONCSource ignored_onc_source; |
341 const base::DictionaryValue* policy = onc::GetPolicyForNetwork( | 343 const base::DictionaryValue* policy = onc::GetPolicyForNetwork( |
342 profile_prefs, local_state_prefs, network, &ignored_onc_source); | 344 profile_prefs, local_state_prefs, network, &ignored_onc_source); |
343 return policy != NULL; | 345 return policy != NULL; |
344 } | 346 } |
345 | 347 |
346 } // namespace onc | 348 } // namespace onc |
347 } // namespace chromeos | 349 } // namespace chromeos |
OLD | NEW |