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 | #include "shill/proxy_factory.h" |
| 6 | |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 7 | #include <base/logging.h> |
| 8 | |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame^] | 9 | #include "shill/dbus_properties_proxy.h" |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 10 | #include "shill/dhcpcd_proxy.h" |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 11 | #include "shill/modem_manager_proxy.h" |
Darin Petkov | d196726 | 2011-07-18 14:55:18 -0700 | [diff] [blame] | 12 | #include "shill/supplicant_interface_proxy.h" |
| 13 | #include "shill/supplicant_process_proxy.h" |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 14 | |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame^] | 15 | using std::string; |
| 16 | |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 17 | namespace shill { |
| 18 | |
| 19 | ProxyFactory *ProxyFactory::factory_ = NULL; |
| 20 | |
| 21 | ProxyFactory::ProxyFactory() {} |
| 22 | |
| 23 | ProxyFactory::~ProxyFactory() {} |
| 24 | |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 25 | void ProxyFactory::Init() { |
| 26 | CHECK(DBus::default_dispatcher); // Initialized in DBusControl::Init. |
| 27 | CHECK(!connection_.get()); |
| 28 | connection_.reset(new DBus::Connection(DBus::Connection::SystemBus())); |
| 29 | } |
| 30 | |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame^] | 31 | DBusPropertiesProxyInterface *ProxyFactory::CreateDBusPropertiesProxy( |
| 32 | Modem *modem, |
| 33 | const string &path, |
| 34 | const string &service) { |
| 35 | return new DBusPropertiesProxy(connection(), modem, path, service); |
| 36 | } |
| 37 | |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 38 | ModemManagerProxyInterface *ProxyFactory::CreateModemManagerProxy( |
| 39 | ModemManager *manager, |
Darin Petkov | 5c97ac5 | 2011-07-19 16:30:49 -0700 | [diff] [blame^] | 40 | const string &path, |
| 41 | const string &service) { |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 42 | return new ModemManagerProxy(connection(), manager, path, service); |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 43 | } |
| 44 | |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 45 | SupplicantProcessProxyInterface *ProxyFactory::CreateSupplicantProcessProxy( |
Darin Petkov | d196726 | 2011-07-18 14:55:18 -0700 | [diff] [blame] | 46 | const char *dbus_path, |
| 47 | const char *dbus_addr) { |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 48 | return new SupplicantProcessProxy(connection(), dbus_path, dbus_addr); |
Darin Petkov | d196726 | 2011-07-18 14:55:18 -0700 | [diff] [blame] | 49 | } |
| 50 | |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 51 | SupplicantInterfaceProxyInterface *ProxyFactory::CreateSupplicantInterfaceProxy( |
Darin Petkov | d196726 | 2011-07-18 14:55:18 -0700 | [diff] [blame] | 52 | const WiFiRefPtr &wifi, |
| 53 | const DBus::Path &object_path, |
| 54 | const char *dbus_addr) { |
Darin Petkov | aceede3 | 2011-07-18 15:32:38 -0700 | [diff] [blame] | 55 | return new SupplicantInterfaceProxy(wifi, |
| 56 | connection(), |
| 57 | object_path, |
| 58 | dbus_addr); |
| 59 | } |
| 60 | |
| 61 | DHCPProxyInterface *ProxyFactory::CreateDHCPProxy(const char *service) { |
| 62 | return new DHCPCDProxy(connection(), service); |
Darin Petkov | d196726 | 2011-07-18 14:55:18 -0700 | [diff] [blame] | 63 | } |
| 64 | |
Darin Petkov | c90fe52 | 2011-07-15 13:59:47 -0700 | [diff] [blame] | 65 | } // namespace shill |