Jay Srinivasan | 4348879 | 2012-06-19 00:25:31 -0700 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS 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 | |
Gilad Arnold | cf175a0 | 2014-07-10 16:48:47 -0700 | [diff] [blame] | 5 | #ifndef UPDATE_ENGINE_CONNECTION_MANAGER_H_ |
| 6 | #define UPDATE_ENGINE_CONNECTION_MANAGER_H_ |
Jay Srinivasan | 4348879 | 2012-06-19 00:25:31 -0700 | [diff] [blame] | 7 | |
Ben Chan | 05735a1 | 2014-09-03 07:48:22 -0700 | [diff] [blame] | 8 | #include <base/macros.h> |
Jay Srinivasan | 4348879 | 2012-06-19 00:25:31 -0700 | [diff] [blame] | 9 | |
Alex Deymo | f6ee016 | 2015-07-31 12:35:22 -0700 | [diff] [blame^] | 10 | #include "update_engine/connection_manager_interface.h" |
Gilad Arnold | 1b9d6ae | 2014-03-03 13:46:07 -0800 | [diff] [blame] | 11 | #include "update_engine/dbus_wrapper_interface.h" |
Jay Srinivasan | 4348879 | 2012-06-19 00:25:31 -0700 | [diff] [blame] | 12 | |
| 13 | namespace chromeos_update_engine { |
| 14 | |
Jay Srinivasan | 4348879 | 2012-06-19 00:25:31 -0700 | [diff] [blame] | 15 | class SystemState; |
| 16 | |
Alex Deymo | f6ee016 | 2015-07-31 12:35:22 -0700 | [diff] [blame^] | 17 | // This class implements the concrete class that talks with the connection |
| 18 | // manager (shill) over DBus. |
| 19 | class ConnectionManager : public ConnectionManagerInterface { |
Jay Srinivasan | 4348879 | 2012-06-19 00:25:31 -0700 | [diff] [blame] | 20 | public: |
Jay Srinivasan | 4348879 | 2012-06-19 00:25:31 -0700 | [diff] [blame] | 21 | // Returns the string representation corresponding to the given |
| 22 | // connection type. |
Alex Deymo | f6ee016 | 2015-07-31 12:35:22 -0700 | [diff] [blame^] | 23 | static const char* StringForConnectionType(NetworkConnectionType type); |
Jay Srinivasan | 4348879 | 2012-06-19 00:25:31 -0700 | [diff] [blame] | 24 | |
Alex Deymo | 6ae9120 | 2014-03-10 19:21:25 -0700 | [diff] [blame] | 25 | // Returns the string representation corresponding to the given tethering |
| 26 | // state. |
Alex Deymo | f6ee016 | 2015-07-31 12:35:22 -0700 | [diff] [blame^] | 27 | static const char* StringForTethering(NetworkTethering tethering); |
| 28 | |
| 29 | // Constructs a new ConnectionManager object initialized with the |
| 30 | // given system state. |
| 31 | explicit ConnectionManager(SystemState* system_state); |
| 32 | ~ConnectionManager() override = default; |
| 33 | |
| 34 | // ConnectionManagerInterface overrides |
| 35 | bool GetConnectionProperties(DBusWrapperInterface* dbus_iface, |
| 36 | NetworkConnectionType* out_type, |
| 37 | NetworkTethering* out_tethering) const override; |
| 38 | bool IsUpdateAllowedOver(NetworkConnectionType type, |
| 39 | NetworkTethering tethering) const override; |
Alex Deymo | 6ae9120 | 2014-03-10 19:21:25 -0700 | [diff] [blame] | 40 | |
Jay Srinivasan | 4348879 | 2012-06-19 00:25:31 -0700 | [diff] [blame] | 41 | private: |
| 42 | // The global context for update_engine |
| 43 | SystemState* system_state_; |
| 44 | |
| 45 | DISALLOW_COPY_AND_ASSIGN(ConnectionManager); |
| 46 | }; |
| 47 | |
| 48 | } // namespace chromeos_update_engine |
| 49 | |
Gilad Arnold | cf175a0 | 2014-07-10 16:48:47 -0700 | [diff] [blame] | 50 | #endif // UPDATE_ENGINE_CONNECTION_MANAGER_H_ |