network_device_handler_impl.h revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
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 CHROMEOS_NETWORK_NETWORK_DEVICE_HANDLER_IMPL_H_
6#define CHROMEOS_NETWORK_NETWORK_DEVICE_HANDLER_IMPL_H_
7
8#include <map>
9#include <string>
10
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"
19
20namespace chromeos {
21
22class NetworkStateHandler;
23
24class CHROMEOS_EXPORT NetworkDeviceHandlerImpl
25    : public NetworkDeviceHandler,
26      public NetworkStateHandlerObserver {
27 public:
28  virtual ~NetworkDeviceHandlerImpl();
29
30  // NetworkDeviceHandler overrides
31  virtual void GetDeviceProperties(
32      const std::string& device_path,
33      const network_handler::DictionaryResultCallback& callback,
34      const network_handler::ErrorCallback& error_callback) const OVERRIDE;
35
36  virtual 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;
42
43  virtual void RequestRefreshIPConfigs(
44      const std::string& device_path,
45      const base::Closure& callback,
46      const network_handler::ErrorCallback& error_callback) OVERRIDE;
47
48  virtual void ProposeScan(const std::string& device_path,
49                           const base::Closure& callback,
50                           const network_handler::ErrorCallback& error_callback)
51      OVERRIDE;
52
53  virtual 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;
58
59  virtual void SetCarrier(const std::string& device_path,
60                          const std::string& carrier,
61                          const base::Closure& callback,
62                          const network_handler::ErrorCallback& error_callback)
63      OVERRIDE;
64
65  virtual void RequirePin(const std::string& device_path,
66                          bool require_pin,
67                          const std::string& pin,
68                          const base::Closure& callback,
69                          const network_handler::ErrorCallback& error_callback)
70      OVERRIDE;
71
72  virtual void EnterPin(const std::string& device_path,
73                        const std::string& pin,
74                        const base::Closure& callback,
75                        const network_handler::ErrorCallback& error_callback)
76      OVERRIDE;
77
78  virtual void UnblockPin(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)
83      OVERRIDE;
84
85  virtual void ChangePin(const std::string& device_path,
86                         const std::string& old_pin,
87                         const std::string& new_pin,
88                         const base::Closure& callback,
89                         const network_handler::ErrorCallback& error_callback)
90      OVERRIDE;
91
92  virtual void SetCellularAllowRoaming(bool allow_roaming) OVERRIDE;
93
94  virtual void SetWifiTDLSEnabled(
95      const std::string& ip_or_mac_address,
96      bool enabled,
97      const network_handler::StringResultCallback& callback,
98      const network_handler::ErrorCallback& error_callback) OVERRIDE;
99
100  virtual void GetWifiTDLSStatus(
101      const std::string& ip_or_mac_address,
102      const network_handler::StringResultCallback& callback,
103      const network_handler::ErrorCallback& error_callback) OVERRIDE;
104
105  // NetworkStateHandlerObserver overrides
106  virtual void DeviceListChanged() OVERRIDE;
107
108 private:
109  friend class NetworkHandler;
110  friend class NetworkDeviceHandlerTest;
111
112  NetworkDeviceHandlerImpl();
113
114  void Init(NetworkStateHandler* network_state_handler);
115
116  // Apply the current value of |cellular_allow_roaming_| to all existing
117  // cellular devices of Shill.
118  void ApplyCellularAllowRoamingToShill();
119
120  NetworkStateHandler* network_state_handler_;
121  bool cellular_allow_roaming_;
122
123  DISALLOW_COPY_AND_ASSIGN(NetworkDeviceHandlerImpl);
124};
125
126}  // namespace chromeos
127
128#endif  // CHROMEOS_NETWORK_NETWORK_DEVICE_HANDLER_IMPL_H_
129