Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 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 | |
| 5 | #ifndef SHILL_PROXY_FACTORY_ |
| 6 | #define SHILL_PROXY_FACTORY_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include <base/basictypes.h> |
Darin Petkov | ab565bb | 2011-10-06 02:55:51 -0700 | [diff] [blame] | 11 | #include <base/lazy_instance.h> |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 12 | #include <base/memory/scoped_ptr.h> |
Darin Petkov | d196726 | 2011-07-18 14:55:18 -0700 | [diff] [blame] | 13 | #include <dbus-c++/dbus.h> |
| 14 | |
| 15 | #include "shill/refptr_types.h" |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 16 | |
| 17 | namespace shill { |
| 18 | |
Darin Petkov | 580c7af | 2011-10-24 12:32:50 +0200 | [diff] [blame] | 19 | class DBusPropertiesProxyDelegate; |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 20 | class DBusPropertiesProxyInterface; |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 21 | class DHCPProxyInterface; |
Darin Petkov | 580c7af | 2011-10-24 12:32:50 +0200 | [diff] [blame] | 22 | class ModemCDMAProxyDelegate; |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 23 | class ModemCDMAProxyInterface; |
Darin Petkov | 580c7af | 2011-10-24 12:32:50 +0200 | [diff] [blame] | 24 | class ModemGSMCardProxyDelegate; |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 25 | class ModemGSMCardProxyInterface; |
Darin Petkov | 580c7af | 2011-10-24 12:32:50 +0200 | [diff] [blame] | 26 | class ModemGSMNetworkProxyDelegate; |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 27 | class ModemGSMNetworkProxyInterface; |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 28 | class ModemManager; |
| 29 | class ModemManagerProxyInterface; |
Darin Petkov | 580c7af | 2011-10-24 12:32:50 +0200 | [diff] [blame] | 30 | class ModemProxyDelegate; |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 31 | class ModemProxyInterface; |
Darin Petkov | e604f70 | 2011-07-28 15:51:17 -0700 | [diff] [blame] | 32 | class ModemSimpleProxyInterface; |
Darin Petkov | 394b7d4 | 2011-11-03 15:48:02 +0100 | [diff] [blame] | 33 | class PowerManagerProxyDelegate; |
| 34 | class PowerManagerProxyInterface; |
Darin Petkov | d196726 | 2011-07-18 14:55:18 -0700 | [diff] [blame] | 35 | class SupplicantInterfaceProxyInterface; |
| 36 | class SupplicantProcessProxyInterface; |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 37 | |
| 38 | // Global DBus proxy factory that can be mocked out in tests. |
| 39 | class ProxyFactory { |
| 40 | public: |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 41 | virtual ~ProxyFactory(); |
| 42 | |
Darin Petkov | ab565bb | 2011-10-06 02:55:51 -0700 | [diff] [blame] | 43 | // Since this is a singleton, use ProxyFactory::GetInstance()->Foo() |
| 44 | static ProxyFactory *GetInstance(); |
| 45 | |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 46 | void Init(); |
| 47 | |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 48 | virtual DBusPropertiesProxyInterface *CreateDBusPropertiesProxy( |
Darin Petkov | 580c7af | 2011-10-24 12:32:50 +0200 | [diff] [blame] | 49 | DBusPropertiesProxyDelegate *delegate, |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame] | 50 | const std::string &path, |
| 51 | const std::string &service); |
| 52 | |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 53 | virtual ModemManagerProxyInterface *CreateModemManagerProxy( |
| 54 | ModemManager *manager, |
| 55 | const std::string &path, |
| 56 | const std::string &service); |
| 57 | |
Darin Petkov | 580c7af | 2011-10-24 12:32:50 +0200 | [diff] [blame] | 58 | virtual ModemProxyInterface *CreateModemProxy(ModemProxyDelegate *delegate, |
Darin Petkov | c5f5656 | 2011-08-06 16:40:05 -0700 | [diff] [blame] | 59 | const std::string &path, |
Darin Petkov | e9d12e0 | 2011-07-27 15:09:37 -0700 | [diff] [blame] | 60 | const std::string &service); |
| 61 | |
Darin Petkov | e604f70 | 2011-07-28 15:51:17 -0700 | [diff] [blame] | 62 | virtual ModemSimpleProxyInterface *CreateModemSimpleProxy( |
| 63 | const std::string &path, |
| 64 | const std::string &service); |
| 65 | |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 66 | virtual ModemCDMAProxyInterface *CreateModemCDMAProxy( |
Darin Petkov | 580c7af | 2011-10-24 12:32:50 +0200 | [diff] [blame] | 67 | ModemCDMAProxyDelegate *delegate, |
Darin Petkov | bec79a2 | 2011-08-01 14:47:17 -0700 | [diff] [blame] | 68 | const std::string &path, |
| 69 | const std::string &service); |
| 70 | |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 71 | virtual ModemGSMCardProxyInterface *CreateModemGSMCardProxy( |
Darin Petkov | 580c7af | 2011-10-24 12:32:50 +0200 | [diff] [blame] | 72 | ModemGSMCardProxyDelegate *delegate, |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 73 | const std::string &path, |
| 74 | const std::string &service); |
| 75 | |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 76 | virtual ModemGSMNetworkProxyInterface *CreateModemGSMNetworkProxy( |
Darin Petkov | 580c7af | 2011-10-24 12:32:50 +0200 | [diff] [blame] | 77 | ModemGSMNetworkProxyDelegate *delegate, |
Darin Petkov | a1e0a1c | 2011-08-25 15:08:33 -0700 | [diff] [blame] | 78 | const std::string &path, |
| 79 | const std::string &service); |
| 80 | |
Darin Petkov | 394b7d4 | 2011-11-03 15:48:02 +0100 | [diff] [blame] | 81 | virtual PowerManagerProxyInterface *CreatePowerManagerProxy( |
| 82 | PowerManagerProxyDelegate *delegate); |
| 83 | |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 84 | virtual SupplicantProcessProxyInterface *CreateSupplicantProcessProxy( |
Darin Petkov | d196726 | 2011-07-18 14:55:18 -0700 | [diff] [blame] | 85 | const char *dbus_path, |
| 86 | const char *dbus_addr); |
| 87 | |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 88 | virtual SupplicantInterfaceProxyInterface *CreateSupplicantInterfaceProxy( |
Darin Petkov | d196726 | 2011-07-18 14:55:18 -0700 | [diff] [blame] | 89 | const WiFiRefPtr &wifi, |
| 90 | const DBus::Path &object_path, |
| 91 | const char *dbus_addr); |
| 92 | |
Darin Petkov | a7b8949 | 2011-07-27 12:48:17 -0700 | [diff] [blame] | 93 | virtual DHCPProxyInterface *CreateDHCPProxy(const std::string &service); |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 94 | |
Darin Petkov | ab565bb | 2011-10-06 02:55:51 -0700 | [diff] [blame] | 95 | DBus::Connection *connection() const { return connection_.get(); } |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 96 | |
Darin Petkov | ab565bb | 2011-10-06 02:55:51 -0700 | [diff] [blame] | 97 | protected: |
| 98 | ProxyFactory(); |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 99 | |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 100 | private: |
Darin Petkov | ab565bb | 2011-10-06 02:55:51 -0700 | [diff] [blame] | 101 | friend struct base::DefaultLazyInstanceTraits<ProxyFactory>; |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 102 | |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 103 | scoped_ptr<DBus::Connection> connection_; |
| 104 | |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 105 | DISALLOW_COPY_AND_ASSIGN(ProxyFactory); |
| 106 | }; |
| 107 | |
| 108 | } // namespace shill |
| 109 | |
| 110 | #endif // SHILL_PROXY_FACTORY_ |