| OLD | NEW | 
|     1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |     1 // Copyright (c) 2011 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/network_library.h" |     5 #include "chrome/browser/chromeos/cros/network_library.h" | 
|     6  |     6  | 
|     7 #include <dbus/dbus-glib.h> |     7 #include <dbus/dbus-glib.h> | 
|     8 #include <dbus/dbus-gtype-specialized.h> |     8 #include <dbus/dbus-gtype-specialized.h> | 
|     9 #include <glib-object.h> |     9 #include <glib-object.h> | 
|    10  |    10  | 
|    11 #include <algorithm> |    11 #include <algorithm> | 
|    12 #include <list> |    12 #include <list> | 
|    13 #include <map> |    13 #include <map> | 
|    14 #include <set> |    14 #include <set> | 
|    15 #include <utility> |    15 #include <utility> | 
|    16  |    16  | 
|    17 #include "base/bind.h" |    17 #include "base/bind.h" | 
|    18 #include "base/i18n/icu_encoding_detection.h" |    18 #include "base/i18n/icu_encoding_detection.h" | 
|    19 #include "base/i18n/icu_string_conversions.h" |    19 #include "base/i18n/icu_string_conversions.h" | 
|    20 #include "base/i18n/time_formatting.h" |    20 #include "base/i18n/time_formatting.h" | 
 |    21 #include "base/json/json_writer.h"  // for debug output only. | 
|    21 #include "base/metrics/histogram.h" |    22 #include "base/metrics/histogram.h" | 
|    22 #include "base/stl_util.h" |    23 #include "base/stl_util.h" | 
|    23 #include "base/string_number_conversions.h" |    24 #include "base/string_number_conversions.h" | 
|    24 #include "base/string_tokenizer.h" |    25 #include "base/string_tokenizer.h" | 
|    25 #include "base/string_util.h" |    26 #include "base/string_util.h" | 
|    26 #include "base/stringprintf.h" |    27 #include "base/stringprintf.h" | 
|    27 #include "base/utf_string_conversion_utils.h" |    28 #include "base/utf_string_conversion_utils.h" | 
|    28 #include "base/utf_string_conversions.h" |    29 #include "base/utf_string_conversions.h" | 
|    29 #include "base/values.h" |    30 #include "base/values.h" | 
|    30 #include "chrome/browser/chromeos/cros_settings.h" |    31 #include "chrome/browser/chromeos/cros_settings.h" | 
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   308     case Value::TYPE_BINARY: |   309     case Value::TYPE_BINARY: | 
|   309     case Value::TYPE_LIST: |   310     case Value::TYPE_LIST: | 
|   310       // Other Value types shouldn't be passed through this mechanism. |   311       // Other Value types shouldn't be passed through this mechanism. | 
|   311       NOTREACHED() << "Unconverted Value of type: " << value->GetType(); |   312       NOTREACHED() << "Unconverted Value of type: " << value->GetType(); | 
|   312       return new GValue(); |   313       return new GValue(); | 
|   313   } |   314   } | 
|   314   NOTREACHED() << "Value conversion failed, type: " << value->GetType(); |   315   NOTREACHED() << "Value conversion failed, type: " << value->GetType(); | 
|   315   return new GValue(); |   316   return new GValue(); | 
|   316 } |   317 } | 
|   317  |   318  | 
 |   319 GHashTable* ConvertDictionaryValueToGValueMap(const DictionaryValue* dict) { | 
 |   320   GHashTable* ghash = | 
 |   321       g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | 
 |   322   for (DictionaryValue::key_iterator it = dict->begin_keys(); | 
 |   323        it != dict->end_keys(); ++it) { | 
 |   324     std::string key = *it; | 
 |   325     Value* val = NULL; | 
 |   326     if (dict->Get(key, &val)) { | 
 |   327       g_hash_table_insert(ghash, | 
 |   328                           g_strdup(const_cast<char*>(key.c_str())), | 
 |   329                           ConvertValueToGValue(val)); | 
 |   330     } | 
 |   331   } | 
 |   332   return ghash; | 
 |   333 } | 
 |   334  | 
