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. 4 5#ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_NETWORK_CONFIGURATION_UPDATER_H_ 6#define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_NETWORK_CONFIGURATION_UPDATER_H_ 7 8#include <string> 9 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" 17 18namespace base { 19class DictionaryValue; 20class ListValue; 21class Value; 22} 23 24namespace chromeos { 25class CrosSettings; 26class ManagedNetworkConfigurationHandler; 27class NetworkDeviceHandler; 28 29namespace onc { 30class CertificateImporter; 31} 32} 33 34namespace policy { 35 36class PolicyService; 37 38// Implements addtional special handling of ONC device policies, which requires 39// listening for notifications from CrosSettings. 40class DeviceNetworkConfigurationUpdater : public NetworkConfigurationUpdater { 41 public: 42 virtual ~DeviceNetworkConfigurationUpdater(); 43 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); 52 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); 59 60 virtual void Init() OVERRIDE; 61 virtual void ImportCertificates(const base::ListValue& certificates_onc) 62 OVERRIDE; 63 virtual void ApplyNetworkPolicy(base::ListValue* network_configs_onc, 64 base::DictionaryValue* global_network_config) 65 OVERRIDE; 66 void OnDataRoamingSettingChanged(); 67 68 chromeos::NetworkDeviceHandler* network_device_handler_; 69 chromeos::CrosSettings* cros_settings_; 70 scoped_ptr<base::CallbackList<void(void)>::Subscription> 71 data_roaming_setting_subscription_; 72 73 base::WeakPtrFactory<DeviceNetworkConfigurationUpdater> weak_factory_; 74 75 DISALLOW_COPY_AND_ASSIGN(DeviceNetworkConfigurationUpdater); 76}; 77 78} // namespace policy 79 80#endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_NETWORK_CONFIGURATION_UPDATER_H_ 81 82