Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / chromeos / policy / device_network_configuration_updater.h
blobc180a17c1cc47e9681f5cd5bb18369fdf8071c16
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 ~DeviceNetworkConfigurationUpdater() override;
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 PolicyService* policy_service,
49 chromeos::ManagedNetworkConfigurationHandler* network_config_handler,
50 chromeos::NetworkDeviceHandler* network_device_handler,
51 chromeos::CrosSettings* cros_settings);
53 private:
54 DeviceNetworkConfigurationUpdater(
55 PolicyService* policy_service,
56 chromeos::ManagedNetworkConfigurationHandler* network_config_handler,
57 chromeos::NetworkDeviceHandler* network_device_handler,
58 chromeos::CrosSettings* cros_settings);
60 void Init() override;
61 void ImportCertificates(const base::ListValue& certificates_onc) override;
62 void ApplyNetworkPolicy(
63 base::ListValue* network_configs_onc,
64 base::DictionaryValue* global_network_config) override;
65 void OnDataRoamingSettingChanged();
67 chromeos::NetworkDeviceHandler* network_device_handler_;
68 chromeos::CrosSettings* cros_settings_;
69 scoped_ptr<base::CallbackList<void(void)>::Subscription>
70 data_roaming_setting_subscription_;
72 base::WeakPtrFactory<DeviceNetworkConfigurationUpdater> weak_factory_;
74 DISALLOW_COPY_AND_ASSIGN(DeviceNetworkConfigurationUpdater);
77 } // namespace policy
79 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_NETWORK_CONFIGURATION_UPDATER_H_