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_
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"
19 class DictionaryValue
;
26 class ManagedNetworkConfigurationHandler
;
27 class NetworkDeviceHandler
;
30 class CertificateImporter
;
38 // Implements addtional special handling of ONC device policies, which requires
39 // listening for notifications from CrosSettings.
40 class DeviceNetworkConfigurationUpdater
: public NetworkConfigurationUpdater
{
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
);
54 DeviceNetworkConfigurationUpdater(
55 PolicyService
* policy_service
,
56 chromeos::ManagedNetworkConfigurationHandler
* network_config_handler
,
57 chromeos::NetworkDeviceHandler
* network_device_handler
,
58 chromeos::CrosSettings
* cros_settings
);
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
);
79 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_NETWORK_CONFIGURATION_UPDATER_H_