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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 bool g_libcros_network_functions_enabled = true; | 232 bool g_libcros_network_functions_enabled = true; |
233 | 233 |
234 } // namespace | 234 } // namespace |
235 | 235 |
236 void SetLibcrosNetworkFunctionsEnabled(bool enabled) { | 236 void SetLibcrosNetworkFunctionsEnabled(bool enabled) { |
237 g_libcros_network_functions_enabled = enabled; | 237 g_libcros_network_functions_enabled = enabled; |
238 } | 238 } |
239 | 239 |
240 bool CrosActivateCellularModem(const std::string& service_path, | 240 bool CrosActivateCellularModem(const std::string& service_path, |
241 const std::string& carrier) { | 241 const std::string& carrier) { |
242 return chromeos::ActivateCellularModem(service_path.c_str(), carrier.c_str()); | 242 if (g_libcros_network_functions_enabled) { |
| 243 return chromeos::ActivateCellularModem(service_path.c_str(), |
| 244 carrier.c_str()); |
| 245 } else { |
| 246 return DBusThreadManager::Get()->GetFlimflamServiceClient()-> |
| 247 CallActivateCellularModemAndBlock(dbus::ObjectPath(service_path), |
| 248 carrier); |
| 249 } |
243 } | 250 } |
244 | 251 |
245 void CrosSetNetworkServiceProperty(const std::string& service_path, | 252 void CrosSetNetworkServiceProperty(const std::string& service_path, |
246 const std::string& property, | 253 const std::string& property, |
247 const base::Value& value) { | 254 const base::Value& value) { |
248 if (g_libcros_network_functions_enabled) { | 255 if (g_libcros_network_functions_enabled) { |
249 ScopedGValue gvalue(ConvertValueToGValue(value)); | 256 ScopedGValue gvalue(ConvertValueToGValue(value)); |
250 chromeos::SetNetworkServicePropertyGValue(service_path.c_str(), | 257 chromeos::SetNetworkServicePropertyGValue(service_path.c_str(), |
251 property.c_str(), | 258 property.c_str(), |
252 gvalue.get()); | 259 gvalue.get()); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 ScopedGHashTable ghash( | 672 ScopedGHashTable ghash( |
666 ConvertDictionaryValueToStringValueGHashTable(properties)); | 673 ConvertDictionaryValueToStringValueGHashTable(properties)); |
667 chromeos::ConfigureService("", ghash.get(), OnConfigureService, NULL); | 674 chromeos::ConfigureService("", ghash.get(), OnConfigureService, NULL); |
668 } else { | 675 } else { |
669 DBusThreadManager::Get()->GetFlimflamManagerClient()->ConfigureService( | 676 DBusThreadManager::Get()->GetFlimflamManagerClient()->ConfigureService( |
670 properties, base::Bind(&DoNothing)); | 677 properties, base::Bind(&DoNothing)); |
671 } | 678 } |
672 } | 679 } |
673 | 680 |
674 } // namespace chromeos | 681 } // namespace chromeos |
OLD | NEW |