| OLD | NEW | 
|    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |    1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #include "chrome/browser/chromeos/cros/cros_network_functions.h" |    5 #include "chrome/browser/chromeos/cros/cros_network_functions.h" | 
|    6  |    6  | 
|    7 #include "base/bind.h" |    7 #include "base/bind.h" | 
|    8 #include "base/bind_helpers.h" |    8 #include "base/bind_helpers.h" | 
|    9 #include "base/memory/scoped_ptr.h" |    9 #include "base/memory/scoped_ptr.h" | 
|   10 #include "base/string_tokenizer.h" |   10 #include "base/string_tokenizer.h" | 
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  685     if (ipconfig_paths) |  685     if (ipconfig_paths) | 
|  686       ipconfig_paths->push_back(ipconfig_path); |  686       ipconfig_paths->push_back(ipconfig_path); | 
|  687   } |  687   } | 
|  688   // Store the hardware address as well. |  688   // Store the hardware address as well. | 
|  689   if (hardware_address) |  689   if (hardware_address) | 
|  690     properties->GetStringWithoutPathExpansion(flimflam::kAddressProperty, |  690     properties->GetStringWithoutPathExpansion(flimflam::kAddressProperty, | 
|  691                                               hardware_address); |  691                                               hardware_address); | 
|  692   return true; |  692   return true; | 
|  693 } |  693 } | 
|  694  |  694  | 
|  695 bool CrosAddIPConfig(const std::string& device_path, IPConfigType type) { |  | 
|  696   std::string type_str; |  | 
|  697   switch (type) { |  | 
|  698     case IPCONFIG_TYPE_IPV4: |  | 
|  699       type_str = flimflam::kTypeIPv4; |  | 
|  700       break; |  | 
|  701     case IPCONFIG_TYPE_IPV6: |  | 
|  702       type_str = flimflam::kTypeIPv6; |  | 
|  703       break; |  | 
|  704     case IPCONFIG_TYPE_DHCP: |  | 
|  705       type_str = flimflam::kTypeDHCP; |  | 
|  706       break; |  | 
|  707     case IPCONFIG_TYPE_BOOTP: |  | 
|  708       type_str = flimflam::kTypeBOOTP; |  | 
|  709       break; |  | 
|  710     case IPCONFIG_TYPE_ZEROCONF: |  | 
|  711       type_str = flimflam::kTypeZeroConf; |  | 
|  712       break; |  | 
|  713     case IPCONFIG_TYPE_DHCP6: |  | 
|  714       type_str = flimflam::kTypeDHCP6; |  | 
|  715       break; |  | 
|  716     case IPCONFIG_TYPE_PPP: |  | 
|  717       type_str = flimflam::kTypePPP; |  | 
|  718       break; |  | 
|  719     default: |  | 
|  720       return false; |  | 
|  721   }; |  | 
|  722   const dbus::ObjectPath result = |  | 
|  723       DBusThreadManager::Get()->GetShillDeviceClient()-> |  | 
|  724       CallAddIPConfigAndBlock(dbus::ObjectPath(device_path), type_str); |  | 
|  725   if (result.value().empty()) { |  | 
|  726     LOG(ERROR) << "Add IPConfig failed for device path " << device_path |  | 
|  727                << " and type " << type_str; |  | 
|  728     return false; |  | 
|  729   } |  | 
|  730   return true; |  | 
|  731 } |  | 
|  732  |  | 
|  733 bool CrosRemoveIPConfig(const std::string& ipconfig_path) { |  | 
|  734   return DBusThreadManager::Get()->GetShillIPConfigClient()-> |  | 
|  735       CallRemoveAndBlock(dbus::ObjectPath(ipconfig_path)); |  | 
|  736 } |  | 
|  737  |  | 
|  738 void CrosRequestIPConfigRefresh(const std::string& ipconfig_path) { |  695 void CrosRequestIPConfigRefresh(const std::string& ipconfig_path) { | 
|  739   DBusThreadManager::Get()->GetShillIPConfigClient()->Refresh( |  696   DBusThreadManager::Get()->GetShillIPConfigClient()->Refresh( | 
|  740       dbus::ObjectPath(ipconfig_path), |  697       dbus::ObjectPath(ipconfig_path), | 
|  741       base::Bind(&DoNothingWithCallStatus)); |  698       base::Bind(&DoNothingWithCallStatus)); | 
|  742 } |  699 } | 
|  743  |  700  | 
|  744 bool CrosGetWifiAccessPoints(WifiAccessPointVector* result) { |  701 bool CrosGetWifiAccessPoints(WifiAccessPointVector* result) { | 
|  745   scoped_ptr<base::DictionaryValue> manager_properties( |  702   scoped_ptr<base::DictionaryValue> manager_properties( | 
|  746       DBusThreadManager::Get()->GetShillManagerClient()-> |  703       DBusThreadManager::Get()->GetShillManagerClient()-> | 
|  747       CallGetPropertiesAndBlock()); |  704       CallGetPropertiesAndBlock()); | 
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  904                     const std::string& carrier, |  861                     const std::string& carrier, | 
|  905                     const NetworkOperationCallback& callback) { |  862                     const NetworkOperationCallback& callback) { | 
|  906   DBusThreadManager::Get()->GetShillDeviceClient()->SetCarrier( |  863   DBusThreadManager::Get()->GetShillDeviceClient()->SetCarrier( | 
|  907       dbus::ObjectPath(device_path), carrier, |  864       dbus::ObjectPath(device_path), carrier, | 
|  908       base::Bind(callback, device_path, NETWORK_METHOD_ERROR_NONE, |  865       base::Bind(callback, device_path, NETWORK_METHOD_ERROR_NONE, | 
|  909                  std::string()), |  866                  std::string()), | 
|  910       base::Bind(&OnNetworkActionError, callback, device_path)); |  867       base::Bind(&OnNetworkActionError, callback, device_path)); | 
|  911 } |  868 } | 
|  912  |  869  | 
|  913 }  // namespace chromeos |  870 }  // namespace chromeos | 
| OLD | NEW |