OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/policy/network_configuration_updater.h" | 5 #include "chrome/browser/policy/network_configuration_updater.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/cros/network_library.h" | 7 #include "chrome/browser/chromeos/cros/network_library.h" |
8 #include "chrome/browser/policy/policy_map.h" | 8 #include "chrome/browser/policy/policy_map.h" |
9 #include "policy/policy_constants.h" | 9 #include "policy/policy_constants.h" |
10 | 10 |
11 namespace policy { | 11 namespace policy { |
12 | 12 |
13 NetworkConfigurationUpdater::NetworkConfigurationUpdater( | 13 NetworkConfigurationUpdater::NetworkConfigurationUpdater( |
14 ConfigurationPolicyProvider* provider, | 14 ConfigurationPolicyProvider* provider, |
15 chromeos::NetworkLibrary* network_library) | 15 chromeos::NetworkLibrary* network_library) |
16 : network_library_(network_library) { | 16 : network_library_(network_library) { |
17 DCHECK(network_library_); | 17 DCHECK(network_library_); |
18 provider_registrar_.Init(provider, this); | 18 provider_registrar_.Init(provider, this); |
19 Update(); | 19 Update(); |
20 } | 20 } |
21 | 21 |
22 NetworkConfigurationUpdater::~NetworkConfigurationUpdater() {} | 22 NetworkConfigurationUpdater::~NetworkConfigurationUpdater() {} |
23 | 23 |
24 void NetworkConfigurationUpdater::OnUpdatePolicy() { | 24 void NetworkConfigurationUpdater::OnUpdatePolicy( |
| 25 ConfigurationPolicyProvider* provider) { |
25 Update(); | 26 Update(); |
26 } | 27 } |
27 | 28 |
28 void NetworkConfigurationUpdater::Update() { | 29 void NetworkConfigurationUpdater::Update() { |
29 ConfigurationPolicyProvider* provider = provider_registrar_.provider(); | 30 ConfigurationPolicyProvider* provider = provider_registrar_.provider(); |
30 | 31 |
31 PolicyMap policy; | 32 PolicyMap policy; |
32 if (!provider->Provide(&policy)) { | 33 if (!provider->Provide(&policy)) { |
33 LOG(WARNING) << "Failed to read policy from policy provider."; | 34 LOG(WARNING) << "Failed to read policy from policy provider."; |
34 return; | 35 return; |
(...skipping 19 matching lines...) Expand all Loading... |
54 } | 55 } |
55 | 56 |
56 if (*cached_value != new_network_config) { | 57 if (*cached_value != new_network_config) { |
57 *cached_value = new_network_config; | 58 *cached_value = new_network_config; |
58 if (!network_library_->LoadOncNetworks(new_network_config)) | 59 if (!network_library_->LoadOncNetworks(new_network_config)) |
59 LOG(WARNING) << "Network library failed to load ONC configuration."; | 60 LOG(WARNING) << "Network library failed to load ONC configuration."; |
60 } | 61 } |
61 } | 62 } |
62 | 63 |
63 } // namespace policy | 64 } // namespace policy |
OLD | NEW |