|   318 }  // namespace |   335 }  // namespace | 
|   319  |   336  | 
|   320 //////////////////////////////////////////////////////////////////////////////// |   337 //////////////////////////////////////////////////////////////////////////////// | 
|   321 // FoundCellularNetwork |   338 // FoundCellularNetwork | 
|   322  |   339  | 
|   323 FoundCellularNetwork::FoundCellularNetwork() {} |   340 FoundCellularNetwork::FoundCellularNetwork() {} | 
|   324  |   341  | 
|   325 FoundCellularNetwork::~FoundCellularNetwork() {} |   342 FoundCellularNetwork::~FoundCellularNetwork() {} | 
|   326  |   343  | 
|   327 //////////////////////////////////////////////////////////////////////////////// |   344 //////////////////////////////////////////////////////////////////////////////// | 
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   373       auto_connect_(false), |   390       auto_connect_(false), | 
|   374       save_credentials_(false), |   391       save_credentials_(false), | 
|   375       priority_order_(0), |   392       priority_order_(0), | 
|   376       added_(false), |   393       added_(false), | 
|   377       notify_failure_(false), |   394       notify_failure_(false), | 
|   378       profile_type_(PROFILE_NONE), |   395       profile_type_(PROFILE_NONE), | 
|   379       service_path_(service_path), |   396       service_path_(service_path), | 
|   380       type_(type) { |   397       type_(type) { | 
|   381 } |   398 } | 
|   382  |   399  | 
|   383 Network::~Network() {} |   400 Network::~Network() { | 
 |   401   for (PropertyMap::const_iterator props = property_map_.begin(); | 
 |   402        props != property_map_.end(); ++props) { | 
 |   403      delete props->second; | 
 |   404   } | 
 |   405 } | 
|   384  |   406  | 
|   385 void Network::SetNetworkParser(NetworkParser* parser) { |   407 void Network::SetNetworkParser(NetworkParser* parser) { | 
|   386   network_parser_.reset(parser); |   408   network_parser_.reset(parser); | 
|   387 } |   409 } | 
|   388  |   410  | 
 |   411 void Network::UpdatePropertyMap(PropertyIndex index, const base::Value& value) { | 
 |   412   // Add the property to property_map_.  Delete previous value if necessary. | 
 |   413   Value*& entry = property_map_[index]; | 
 |   414   delete entry; | 
 |   415   entry = value.DeepCopy(); | 
 |   416   if (VLOG_IS_ON(2)) { | 
 |   417     std::string value_json; | 
 |   418     base::JSONWriter::Write(&value, true, &value_json); | 
 |   419     VLOG(2) << "Updated property map on network: " | 
 |   420             << unique_id() << "[" << index << "] = " << value_json; | 
 |   421   } | 
 |   422 } | 
 |   423  | 
