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_POLICY_NETWORK_CONFIGURATION_UPDATER_IMPL_CROS_H
_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_IMPL_CROS_H
_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_IMPL_CROS_H
_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_IMPL_CROS_H
_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/chromeos/cros/network_constants.h" | 10 #include "chrome/browser/chromeos/cros/network_constants.h" |
11 #include "chrome/browser/chromeos/cros/network_library.h" | 11 #include "chrome/browser/chromeos/cros/network_library.h" |
12 #include "chrome/browser/chromeos/policy/network_configuration_updater.h" | 12 #include "chrome/browser/chromeos/policy/network_configuration_updater.h" |
13 #include "chrome/browser/policy/policy_service.h" | 13 #include "chrome/browser/policy/policy_service.h" |
14 #include "chromeos/network/network_ui_data.h" | 14 #include "chromeos/network/network_ui_data.h" |
15 #include "chromeos/network/onc/onc_constants.h" | 15 #include "chromeos/network/onc/onc_constants.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class Value; | 18 class Value; |
19 } | 19 } |
20 | 20 |
| 21 namespace chromeos { |
| 22 class CertificateHandler; |
| 23 } |
| 24 |
21 namespace policy { | 25 namespace policy { |
22 | 26 |
23 class PolicyMap; | 27 class PolicyMap; |
24 | 28 |
25 // DEPRECATED: will be replaced by NetworkConfigurationImpl. | 29 // DEPRECATED: will be replaced by NetworkConfigurationImpl. |
26 // This implementation pushes policies through the NetworkLibrary. It applies | 30 // This implementation pushes policies through the NetworkLibrary. It applies |
27 // network policies every time one of the relevant policies or Shill's profiles | 31 // network policies every time one of the relevant policies or Shill's profiles |
28 // changed or OnUserPolicyInitialized() is called. If the user policy is | 32 // changed or OnUserPolicyInitialized() is called. If the user policy is |
29 // available, always both the device and the user policy are applied. Otherwise | 33 // available, always both the device and the user policy are applied. Otherwise |
30 // only the device policy is applied. | 34 // only the device policy is applied. |
31 class NetworkConfigurationUpdaterImplCros | 35 class NetworkConfigurationUpdaterImplCros |
32 : public NetworkConfigurationUpdater, | 36 : public NetworkConfigurationUpdater, |
33 public chromeos::NetworkLibrary::NetworkProfileObserver { | 37 public chromeos::NetworkLibrary::NetworkProfileObserver { |
34 public: | 38 public: |
35 NetworkConfigurationUpdaterImplCros( | 39 NetworkConfigurationUpdaterImplCros( |
36 PolicyService* policy_service, | 40 PolicyService* policy_service, |
37 chromeos::NetworkLibrary* network_library); | 41 chromeos::NetworkLibrary* network_library, |
| 42 scoped_ptr<chromeos::CertificateHandler> certificate_handler); |
38 virtual ~NetworkConfigurationUpdaterImplCros(); | 43 virtual ~NetworkConfigurationUpdaterImplCros(); |
39 | 44 |
40 // NetworkProfileObserver overrides. | 45 // NetworkProfileObserver overrides. |
41 virtual void OnProfileListChanged() OVERRIDE; | 46 virtual void OnProfileListChanged() OVERRIDE; |
42 | 47 |
43 // NetworkConfigurationUpdater overrides. | 48 // NetworkConfigurationUpdater overrides. |
44 | 49 |
45 // In this implementation, this function applies both device and user policy. | 50 // In this implementation, this function applies both device and user policy. |
46 virtual void OnUserPolicyInitialized() OVERRIDE; | 51 virtual void OnUserPolicyInitialized() OVERRIDE; |
47 virtual void set_allow_trusted_certificates_from_policy(bool allow) OVERRIDE; | |
48 virtual net::CertTrustAnchorProvider* GetCertTrustAnchorProvider() OVERRIDE; | |
49 | 52 |
50 private: | 53 private: |
51 // Callback that's called by |policy_service_| if the respective ONC policy | 54 // Callback that's called by |policy_service_| if the respective ONC policy |
52 // changed. | 55 // changed. |
53 void OnPolicyChanged(chromeos::onc::ONCSource onc_source, | 56 void OnPolicyChanged(chromeos::onc::ONCSource onc_source, |
54 const base::Value* previous, | 57 const base::Value* previous, |
55 const base::Value* current); | 58 const base::Value* current); |
56 | 59 |
57 // Retrieves the ONC policies from |policy_service_| and pushes the | 60 // Retrieves the ONC policies from |policy_service_| and pushes the |
58 // configurations to |network_library_|. Ensures that a device policy is | 61 // configurations to |network_library_|. Ensures that a device policy is |
59 // always overwritten by a user policy. | 62 // always overwritten by a user policy. |
60 void ApplyNetworkConfigurations(); | 63 void ApplyNetworkConfigurations(); |
61 | 64 |
62 // Push the policy stored at |policy_key| for |onc_source| to | 65 // Push the policy stored at |policy_key| for |onc_source| to |
63 // |network_library_|. | 66 // |network_library_|. |
64 void ApplyNetworkConfiguration(const std::string& policy_key, | 67 void ApplyNetworkConfiguration(const std::string& policy_key, |
65 chromeos::onc::ONCSource onc_source); | 68 chromeos::onc::ONCSource onc_source); |
66 | 69 |
67 // Wraps the policy service we read network configuration from. | 70 // Wraps the policy service we read network configuration from. |
68 PolicyChangeRegistrar policy_change_registrar_; | 71 PolicyChangeRegistrar policy_change_registrar_; |
69 | 72 |
70 // Network library to write network configuration to. | 73 // Network library to write network configuration to. |
71 chromeos::NetworkLibrary* network_library_; | 74 chromeos::NetworkLibrary* network_library_; |
72 | 75 |
| 76 scoped_ptr<chromeos::CertificateHandler> certificate_handler_; |
| 77 |
73 // Whether the user policy is already available. | 78 // Whether the user policy is already available. |
74 bool user_policy_initialized_; | 79 bool user_policy_initialized_; |
75 | 80 |
76 // Whether Web trust is allowed or not. | |
77 bool allow_trusted_certificates_from_policy_; | |
78 | |
79 // The policy service storing the ONC policies. | 81 // The policy service storing the ONC policies. |
80 PolicyService* policy_service_; | 82 PolicyService* policy_service_; |
81 | 83 |
82 // An implementation of CertTrustAnchorProvider. Owned by the updater, but | |
83 // lives on the IO thread. | |
84 net::CertTrustAnchorProvider* cert_trust_provider_; | |
85 | |
86 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationUpdaterImplCros); | 84 DISALLOW_COPY_AND_ASSIGN(NetworkConfigurationUpdaterImplCros); |
87 }; | 85 }; |
88 | 86 |
89 } // namespace policy | 87 } // namespace policy |
90 | 88 |
91 #endif // CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_IMPL_CRO
S_H_ | 89 #endif // CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_CONFIGURATION_UPDATER_IMPL_CRO
S_H_ |
OLD | NEW |