Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / chromeos / policy / device_network_configuration_updater.h
blob6b9b762fe016000b99b58f268c2fe2bbb1f3d25c
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_NETWORK_CONFIGURATION_UPDATER_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_NETWORK_CONFIGURATION_UPDATER_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/callback_list.h"
12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h"
15 #include "chrome/browser/chromeos/policy/network_configuration_updater.h"
16 #include "components/onc/onc_constants.h"
18 namespace base {
19 class DictionaryValue;
20 class ListValue;
21 class Value;
24 namespace chromeos {
25 class CrosSettings;
26 class ManagedNetworkConfigurationHandler;
27 class NetworkDeviceHandler;
29 namespace onc {
30 class CertificateImporter;
34 namespace policy {
36 class PolicyService;
38 // Implements addtional special handling of ONC device policies, which requires
39 // listening for notifications from CrosSettings.
40 class DeviceNetworkConfigurationUpdater : public NetworkConfigurationUpdater {
41 public:
42 virtual ~DeviceNetworkConfigurationUpdater();
44 // Creates an updater that applies the ONC device policy from |policy_service|
45 // once the policy service is completely initialized and on each policy
46 // change. The argument objects must outlive the returned updater.
47 static scoped_ptr<DeviceNetworkConfigurationUpdater> CreateForDevicePolicy(
48 scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer,
49 PolicyService* policy_service,
50 chromeos::ManagedNetworkConfigurationHandler* network_config_handler,
51 chromeos::NetworkDeviceHandler* network_device_handler,
52 chromeos::CrosSettings* cros_settings);
54 private:
55 DeviceNetworkConfigurationUpdater(
56 scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer,
57 PolicyService* policy_service,
58 chromeos::ManagedNetworkConfigurationHandler* network_config_handler,
59 chromeos::NetworkDeviceHandler* network_device_handler,
60 chromeos::CrosSettings* cros_settings);
62 virtual void Init() OVERRIDE;
63 virtual void ImportCertificates(const base::ListValue& certificates_onc)
64 OVERRIDE;
65 virtual void ApplyNetworkPolicy(base::ListValue* network_configs_onc,
66 base::DictionaryValue* global_network_config)
67 OVERRIDE;
68 void OnDataRoamingSettingChanged();
70 chromeos::NetworkDeviceHandler* network_device_handler_;
71 chromeos::CrosSettings* cros_settings_;
72 scoped_ptr<base::CallbackList<void(void)>::Subscription>
73 data_roaming_setting_subscription_;
75 base::WeakPtrFactory<DeviceNetworkConfigurationUpdater> weak_factory_;
77 DISALLOW_COPY_AND_ASSIGN(DeviceNetworkConfigurationUpdater);
80 } // namespace policy
82 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_NETWORK_CONFIGURATION_UPDATER_H_