summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorstevenjb@google.com <stevenjb@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 18:16:25 +0000
committerstevenjb@google.com <stevenjb@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 18:16:25 +0000
commit51f6caaa98a06e5cb5e90aa0e9c1f0164a7ad7c1 (patch)
treeae40172e8a10cb71f6dee2fb5d23d996c8154de7 /chrome/browser
parent026d452a03f70b8b8ba512d8760fa65a150b0202 (diff)
downloadchromium_src-51f6caaa98a06e5cb5e90aa0e9c1f0164a7ad7c1.zip
chromium_src-51f6caaa98a06e5cb5e90aa0e9c1f0164a7ad7c1.tar.gz
chromium_src-51f6caaa98a06e5cb5e90aa0e9c1f0164a7ad7c1.tar.bz2
Chrome changes to move ConenctionType, etc fome chromeos_network to network_library.
See http://codereview.chromium.org/6606024/ BUG=chromium-os:12681 TEST=See issue. Review URL: http://codereview.chromium.org/6602104 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76932 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/chromeos/cros/network_library.cc56
-rw-r--r--chrome/browser/chromeos/cros/network_library.h89
2 files changed, 138 insertions, 7 deletions
diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc
index 3ced3bc..9e6a586 100644
--- a/chrome/browser/chromeos/cros/network_library.cc
+++ b/chrome/browser/chromeos/cros/network_library.cc
@@ -202,6 +202,49 @@ const char* kErrorNeedHomeNetwork = "need-home-network";
const char* kErrorOtaspFailed = "otasp-failed";
const char* kErrorAaaFailed = "aaa-failed";
+const char* kUnknownString = "UNKNOWN";
+
+////////////////////////////////////////////////////////////////////////////
+
+static const char* ConnectionTypeToString(ConnectionType type) {
+ switch (type) {
+ case TYPE_UNKNOWN:
+ break;
+ case TYPE_ETHERNET:
+ return kTypeEthernet;
+ case TYPE_WIFI:
+ return kTypeWifi;
+ case TYPE_WIMAX:
+ return kTypeWimax;
+ case TYPE_BLUETOOTH:
+ return kTypeBluetooth;
+ case TYPE_CELLULAR:
+ return kTypeCellular;
+ }
+ LOG(ERROR) << "ConnectionTypeToString called with unknown type: " << type;
+ return kUnknownString;
+}
+
+// TODO(stevenjb/njw): Deprecate in favor of setting EAP properties.
+static const char* SecurityToString(ConnectionSecurity security) {
+ switch (security) {
+ case SECURITY_UNKNOWN:
+ break;
+ case SECURITY_8021X:
+ return kSecurity8021x;
+ case SECURITY_RSN:
+ return kSecurityRsn;
+ case SECURITY_WPA:
+ return kSecurityWpa;
+ case SECURITY_WEP:
+ return kSecurityWep;
+ case SECURITY_NONE:
+ return kSecurityNone;
+ }
+ LOG(ERROR) << "SecurityToString called with unknown type: " << security;
+ return kUnknownString;
+}
+
////////////////////////////////////////////////////////////////////////////
// Helper class to cache maps of strings to enums.
@@ -1404,7 +1447,7 @@ class NetworkLibraryImpl : public NetworkLibrary {
virtual void RequestWifiScan() {
if (EnsureCrosLoaded() && wifi_enabled()) {
wifi_scanning_ = true; // Cleared when updates are received.
- RequestScan(TYPE_WIFI);
+ RequestNetworkScan(kTypeWifi);
RequestRememberedNetworksUpdate();
}
}
@@ -1412,6 +1455,7 @@ class NetworkLibraryImpl : public NetworkLibrary {
virtual bool GetWifiAccessPoints(WifiAccessPointVector* result) {
if (!EnsureCrosLoaded())
return false;
+ CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DeviceNetworkList* network_list = GetDeviceNetworkList();
if (network_list == NULL)
return false;
@@ -1516,10 +1560,10 @@ class NetworkLibraryImpl : public NetworkLibrary {
bool auto_connect) {
if (!EnsureCrosLoaded())
return true; // No library loaded, don't trigger a retry attempt.
- RequestWifiServicePath(ssid.c_str(),
- security,
- WifiServiceUpdateAndConnect,
- this);
+ RequestHiddenWifiNetwork(ssid.c_str(),
+ SecurityToString(security),
+ WifiServiceUpdateAndConnect,
+ this);
// Store the connection data to be used by the callback.
connect_data_.SetData(ssid, password, identity, certpath, auto_connect);
return true; // No immediate failure mode
@@ -2516,7 +2560,7 @@ class NetworkLibraryImpl : public NetworkLibrary {
return;
}
- EnableNetworkDevice(device, enable);
+ RequestNetworkDeviceEnable(ConnectionTypeToString(device), enable);
}
////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/chromeos/cros/network_library.h b/chrome/browser/chromeos/cros/network_library.h
index 778b41c..548b940 100644
--- a/chrome/browser/chromeos/cros/network_library.h
+++ b/chrome/browser/chromeos/cros/network_library.h
@@ -16,13 +16,100 @@
#include "base/string16.h"
#include "base/timer.h"
#include "third_party/cros/chromeos_network.h"
-#include "third_party/cros/chromeos_network_deprecated.h"
class DictionaryValue;
class Value;
namespace chromeos {
+// Connection enums (see flimflam/include/service.h)
+enum ConnectionType {
+ TYPE_UNKNOWN = 0,
+ TYPE_ETHERNET = 1,
+ TYPE_WIFI = 2,
+ TYPE_WIMAX = 3,
+ TYPE_BLUETOOTH = 4,
+ TYPE_CELLULAR = 5,
+};
+
+enum ConnectionMode {
+ MODE_UNKNOWN = 0,
+ MODE_MANAGED = 1,
+ MODE_ADHOC = 2,
+};
+
+enum ConnectionSecurity {
+ SECURITY_UNKNOWN = 0,
+ SECURITY_NONE = 1,
+ SECURITY_WEP = 2,
+ SECURITY_WPA = 3,
+ SECURITY_RSN = 4,
+ SECURITY_8021X = 5,
+};
+
+enum ConnectionState {
+ STATE_UNKNOWN = 0,
+ STATE_IDLE = 1,
+ STATE_CARRIER = 2,
+ STATE_ASSOCIATION = 3,
+ STATE_CONFIGURATION = 4,
+ STATE_READY = 5,
+ STATE_DISCONNECT = 6,
+ STATE_FAILURE = 7,
+ STATE_ACTIVATION_FAILURE = 8
+};
+
+enum ConnectivityState {
+ CONN_STATE_UNKNOWN = 0,
+ CONN_STATE_UNRESTRICTED = 1,
+ CONN_STATE_RESTRICTED = 2,
+ CONN_STATE_NONE = 3
+};
+
+// Network enums (see flimflam/include/network.h)
+enum NetworkTechnology {
+ NETWORK_TECHNOLOGY_UNKNOWN = 0,
+ NETWORK_TECHNOLOGY_1XRTT = 1,
+ NETWORK_TECHNOLOGY_EVDO = 2,
+ NETWORK_TECHNOLOGY_GPRS = 3,
+ NETWORK_TECHNOLOGY_EDGE = 4,
+ NETWORK_TECHNOLOGY_UMTS = 5,
+ NETWORK_TECHNOLOGY_HSPA = 6,
+ NETWORK_TECHNOLOGY_HSPA_PLUS = 7,
+ NETWORK_TECHNOLOGY_LTE = 8,
+ NETWORK_TECHNOLOGY_LTE_ADVANCED = 9,
+};
+
+enum ActivationState {
+ ACTIVATION_STATE_UNKNOWN = 0,
+ ACTIVATION_STATE_ACTIVATED = 1,
+ ACTIVATION_STATE_ACTIVATING = 2,
+ ACTIVATION_STATE_NOT_ACTIVATED = 3,
+ ACTIVATION_STATE_PARTIALLY_ACTIVATED = 4,
+};
+
+enum NetworkRoamingState {
+ ROAMING_STATE_UNKNOWN = 0,
+ ROAMING_STATE_HOME = 1,
+ ROAMING_STATE_ROAMING = 2,
+};
+
+// connection errors (see flimflam/include/service.h)
+enum ConnectionError {
+ ERROR_UNKNOWN = 0,
+ ERROR_OUT_OF_RANGE = 1,
+ ERROR_PIN_MISSING = 2,
+ ERROR_DHCP_FAILED = 3,
+ ERROR_CONNECT_FAILED = 4,
+ ERROR_BAD_PASSPHRASE = 5,
+ ERROR_BAD_WEPKEY = 6,
+ ERROR_ACTIVATION_FAILED = 7,
+ ERROR_NEED_EVDO = 8,
+ ERROR_NEED_HOME_NETWORK = 9,
+ ERROR_OTASP_FAILED = 10,
+ ERROR_AAA_FAILED = 11,
+};
+
// Cellular network is considered low data when less than 60 minues.
static const int kCellularDataLowSecs = 60 * 60;