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/policy/network_configuration_updater.h" | 5 #include "chrome/browser/chromeos/policy/network_configuration_updater.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chromeos/network/onc/onc_certificate_importer.h" | |
12 #include "chromeos/network/onc/onc_utils.h" | 11 #include "chromeos/network/onc/onc_utils.h" |
13 #include "components/policy/core/common/policy_map.h" | 12 #include "components/policy/core/common/policy_map.h" |
14 #include "policy/policy_constants.h" | 13 #include "policy/policy_constants.h" |
15 | 14 |
16 namespace policy { | 15 namespace policy { |
17 | 16 |
18 NetworkConfigurationUpdater::~NetworkConfigurationUpdater() { | 17 NetworkConfigurationUpdater::~NetworkConfigurationUpdater() { |
19 policy_service_->RemoveObserver(POLICY_DOMAIN_CHROME, this); | 18 policy_service_->RemoveObserver(POLICY_DOMAIN_CHROME, this); |
20 } | 19 } |
21 | 20 |
(...skipping 11 matching lines...) Expand all Loading... |
33 if (policy_service_->IsInitializationComplete(POLICY_DOMAIN_CHROME)) { | 32 if (policy_service_->IsInitializationComplete(POLICY_DOMAIN_CHROME)) { |
34 VLOG(1) << LogHeader() << " initialized."; | 33 VLOG(1) << LogHeader() << " initialized."; |
35 policy_service_->RemoveObserver(POLICY_DOMAIN_CHROME, this); | 34 policy_service_->RemoveObserver(POLICY_DOMAIN_CHROME, this); |
36 ApplyPolicy(); | 35 ApplyPolicy(); |
37 } | 36 } |
38 } | 37 } |
39 | 38 |
40 NetworkConfigurationUpdater::NetworkConfigurationUpdater( | 39 NetworkConfigurationUpdater::NetworkConfigurationUpdater( |
41 onc::ONCSource onc_source, | 40 onc::ONCSource onc_source, |
42 std::string policy_key, | 41 std::string policy_key, |
43 scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer, | |
44 PolicyService* policy_service, | 42 PolicyService* policy_service, |
45 chromeos::ManagedNetworkConfigurationHandler* network_config_handler) | 43 chromeos::ManagedNetworkConfigurationHandler* network_config_handler) |
46 : onc_source_(onc_source), | 44 : onc_source_(onc_source), |
47 network_config_handler_(network_config_handler), | 45 network_config_handler_(network_config_handler), |
48 certificate_importer_(certificate_importer.Pass()), | |
49 policy_key_(policy_key), | 46 policy_key_(policy_key), |
50 policy_change_registrar_(policy_service, | 47 policy_change_registrar_(policy_service, |
51 PolicyNamespace(POLICY_DOMAIN_CHROME, | 48 PolicyNamespace(POLICY_DOMAIN_CHROME, |
52 std::string())), | 49 std::string())), |
53 policy_service_(policy_service) { | 50 policy_service_(policy_service) { |
54 } | 51 } |
55 | 52 |
56 void NetworkConfigurationUpdater::Init() { | 53 void NetworkConfigurationUpdater::Init() { |
57 policy_change_registrar_.Observe( | 54 policy_change_registrar_.Observe( |
58 policy_key_, | 55 policy_key_, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 94 |
98 ImportCertificates(certificates); | 95 ImportCertificates(certificates); |
99 ApplyNetworkPolicy(&network_configs, &global_network_config); | 96 ApplyNetworkPolicy(&network_configs, &global_network_config); |
100 } | 97 } |
101 | 98 |
102 std::string NetworkConfigurationUpdater::LogHeader() const { | 99 std::string NetworkConfigurationUpdater::LogHeader() const { |
103 return chromeos::onc::GetSourceAsString(onc_source_); | 100 return chromeos::onc::GetSourceAsString(onc_source_); |
104 } | 101 } |
105 | 102 |
106 } // namespace policy | 103 } // namespace policy |
OLD | NEW |