|   389 void Network::SetState(ConnectionState new_state) { |   424 void Network::SetState(ConnectionState new_state) { | 
|   390   if (new_state == state_) |   425   if (new_state == state_) | 
|   391     return; |   426     return; | 
|   392   ConnectionState old_state = state_; |   427   ConnectionState old_state = state_; | 
|   393   state_ = new_state; |   428   state_ = new_state; | 
|   394   if (!IsConnectingState(new_state)) |   429   if (!IsConnectingState(new_state)) | 
|   395     set_connection_started(false); |   430     set_connection_started(false); | 
|   396   if (new_state == STATE_FAILURE) { |   431   if (new_state == STATE_FAILURE) { | 
|   397     if (old_state != STATE_UNKNOWN && |   432     if (old_state != STATE_UNKNOWN && | 
|   398         old_state != STATE_IDLE) { |   433         old_state != STATE_IDLE) { | 
| (...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1456   // Called from ConnectToWifiNetwork. |  1491   // Called from ConnectToWifiNetwork. | 
|  1457   // Calls ConnectToWifiNetworkUsingConnectData if network request succeeds. |  1492   // Calls ConnectToWifiNetworkUsingConnectData if network request succeeds. | 
|  1458   virtual void CallRequestWifiNetworkAndConnect( |  1493   virtual void CallRequestWifiNetworkAndConnect( | 
|  1459       const std::string& ssid, ConnectionSecurity security) = 0; |  1494       const std::string& ssid, ConnectionSecurity security) = 0; | 
|  1460   // Called from ConnectToVirtualNetwork*. |  1495   // Called from ConnectToVirtualNetwork*. | 
|  1461   // Calls ConnectToVirtualNetworkUsingConnectData if network request succeeds. |  1496   // Calls ConnectToVirtualNetworkUsingConnectData if network request succeeds. | 
|  1462   virtual void CallRequestVirtualNetworkAndConnect( |  1497   virtual void CallRequestVirtualNetworkAndConnect( | 
|  1463       const std::string& service_name, |  1498       const std::string& service_name, | 
|  1464       const std::string& server_hostname, |  1499       const std::string& server_hostname, | 
|  1465       ProviderType provider_type) = 0; |  1500       ProviderType provider_type) = 0; | 
 |  1501   // Call to configure a wifi service. The identifier is either a service_path | 
 |  1502   // or a GUID. |info| is a dictionary of property values. | 
 |  1503   virtual void CallConfigureService(const std::string& identifier, | 
 |  1504                                     const DictionaryValue* info) = 0; | 
|  1466   // Called from NetworkConnectStart. |  1505   // Called from NetworkConnectStart. | 
|  1467   // Calls NetworkConnectCompleted when the connection attept completes. |  1506   // Calls NetworkConnectCompleted when the connection attept completes. | 
|  1468   virtual void CallConnectToNetwork(Network* network) = 0; |  1507   virtual void CallConnectToNetwork(Network* network) = 0; | 
|  1469   // Called from DeleteRememberedNetwork. |  1508   // Called from DeleteRememberedNetwork. | 
|  1470   virtual void CallDeleteRememberedNetwork( |  1509   virtual void CallDeleteRememberedNetwork( | 
|  1471       const std::string& profile_path, const std::string& service_path) = 0; |  1510       const std::string& profile_path, const std::string& service_path) = 0; | 
|  1472  |  1511  | 
|  1473   // Called from Enable*NetworkDevice. |  1512   // Called from Enable*NetworkDevice. | 
|  1474   // Asynchronously enables or disables the specified device type. |  1513   // Asynchronously enables or disables the specified device type. | 
|  1475   virtual void CallEnableNetworkDeviceType( |  1514   virtual void CallEnableNetworkDeviceType( | 
| (...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2784   for (int i = 0; i < parser.GetCertificatesSize(); i++) { |  2823   for (int i = 0; i < parser.GetCertificatesSize(); i++) { | 
|  2785     // Insert each of the available certs into the certificate DB. |  2824     // Insert each of the available certs into the certificate DB. | 
|  2786     if (!parser.ParseCertificate(i)) { |  2825     if (!parser.ParseCertificate(i)) { | 
|  2787       DLOG(WARNING) << "Cannot parse certificate in ONC file"; |  2826       DLOG(WARNING) << "Cannot parse certificate in ONC file"; | 
|  2788       return false; |  2827       return false; | 
|  2789     } |  2828     } | 
|  2790   } |  2829   } | 
|  2791  |  2830  | 
|  2792   for (int i = 0; i < parser.GetNetworkConfigsSize(); i++) { |  2831   for (int i = 0; i < parser.GetNetworkConfigsSize(); i++) { | 
|  2793     // Parse Open Network Configuration blob into a temporary Network object. |  2832     // Parse Open Network Configuration blob into a temporary Network object. | 
|  2794     Network* network = parser.ParseNetwork(i); |  2833     scoped_ptr<Network> network(parser.ParseNetwork(i)); | 
|  2795     if (!network) { |  2834     if (!network.get()) { | 
|  2796       DLOG(WARNING) << "Cannot parse networks in ONC file"; |  2835       DLOG(WARNING) << "Cannot parse networks in ONC file"; | 
|  2797       return false; |  2836       return false; | 
|  2798     } |  2837     } | 
|  2799  |  2838  | 
|  2800     // TODO(chocobo): Pass parsed network values to flimflam update network. |  2839     DictionaryValue dict; | 
 |  2840     for (Network::PropertyMap::const_iterator props = | 
 |  2841              network->property_map_.begin(); | 
 |  2842          props != network->property_map_.end(); ++props) { | 
 |  2843       std::string key = | 
 |  2844           NativeNetworkParser::property_mapper()->GetKey(props->first); | 
 |  2845       if (!key.empty()) | 
 |  2846         dict.SetWithoutPathExpansion(key, props->second->DeepCopy()); | 
 |  2847     } | 
 |  2848  | 
 |  2849     CallConfigureService(network->unique_id(), &dict); | 
|  2801   } |  2850   } | 
|  2802   return parser.GetNetworkConfigsSize() != 0; |  2851   return parser.GetNetworkConfigsSize() != 0; | 
|  2803 } |  2852 } | 
|  2804  |  2853  | 
|  2805 //////////////////////////////////////////////////////////////////////////// |  2854 //////////////////////////////////////////////////////////////////////////// | 
|  2806 // Testing functions. |  2855 // Testing functions. | 
|  2807  |  2856  | 
|  2808 bool NetworkLibraryImplBase::SetActiveNetwork( |  2857 bool NetworkLibraryImplBase::SetActiveNetwork( | 
|  2809     ConnectionType type, const std::string& service_path) { |  2858     ConnectionType type, const std::string& service_path) { | 
|  2810   Network* network = NULL; |  2859   Network* network = NULL; | 
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3289   ////////////////////////////////////////////////////////////////////////////// |  3338   ////////////////////////////////////////////////////////////////////////////// | 
|  3290   // NetworkLibraryImplBase implementation. |  3339   // NetworkLibraryImplBase implementation. | 
|  3291  |  3340  | 
|  3292   virtual void MonitorNetworkStart(const std::string& service_path) OVERRIDE; |  3341   virtual void MonitorNetworkStart(const std::string& service_path) OVERRIDE; | 
|  3293   virtual void MonitorNetworkStop(const std::string& service_path) OVERRIDE; |  3342   virtual void MonitorNetworkStop(const std::string& service_path) OVERRIDE; | 
|  3294   virtual void MonitorNetworkDeviceStart( |  3343   virtual void MonitorNetworkDeviceStart( | 
|  3295       const std::string& device_path) OVERRIDE; |  3344       const std::string& device_path) OVERRIDE; | 
|  3296   virtual void MonitorNetworkDeviceStop( |  3345   virtual void MonitorNetworkDeviceStop( | 
|  3297       const std::string& device_path) OVERRIDE; |  3346       const std::string& device_path) OVERRIDE; | 
|  3298  |  3347  | 
 |  3348   virtual void CallConfigureService(const std::string& identifier, | 
 |  3349                                     const DictionaryValue* info) OVERRIDE; | 
|  3299   virtual void CallConnectToNetwork(Network* network) OVERRIDE; |  3350   virtual void CallConnectToNetwork(Network* network) OVERRIDE; | 
|  3300   virtual void CallRequestWifiNetworkAndConnect( |  3351   virtual void CallRequestWifiNetworkAndConnect( | 
|  3301       const std::string& ssid, ConnectionSecurity security) OVERRIDE; |  3352       const std::string& ssid, ConnectionSecurity security) OVERRIDE; | 
|  3302   virtual void CallRequestVirtualNetworkAndConnect( |  3353   virtual void CallRequestVirtualNetworkAndConnect( | 
|  3303       const std::string& service_name, |  3354       const std::string& service_name, | 
|  3304       const std::string& server_hostname, |  3355       const std::string& server_hostname, | 
|  3305       ProviderType provider_type) OVERRIDE; |  3356       ProviderType provider_type) OVERRIDE; | 
|  3306   virtual void CallDeleteRememberedNetwork( |  3357   virtual void CallDeleteRememberedNetwork( | 
|  3307       const std::string& profile_path, |  3358       const std::string& profile_path, | 
|  3308       const std::string& service_path) OVERRIDE; |  3359       const std::string& service_path) OVERRIDE; | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3352   static void PinOperationCallback(void* object, |  3403   static void PinOperationCallback(void* object, | 
|  3353                                    const char* path, |  3404                                    const char* path, | 
|  3354                                    NetworkMethodErrorType error, |  3405                                    NetworkMethodErrorType error, | 
|  3355                                    const char* error_message); |  3406                                    const char* error_message); | 
|  3356  |  3407  | 
|  3357   static void CellularRegisterCallback(void* object, |  3408   static void CellularRegisterCallback(void* object, | 
|  3358                                        const char* path, |  3409                                        const char* path, | 
|  3359                                        NetworkMethodErrorType error, |  3410                                        NetworkMethodErrorType error, | 
|  3360                                        const char* error_message); |  3411                                        const char* error_message); | 
|  3361  |  3412  | 
 |  3413   static void ConfigureServiceCallback(void* object, | 
 |  3414                                        const char* service_path, | 
 |  3415                                        NetworkMethodErrorType error, | 
 |  3416                                        const char* error_message); | 
 |  3417  | 
|  3362   static void NetworkConnectCallback(void* object, |  3418   static void NetworkConnectCallback(void* object, | 
|  3363                                      const char* service_path, |  3419                                      const char* service_path, | 
|  3364                                      NetworkMethodErrorType error, |  3420                                      NetworkMethodErrorType error, | 
|  3365                                      const char* error_message); |  3421                                      const char* error_message); | 
|  3366  |  3422  | 
|  3367   static void WifiServiceUpdateAndConnect( |  3423   static void WifiServiceUpdateAndConnect( | 
|  3368       void* object, const char* service_path, GHashTable* ghash); |  3424       void* object, const char* service_path, GHashTable* ghash); | 
|  3369   static void VPNServiceUpdateAndConnect( |  3425   static void VPNServiceUpdateAndConnect( | 
|  3370       void* object, const char* service_path, GHashTable* ghash); |  3426       void* object, const char* service_path, GHashTable* ghash); | 
|  3371  |  3427  | 
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  3610       chromeos::RequestNetworkDeviceProperties(path.c_str(), |  3666       chromeos::RequestNetworkDeviceProperties(path.c_str(), | 
|  3611                                                &NetworkDeviceUpdate, |  3667                                                &NetworkDeviceUpdate, | 
|  3612                                                this); |  3668                                                this); | 
|  3613   } |  3669   } | 
|  3614 } |  3670 } | 
|  3615  |  3671  | 
|  3616 ///////////////////////////////////////////////////////////////////////////// |  3672 ///////////////////////////////////////////////////////////////////////////// | 
|  3617 // NetworkLibraryImplBase connect implementation. |  3673 // NetworkLibraryImplBase connect implementation. | 
|  3618  |  3674  | 
|  3619 // static callback |  3675 // static callback | 
 |  3676 void NetworkLibraryImplCros::ConfigureServiceCallback( | 
 |  3677     void* object, | 
 |  3678     const char* service_path, | 
 |  3679     NetworkMethodErrorType error, | 
 |  3680     const char* error_message) { | 
 |  3681   if (error != NETWORK_METHOD_ERROR_NONE) { | 
 |  3682     LOG(WARNING) << "Error from ConfigureService callback for: " | 
 |  3683                  << service_path | 
 |  3684                  << " Error: " << error << " Message: " << error_message; | 
 |  3685   } | 
 |  3686 } | 
 |  3687  | 
 |  3688 void NetworkLibraryImplCros::CallConfigureService(const std::string& identifier, | 
 |  3689                                                   const DictionaryValue* info) { | 
 |  3690   GHashTable* ghash = ConvertDictionaryValueToGValueMap(info); | 
 |  3691   chromeos::ConfigureService(identifier.c_str(), ghash, | 
 |  3692                              ConfigureServiceCallback, this); | 
 |  3693 } | 
 |  3694  | 
 |  3695 // static callback | 
|  3620 void NetworkLibraryImplCros::NetworkConnectCallback( |  3696 void NetworkLibraryImplCros::NetworkConnectCallback( | 
|  3621     void* object, |  3697     void* object, | 
|  3622     const char* service_path, |  3698     const char* service_path, | 
|  3623     NetworkMethodErrorType error, |  3699     NetworkMethodErrorType error, | 
|  3624     const char* error_message) { |  3700     const char* error_message) { | 
|  3625   DCHECK(CrosLibrary::Get()->libcros_loaded()); |  3701   DCHECK(CrosLibrary::Get()->libcros_loaded()); | 
|  3626   NetworkConnectStatus status; |  3702   NetworkConnectStatus status; | 
|  3627   if (error == NETWORK_METHOD_ERROR_NONE) { |  3703   if (error == NETWORK_METHOD_ERROR_NONE) { | 
|  3628     status = CONNECT_SUCCESS; |  3704     status = CONNECT_SUCCESS; | 
|  3629   } else { |  3705   } else { | 
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4696  |  4772  | 
|  4697   // NetworkLibraryImplBase implementation. |  4773   // NetworkLibraryImplBase implementation. | 
|  4698  |  4774  | 
|  4699   virtual void MonitorNetworkStart(const std::string& service_path) OVERRIDE {} |  4775   virtual void MonitorNetworkStart(const std::string& service_path) OVERRIDE {} | 
|  4700   virtual void MonitorNetworkStop(const std::string& service_path) OVERRIDE {} |  4776   virtual void MonitorNetworkStop(const std::string& service_path) OVERRIDE {} | 
|  4701   virtual void MonitorNetworkDeviceStart( |  4777   virtual void MonitorNetworkDeviceStart( | 
|  4702       const std::string& device_path) OVERRIDE {} |  4778       const std::string& device_path) OVERRIDE {} | 
|  4703   virtual void MonitorNetworkDeviceStop( |  4779   virtual void MonitorNetworkDeviceStop( | 
|  4704       const std::string& device_path) OVERRIDE {} |  4780       const std::string& device_path) OVERRIDE {} | 
|  4705  |  4781  | 
 |  4782   virtual void CallConfigureService(const std::string& identifier, | 
 |  4783                                     const DictionaryValue* info) OVERRIDE {} | 
|  4706   virtual void CallConnectToNetwork(Network* network) OVERRIDE; |  4784   virtual void CallConnectToNetwork(Network* network) OVERRIDE; | 
|  4707   virtual void CallRequestWifiNetworkAndConnect( |  4785   virtual void CallRequestWifiNetworkAndConnect( | 
|  4708       const std::string& ssid, ConnectionSecurity security) OVERRIDE; |  4786       const std::string& ssid, ConnectionSecurity security) OVERRIDE; | 
|  4709   virtual void CallRequestVirtualNetworkAndConnect( |  4787   virtual void CallRequestVirtualNetworkAndConnect( | 
|  4710       const std::string& service_name, |  4788       const std::string& service_name, | 
|  4711       const std::string& server_hostname, |  4789       const std::string& server_hostname, | 
|  4712       ProviderType provider_type) OVERRIDE; |  4790       ProviderType provider_type) OVERRIDE; | 
|  4713  |  4791  | 
|  4714   virtual void CallDeleteRememberedNetwork( |  4792   virtual void CallDeleteRememberedNetwork( | 
|  4715       const std::string& profile_path, |  4793       const std::string& profile_path, | 
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4912   vpn3->set_provider_type(PROVIDER_TYPE_OPEN_VPN); |  4990   vpn3->set_provider_type(PROVIDER_TYPE_OPEN_VPN); | 
|  4913   AddStubNetwork(vpn3, PROFILE_USER); |  4991   AddStubNetwork(vpn3, PROFILE_USER); | 
|  4914  |  4992  | 
|  4915   wifi_scanning_ = false; |  4993   wifi_scanning_ = false; | 
|  4916   offline_mode_ = false; |  4994   offline_mode_ = false; | 
|  4917  |  4995  | 
|  4918   // Ensure our active network is connected and vice versa, otherwise our |  4996   // Ensure our active network is connected and vice versa, otherwise our | 
|  4919   // autotest browser_tests sometimes conclude the device is offline. |  4997   // autotest browser_tests sometimes conclude the device is offline. | 
|  4920   CHECK(active_network()->connected()); |  4998   CHECK(active_network()->connected()); | 
|  4921   CHECK(connected_network()->is_active()); |  4999   CHECK(connected_network()->is_active()); | 
 |  5000  | 
 |  5001   std::string test_blob( | 
 |  5002         "{" | 
 |  5003         "  \"NetworkConfigurations\": [" | 
 |  5004         "    {" | 
 |  5005         "      \"GUID\": \"guid\"," | 
 |  5006         "      \"Type\": \"WiFi\"," | 
 |  5007         "      \"WiFi\": {" | 
 |  5008         "        \"Security\": \"WEP\"," | 
 |  5009         "        \"SSID\": \"MySSID\"," | 
 |  5010         "      }" | 
 |  5011         "    }" | 
 |  5012         "  ]," | 
 |  5013         "  \"Certificates\": []" | 
 |  5014         "}"); | 
 |  5015   LoadOncNetworks(test_blob); | 
|  4922 } |  5016 } | 
|  4923  |  5017  | 
|  4924 //////////////////////////////////////////////////////////////////////////// |  5018 //////////////////////////////////////////////////////////////////////////// | 
|  4925 // NetworkLibraryImplStub private methods. |  5019 // NetworkLibraryImplStub private methods. | 
|  4926  |  5020  | 
|  4927 void NetworkLibraryImplStub::AddStubNetwork( |  5021 void NetworkLibraryImplStub::AddStubNetwork( | 
|  4928     Network* network, NetworkProfileType profile_type) { |  5022     Network* network, NetworkProfileType profile_type) { | 
|  4929   network->priority_order_ = network_priority_order_++; |  5023   network->priority_order_ = network_priority_order_++; | 
|  4930   network->CalculateUniqueId(); |  5024   network->CalculateUniqueId(); | 
|  4931   if (!network->unique_id().empty()) |  5025   if (!network->unique_id().empty()) | 
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  5159   return impl; |  5253   return impl; | 
|  5160 } |  5254 } | 
|  5161  |  5255  | 
|  5162 ///////////////////////////////////////////////////////////////////////////// |  5256 ///////////////////////////////////////////////////////////////////////////// | 
|  5163  |  5257  | 
|  5164 }  // namespace chromeos |  5258 }  // namespace chromeos | 
|  5165  |  5259  | 
|  5166 // Allows InvokeLater without adding refcounting. This class is a Singleton and |  5260 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 
|  5167 // won't be deleted until its last InvokeLater is run. |  5261 // won't be deleted until its last InvokeLater is run. | 
|  5168 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); |  5262 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); | 
| OLD | NEW |