| 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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/cros/gvalue_util.h" | 10 #include "chrome/browser/chromeos/cros/gvalue_util.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 bool g_libcros_network_functions_enabled = true; | 244 bool g_libcros_network_functions_enabled = true; |
| 245 | 245 |
| 246 } // namespace | 246 } // namespace |
| 247 | 247 |
| 248 void SetLibcrosNetworkFunctionsEnabled(bool enabled) { | 248 void SetLibcrosNetworkFunctionsEnabled(bool enabled) { |
| 249 g_libcros_network_functions_enabled = enabled; | 249 g_libcros_network_functions_enabled = enabled; |
| 250 } | 250 } |
| 251 | 251 |
| 252 bool CrosActivateCellularModem(const std::string& service_path, | 252 bool CrosActivateCellularModem(const std::string& service_path, |
| 253 const std::string& carrier) { | 253 const std::string& carrier) { |
| 254 return chromeos::ActivateCellularModem(service_path.c_str(), carrier.c_str()); | 254 if (g_libcros_network_functions_enabled) { |
| 255 return chromeos::ActivateCellularModem(service_path.c_str(), |
| 256 carrier.c_str()); |
| 257 } else { |
| 258 return DBusThreadManager::Get()->GetFlimflamServiceClient()-> |
| 259 CallActivateCellularModemAndBlock(dbus::ObjectPath(service_path), |
| 260 carrier); |
| 261 } |
| 255 } | 262 } |
| 256 | 263 |
| 257 void CrosSetNetworkServiceProperty(const std::string& service_path, | 264 void CrosSetNetworkServiceProperty(const std::string& service_path, |
| 258 const std::string& property, | 265 const std::string& property, |
| 259 const base::Value& value) { | 266 const base::Value& value) { |
| 260 if (g_libcros_network_functions_enabled) { | 267 if (g_libcros_network_functions_enabled) { |
| 261 ScopedGValue gvalue(ConvertValueToGValue(value)); | 268 ScopedGValue gvalue(ConvertValueToGValue(value)); |
| 262 chromeos::SetNetworkServicePropertyGValue(service_path.c_str(), | 269 chromeos::SetNetworkServicePropertyGValue(service_path.c_str(), |
| 263 property.c_str(), | 270 property.c_str(), |
| 264 gvalue.get()); | 271 gvalue.get()); |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 ScopedGHashTable ghash( | 733 ScopedGHashTable ghash( |
| 727 ConvertDictionaryValueToStringValueGHashTable(properties)); | 734 ConvertDictionaryValueToStringValueGHashTable(properties)); |
| 728 chromeos::ConfigureService("", ghash.get(), OnConfigureService, NULL); | 735 chromeos::ConfigureService("", ghash.get(), OnConfigureService, NULL); |
| 729 } else { | 736 } else { |
| 730 DBusThreadManager::Get()->GetFlimflamManagerClient()->ConfigureService( | 737 DBusThreadManager::Get()->GetFlimflamManagerClient()->ConfigureService( |
| 731 properties, base::Bind(&DoNothing)); | 738 properties, base::Bind(&DoNothing)); |
| 732 } | 739 } |
| 733 } | 740 } |
| 734 | 741 |
| 735 } // namespace chromeos | 742 } // namespace chromeos |
| OLD | NEW |