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 CHROMEOS_NETWORK_NETWORK_DEVICE_HANDLER_IMPL_H_
6 #define CHROMEOS_NETWORK_NETWORK_DEVICE_HANDLER_IMPL_H_
11 #include "base/basictypes.h"
12 #include "base/callback.h"
13 #include "base/compiler_specific.h"
14 #include "chromeos/chromeos_export.h"
15 #include "chromeos/network/network_device_handler.h"
16 #include "chromeos/network/network_handler.h"
17 #include "chromeos/network/network_handler_callbacks.h"
18 #include "chromeos/network/network_state_handler_observer.h"
22 class NetworkStateHandler
;
24 class CHROMEOS_EXPORT NetworkDeviceHandlerImpl
25 : public NetworkDeviceHandler
,
26 public NetworkStateHandlerObserver
{
28 ~NetworkDeviceHandlerImpl() override
;
30 // NetworkDeviceHandler overrides
31 void GetDeviceProperties(
32 const std::string
& device_path
,
33 const network_handler::DictionaryResultCallback
& callback
,
34 const network_handler::ErrorCallback
& error_callback
) const override
;
36 void SetDeviceProperty(
37 const std::string
& device_path
,
38 const std::string
& property_name
,
39 const base::Value
& value
,
40 const base::Closure
& callback
,
41 const network_handler::ErrorCallback
& error_callback
) override
;
43 void RequestRefreshIPConfigs(
44 const std::string
& device_path
,
45 const base::Closure
& callback
,
46 const network_handler::ErrorCallback
& error_callback
) override
;
49 const std::string
& device_path
,
50 const base::Closure
& callback
,
51 const network_handler::ErrorCallback
& error_callback
) override
;
53 void RegisterCellularNetwork(
54 const std::string
& device_path
,
55 const std::string
& network_id
,
56 const base::Closure
& callback
,
57 const network_handler::ErrorCallback
& error_callback
) override
;
60 const std::string
& device_path
,
61 const std::string
& carrier
,
62 const base::Closure
& callback
,
63 const network_handler::ErrorCallback
& error_callback
) override
;
66 const std::string
& device_path
,
68 const std::string
& pin
,
69 const base::Closure
& callback
,
70 const network_handler::ErrorCallback
& error_callback
) override
;
72 void EnterPin(const std::string
& device_path
,
73 const std::string
& pin
,
74 const base::Closure
& callback
,
75 const network_handler::ErrorCallback
& error_callback
) override
;
78 const std::string
& device_path
,
79 const std::string
& puk
,
80 const std::string
& new_pin
,
81 const base::Closure
& callback
,
82 const network_handler::ErrorCallback
& error_callback
) override
;
84 void ChangePin(const std::string
& device_path
,
85 const std::string
& old_pin
,
86 const std::string
& new_pin
,
87 const base::Closure
& callback
,
88 const network_handler::ErrorCallback
& error_callback
) override
;
90 void SetCellularAllowRoaming(bool allow_roaming
) override
;
92 void SetWifiTDLSEnabled(
93 const std::string
& ip_or_mac_address
,
95 const network_handler::StringResultCallback
& callback
,
96 const network_handler::ErrorCallback
& error_callback
) override
;
98 void GetWifiTDLSStatus(
99 const std::string
& ip_or_mac_address
,
100 const network_handler::StringResultCallback
& callback
,
101 const network_handler::ErrorCallback
& error_callback
) override
;
103 void AddWifiWakeOnPacketConnection(
104 const net::IPEndPoint
& ip_endpoint
,
105 const base::Closure
& callback
,
106 const network_handler::ErrorCallback
& error_callback
) override
;
108 void RemoveWifiWakeOnPacketConnection(
109 const net::IPEndPoint
& ip_endpoint
,
110 const base::Closure
& callback
,
111 const network_handler::ErrorCallback
& error_callback
) override
;
113 void RemoveAllWifiWakeOnPacketConnections(
114 const base::Closure
& callback
,
115 const network_handler::ErrorCallback
& error_callback
) override
;
117 // NetworkStateHandlerObserver overrides
118 void DeviceListChanged() override
;
121 friend class NetworkHandler
;
122 friend class NetworkDeviceHandlerTest
;
124 NetworkDeviceHandlerImpl();
126 void Init(NetworkStateHandler
* network_state_handler
);
128 // Apply the current value of |cellular_allow_roaming_| to all existing
129 // cellular devices of Shill.
130 void ApplyCellularAllowRoamingToShill();
132 // Get the DeviceState for the wifi device, if any.
133 const DeviceState
* GetWifiDeviceState(
134 const network_handler::ErrorCallback
& error_callback
);
136 NetworkStateHandler
* network_state_handler_
;
137 bool cellular_allow_roaming_
;
139 DISALLOW_COPY_AND_ASSIGN(NetworkDeviceHandlerImpl
);
142 } // namespace chromeos
144 #endif // CHROMEOS_NETWORK_NETWORK_DEVICE_HANDLER_IMPL_H_