summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorchocobo@chromium.org <chocobo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-06 18:59:25 +0000
committerchocobo@chromium.org <chocobo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-06 18:59:25 +0000
commit00e1756a97e0502fe0b1f6f726eb3e92888238bc (patch)
tree24f0d2ef392cca5af0bf1df9a86eb3461113e17b /chrome/browser
parent7cac486bd5e92cf8b9c949b659fd2f633f9482d7 (diff)
downloadchromium_src-00e1756a97e0502fe0b1f6f726eb3e92888238bc.zip
chromium_src-00e1756a97e0502fe0b1f6f726eb3e92888238bc.tar.gz
chromium_src-00e1756a97e0502fe0b1f6f726eb3e92888238bc.tar.bz2
Refactor WifiNetwork, CellularNetwork, and EthernetNetwork into classes to make the code cleaner.
BUG=none TEST=ran browser tests and also manually made sure everything still works. Review URL: http://codereview.chromium.org/2010001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46598 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/chromeos/cros/mock_network_library.h8
-rw-r--r--chrome/browser/chromeos/cros/network_library.cc183
-rw-r--r--chrome/browser/chromeos/cros/network_library.h242
-rw-r--r--chrome/browser/chromeos/login/network_screen.cc2
-rw-r--r--chrome/browser/chromeos/login/network_screen_browsertest.cc42
-rw-r--r--chrome/browser/chromeos/network_list.cc12
-rw-r--r--chrome/browser/chromeos/options/internet_page_view.cc36
-rw-r--r--chrome/browser/chromeos/options/network_config_view.cc12
-rw-r--r--chrome/browser/chromeos/options/wifi_config_view.cc24
-rw-r--r--chrome/browser/chromeos/options/wifi_config_view_browsertest.cc2
-rw-r--r--chrome/browser/chromeos/status/network_menu_button.cc20
11 files changed, 300 insertions, 283 deletions
diff --git a/chrome/browser/chromeos/cros/mock_network_library.h b/chrome/browser/chromeos/cros/mock_network_library.h
index 0b4470a..75fe865 100644
--- a/chrome/browser/chromeos/cros/mock_network_library.h
+++ b/chrome/browser/chromeos/cros/mock_network_library.h
@@ -21,7 +21,7 @@ class MockNetworkLibrary : public NetworkLibrary {
MOCK_CONST_METHOD0(ethernet_network, const EthernetNetwork&(void));
MOCK_CONST_METHOD0(ethernet_connecting, bool(void));
MOCK_CONST_METHOD0(ethernet_connected, bool(void));
- MOCK_CONST_METHOD0(wifi_ssid, const std::string&(void));
+ MOCK_CONST_METHOD0(wifi_name, const std::string&(void));
MOCK_CONST_METHOD0(wifi_connecting, bool(void));
MOCK_CONST_METHOD0(wifi_connected, bool(void));
MOCK_CONST_METHOD0(wifi_strength, int(void));
@@ -48,11 +48,9 @@ class MockNetworkLibrary : public NetworkLibrary {
const string16&, const string16&,
bool));
MOCK_METHOD1(ConnectToCellularNetwork, void(CellularNetwork));
- MOCK_METHOD1(DisconnectFromWifiNetwork, void(const WifiNetwork&));
- MOCK_METHOD1(DisconnectFromCellularNetwork, void(const CellularNetwork&));
+ MOCK_METHOD1(DisconnectFromWirelessNetwork, void(const WirelessNetwork&));
MOCK_METHOD1(SaveWifiNetwork, void(const WifiNetwork&));
- MOCK_METHOD1(ForgetWifiNetwork, void(const WifiNetwork&));
- MOCK_METHOD1(ForgetCellularNetwork, void(const CellularNetwork&));
+ MOCK_METHOD1(ForgetWirelessNetwork, void(const WirelessNetwork&));
MOCK_CONST_METHOD0(ethernet_available, bool(void));
MOCK_CONST_METHOD0(wifi_available, bool(void));
diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc
index 4b51c5b..946f959 100644
--- a/chrome/browser/chromeos/cros/network_library.cc
+++ b/chrome/browser/chromeos/cros/network_library.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,6 +22,71 @@ struct RunnableMethodTraits<chromeos::NetworkLibraryImpl> {
namespace chromeos {
////////////////////////////////////////////////////////////////////////////////
+// Network
+
+void Network::Clear() {
+ connecting_ = false;
+ connected_ = false;
+ service_path_.clear();
+ device_path_.clear();
+ ip_address_.clear();
+}
+
+void Network::ConfigureFromService(const ServiceInfo& service) {
+ connecting_ = service.state == STATE_ASSOCIATION ||
+ service.state == STATE_CONFIGURATION ||
+ service.state == STATE_CARRIER;
+ connected_ = service.state == STATE_READY;
+ service_path_ = service.service_path;
+ device_path_ = service.device_path ? service.device_path : std::string();
+ ip_address_.clear();
+ // If connected, get ip config.
+ if (connected_ && service.device_path) {
+ IPConfigStatus* ipconfig_status = ListIPConfigs(service.device_path);
+ if (ipconfig_status) {
+ for (int i = 0; i < ipconfig_status->size; i++) {
+ IPConfig ipconfig = ipconfig_status->ips[i];
+ if (strlen(ipconfig.address) > 0)
+ ip_address_ = ipconfig.address;
+ }
+ FreeIPConfigStatus(ipconfig_status);
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// WirelessNetwork
+
+void WirelessNetwork::Clear() {
+ Network::Clear();
+ name_.clear();
+ strength_ = 0;
+ auto_connect_ = false;
+}
+
+void WirelessNetwork::ConfigureFromService(const ServiceInfo& service) {
+ Network::ConfigureFromService(service);
+ name_ = service.name;
+ strength_ = service.strength;
+ auto_connect_ = service.auto_connect;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// WifiNetwork
+
+void WifiNetwork::Clear() {
+ WirelessNetwork::Clear();
+ encryption_ = SECURITY_NONE;
+ passphrase_.clear();
+}
+
+void WifiNetwork::ConfigureFromService(const ServiceInfo& service) {
+ WirelessNetwork::ConfigureFromService(service);
+ encryption_ = service.security;
+ passphrase_ = service.passphrase;
+}
+
+////////////////////////////////////////////////////////////////////////////////
// NetworkLibrary
// static
@@ -91,7 +156,7 @@ void NetworkLibraryImpl::ConnectToWifiNetwork(WifiNetwork network,
const string16& identity,
const string16& certpath) {
if (CrosLibrary::Get()->EnsureLoaded()) {
- ConnectToNetworkWithCertInfo(network.service_path.c_str(),
+ ConnectToNetworkWithCertInfo(network.service_path().c_str(),
password.empty() ? NULL : UTF16ToUTF8(password).c_str(),
identity.empty() ? NULL : UTF16ToUTF8(identity).c_str(),
certpath.empty() ? NULL : UTF16ToUTF8(certpath).c_str());
@@ -127,39 +192,27 @@ void NetworkLibraryImpl::ConnectToWifiNetwork(const string16& ssid,
void NetworkLibraryImpl::ConnectToCellularNetwork(CellularNetwork network) {
if (CrosLibrary::Get()->EnsureLoaded()) {
- ConnectToNetwork(network.service_path.c_str(), NULL);
+ ConnectToNetwork(network.service_path().c_str(), NULL);
}
}
-void NetworkLibraryImpl::DisconnectFromWifiNetwork(const WifiNetwork& network) {
+void NetworkLibraryImpl::DisconnectFromWirelessNetwork(
+ const WirelessNetwork& network) {
if (CrosLibrary::Get()->EnsureLoaded()) {
- DisconnectFromNetwork(network.service_path.c_str());
- }
-}
-
-void NetworkLibraryImpl::DisconnectFromCellularNetwork(
- const CellularNetwork& network) {
- if (CrosLibrary::Get()->EnsureLoaded()) {
- DisconnectFromNetwork(network.service_path.c_str());
+ DisconnectFromNetwork(network.service_path().c_str());
}
}
void NetworkLibraryImpl::SaveWifiNetwork(const WifiNetwork& network) {
if (CrosLibrary::Get()->EnsureLoaded()) {
- SetPassphrase(network.service_path.c_str(), network.passphrase.c_str());
- SetAutoConnect(network.service_path.c_str(), network.auto_connect);
+ SetPassphrase(network.service_path().c_str(), network.passphrase().c_str());
+ SetAutoConnect(network.service_path().c_str(), network.auto_connect());
}
}
-void NetworkLibraryImpl::ForgetWifiNetwork(const WifiNetwork& network) {
+void NetworkLibraryImpl::ForgetWirelessNetwork(const WirelessNetwork& network) {
if (CrosLibrary::Get()->EnsureLoaded()) {
- DeleteRememberedService(network.service_path.c_str());
- }
-}
-
-void NetworkLibraryImpl::ForgetCellularNetwork(const CellularNetwork& network) {
- if (CrosLibrary::Get()->EnsureLoaded()) {
- DeleteRememberedService(network.service_path.c_str());
+ DeleteRememberedService(network.service_path().c_str());
}
}
@@ -233,7 +286,7 @@ void NetworkLibraryImpl::ParseSystem(SystemInfo* system,
WifiNetworkVector* remembered_wifi_networks,
CellularNetworkVector* remembered_cellular_networks) {
DLOG(INFO) << "ParseSystem:";
- bool ethernet_found = false;
+ ethernet->Clear();
for (int i = 0; i < system->service_size; i++) {
const ServiceInfo& service = system->services[i];
DLOG(INFO) << " (" << service.type <<
@@ -247,57 +300,12 @@ void NetworkLibraryImpl::ParseSystem(SystemInfo* system,
" fav=" << service.favorite <<
" auto=" << service.auto_connect <<
" error=" << service.error;
- bool connecting = service.state == STATE_ASSOCIATION ||
- service.state == STATE_CONFIGURATION ||
- service.state == STATE_CARRIER;
- bool connected = service.state == STATE_READY;
- // if connected, get ip config
- std::string ip_address;
- if (connected && service.device_path) {
- IPConfigStatus* ipconfig_status = ListIPConfigs(service.device_path);
- if (ipconfig_status) {
- for (int i = 0; i < ipconfig_status->size; i++) {
- IPConfig ipconfig = ipconfig_status->ips[i];
- if (strlen(ipconfig.address) > 0)
- ip_address = ipconfig.address;
- DLOG(INFO) << " ipconfig: " <<
- " type=" << ipconfig.type <<
- " address=" << ipconfig.address <<
- " mtu=" << ipconfig.mtu <<
- " netmask=" << ipconfig.netmask <<
- " broadcast=" << ipconfig.broadcast <<
- " peer_address=" << ipconfig.peer_address <<
- " gateway=" << ipconfig.gateway <<
- " domainname=" << ipconfig.domainname <<
- " name_servers=" << ipconfig.name_servers;
- }
- FreeIPConfigStatus(ipconfig_status);
- }
- }
- if (service.type == TYPE_ETHERNET) {
- ethernet_found = true;
- ethernet->connecting = connecting;
- ethernet->connected = connected;
- ethernet->device_path = service.device_path ? service.device_path :
- std::string();
- ethernet->ip_address = ip_address;
- } else if (service.type == TYPE_WIFI) {
- wifi_networks->push_back(WifiNetwork(service,
- connecting,
- connected,
- ip_address));
- } else if (service.type == TYPE_CELLULAR) {
- cellular_networks->push_back(CellularNetwork(service,
- connecting,
- connected,
- ip_address));
- }
- }
- if (!ethernet_found) {
- ethernet->connecting = false;
- ethernet->connected = false;
- ethernet->device_path = std::string();
- ethernet->ip_address = std::string();
+ if (service.type == TYPE_ETHERNET)
+ ethernet->ConfigureFromService(service);
+ else if (service.type == TYPE_WIFI)
+ wifi_networks->push_back(WifiNetwork(service));
+ else if (service.type == TYPE_CELLULAR)
+ cellular_networks->push_back(CellularNetwork(service));
}
DLOG(INFO) << "Remembered networks:";
for (int i = 0; i < system->remembered_service_size; i++) {
@@ -311,17 +319,10 @@ void NetworkLibraryImpl::ParseSystem(SystemInfo* system,
" sec=" << service.security <<
" pass=" << service.passphrase <<
" auto=" << service.auto_connect;
- if (service.type == TYPE_WIFI) {
- remembered_wifi_networks->push_back(WifiNetwork(service,
- false,
- false,
- std::string()));
- } else if (service.type == TYPE_CELLULAR) {
- remembered_cellular_networks->push_back(CellularNetwork(service,
- false,
- false,
- std::string()));
- }
+ if (service.type == TYPE_WIFI)
+ remembered_wifi_networks->push_back(WifiNetwork(service));
+ else if (service.type == TYPE_CELLULAR)
+ remembered_cellular_networks->push_back(CellularNetwork(service));
}
}
}
@@ -380,14 +381,14 @@ void NetworkLibraryImpl::UpdateNetworkStatus(SystemInfo* system) {
wifi_ = WifiNetwork();
for (size_t i = 0; i < wifi_networks_.size(); i++) {
- if (wifi_networks_[i].connecting || wifi_networks_[i].connected) {
+ if (wifi_networks_[i].connecting_or_connected()) {
wifi_ = wifi_networks_[i];
break; // There is only one connected or connecting wifi network.
}
}
cellular_ = CellularNetwork();
for (size_t i = 0; i < cellular_networks_.size(); i++) {
- if (cellular_networks_[i].connecting || cellular_networks_[i].connected) {
+ if (cellular_networks_[i].connecting_or_connected()) {
cellular_ = cellular_networks_[i];
break; // There is only one connected or connecting cellular network.
}
@@ -454,12 +455,12 @@ bool NetworkLibraryImpl::Connecting() const {
const std::string& NetworkLibraryImpl::IPAddress() const {
// Returns highest priority IP address.
if (ethernet_connected())
- return ethernet_.ip_address;
+ return ethernet_.ip_address();
if (wifi_connected())
- return wifi_.ip_address;
+ return wifi_.ip_address();
if (cellular_connected())
- return cellular_.ip_address;
- return ethernet_.ip_address;
+ return cellular_.ip_address();
+ return ethernet_.ip_address();
}
} // namespace chromeos
diff --git a/chrome/browser/chromeos/cros/network_library.h b/chrome/browser/chromeos/cros/network_library.h
index 04cd7d10..d4aea07 100644
--- a/chrome/browser/chromeos/cros/network_library.h
+++ b/chrome/browser/chromeos/cros/network_library.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,89 +18,113 @@
namespace chromeos {
-struct EthernetNetwork {
- EthernetNetwork()
- : connecting(false),
- connected(false) {}
+class Network {
+ public:
+ const std::string& service_path() const { return service_path_; }
+ const std::string& device_path() const { return device_path_; }
+ const std::string& ip_address() const { return ip_address_; }
+ bool connecting() const { return connecting_; }
+ bool connected() const { return connected_; }
+ bool connecting_or_connected() const { return connecting_ || connected_; }
- std::string device_path;
- std::string ip_address;
- bool connecting;
- bool connected;
+ void set_connecting(bool connecting) { connecting_ = connecting; }
+ void set_connected(bool connected) { connected_ = connected; }
+
+ // Clear the fields.
+ virtual void Clear();
+
+ // Configure the Network from a ServiceInfo object.
+ virtual void ConfigureFromService(const ServiceInfo& service);
+
+ protected:
+ Network()
+ : connecting_(false),
+ connected_(false) {}
+ virtual ~Network() {}
+
+ private:
+ std::string service_path_;
+ std::string device_path_;
+ std::string ip_address_;
+ bool connecting_;
+ bool connected_;
};
-struct WifiNetwork {
- WifiNetwork()
- : encrypted(false),
- encryption(SECURITY_UNKNOWN),
- strength(0),
- connecting(false),
- connected(false),
- auto_connect(false) {}
- WifiNetwork(ServiceInfo service, bool connecting, bool connected,
- const std::string& ip_address)
- : service_path(service.service_path),
- device_path(service.device_path),
- ssid(service.name),
- encrypted(service.security != SECURITY_NONE),
- encryption(service.security),
- passphrase(service.passphrase),
- strength(service.strength),
- connecting(connecting),
- connected(connected),
- auto_connect(service.auto_connect),
- ip_address(ip_address) {}
-
- // WifiNetworks are sorted by ssids.
- bool operator< (const WifiNetwork& other) const {
- return ssid < other.ssid;
+class EthernetNetwork : public Network {
+ public:
+ EthernetNetwork() : Network() {}
+};
+
+class WirelessNetwork : public Network {
+ public:
+ // WirelessNetwork are sorted by name.
+ bool operator< (const WirelessNetwork& other) const {
+ return name_ < other.name();
}
- std::string service_path;
- std::string device_path;
- std::string ssid;
- bool encrypted;
- ConnectionSecurity encryption;
- std::string passphrase;
- int strength;
- bool connecting;
- bool connected;
- bool auto_connect;
- std::string ip_address;
+ const std::string& name() const { return name_; }
+ int strength() const { return strength_; }
+ bool auto_connect() const { return auto_connect_; }
+
+ void set_name(const std::string& name) { name_ = name; }
+ void set_auto_connect(bool auto_connect) { auto_connect_ = auto_connect; }
+
+ // Network overrides.
+ virtual void Clear();
+ virtual void ConfigureFromService(const ServiceInfo& service);
+
+ protected:
+ WirelessNetwork()
+ : Network(),
+ strength_(0),
+ auto_connect_(false) {}
+
+ private:
+ std::string name_;
+ int strength_;
+ bool auto_connect_;
};
-typedef std::vector<WifiNetwork> WifiNetworkVector;
-struct CellularNetwork {
- CellularNetwork()
- : strength(strength),
- connecting(false),
- connected(false),
- auto_connect(false) {}
- CellularNetwork(ServiceInfo service, bool connecting, bool connected,
- const std::string& ip_address)
- : service_path(service.service_path),
- device_path(service.device_path),
- name(service.name),
- strength(service.strength),
- connecting(connecting),
- connected(connected),
- auto_connect(service.auto_connect),
- ip_address(ip_address) {}
-
- // CellularNetworks are sorted by name.
- bool operator< (const CellularNetwork& other) const {
- return name < other.name;
+class CellularNetwork : public WirelessNetwork {
+ public:
+ CellularNetwork() : WirelessNetwork() {}
+ explicit CellularNetwork(const ServiceInfo& service)
+ : WirelessNetwork() {
+ ConfigureFromService(service);
}
+};
- std::string service_path;
- std::string device_path;
- std::string name;
- int strength;
- bool connecting;
- bool connected;
- bool auto_connect;
- std::string ip_address;
+class WifiNetwork : public WirelessNetwork {
+ public:
+ WifiNetwork()
+ : WirelessNetwork(),
+ encryption_(SECURITY_NONE) {}
+ explicit WifiNetwork(const ServiceInfo& service)
+ : WirelessNetwork() {
+ ConfigureFromService(service);
+ }
+
+ bool encrypted() const { return encryption_ != SECURITY_NONE; }
+ ConnectionSecurity encryption() const { return encryption_; }
+ const std::string& passphrase() const { return passphrase_; }
+
+ void set_encryption(ConnectionSecurity encryption) {
+ encryption_ = encryption;
+ }
+ void set_passphrase(const std::string& passphrase) {
+ passphrase_ = passphrase;
+ }
+
+ // WirelessNetwork overrides.
+ virtual void Clear();
+ virtual void ConfigureFromService(const ServiceInfo& service);
+
+ private:
+ ConnectionSecurity encryption_;
+ std::string passphrase_;
};
+
+typedef std::vector<WifiNetwork> WifiNetworkVector;
typedef std::vector<CellularNetwork> CellularNetworkVector;
struct NetworkIPConfig {
@@ -154,7 +178,7 @@ class NetworkLibrary {
virtual bool ethernet_connecting() const = 0;
virtual bool ethernet_connected() const = 0;
- virtual const std::string& wifi_ssid() const = 0;
+ virtual const std::string& wifi_name() const = 0;
virtual bool wifi_connecting() const = 0;
virtual bool wifi_connected() const = 0;
virtual int wifi_strength() const = 0;
@@ -204,21 +228,15 @@ class NetworkLibrary {
// Connect to the specified cellular network.
virtual void ConnectToCellularNetwork(CellularNetwork network) = 0;
- // Disconnect from the specified wifi network.
- virtual void DisconnectFromWifiNetwork(const WifiNetwork& network) = 0;
-
- // Disconnect from the specified cellular network.
- virtual void DisconnectFromCellularNetwork(
- const CellularNetwork& network) = 0;
+ // Disconnect from the specified wireless (either cellular or wifi) network.
+ virtual void DisconnectFromWirelessNetwork(
+ const WirelessNetwork& network) = 0;
// Set whether or not to auto-connect to this network.
virtual void SaveWifiNetwork(const WifiNetwork& network) = 0;
- // Forget the passed in wifi network.
- virtual void ForgetWifiNetwork(const WifiNetwork& network) = 0;
-
- // Forget the passed in cellular network.
- virtual void ForgetCellularNetwork(const CellularNetwork& network) = 0;
+ // Forget the passed in wireless (either cellular or wifi) network.
+ virtual void ForgetWirelessNetwork(const WirelessNetwork& network) = 0;
virtual bool ethernet_available() const = 0;
virtual bool wifi_available() const = 0;
@@ -269,18 +287,18 @@ class NetworkLibraryImpl : public NetworkLibrary,
virtual void RemoveObserver(Observer* observer);
virtual const EthernetNetwork& ethernet_network() const { return ethernet_; }
- virtual bool ethernet_connecting() const { return ethernet_.connecting; }
- virtual bool ethernet_connected() const { return ethernet_.connected; }
+ virtual bool ethernet_connecting() const { return ethernet_.connecting(); }
+ virtual bool ethernet_connected() const { return ethernet_.connected(); }
- virtual const std::string& wifi_ssid() const { return wifi_.ssid; }
- virtual bool wifi_connecting() const { return wifi_.connecting; }
- virtual bool wifi_connected() const { return wifi_.connected; }
- virtual int wifi_strength() const { return wifi_.strength; }
+ virtual const std::string& wifi_name() const { return wifi_.name(); }
+ virtual bool wifi_connecting() const { return wifi_.connecting(); }
+ virtual bool wifi_connected() const { return wifi_.connected(); }
+ virtual int wifi_strength() const { return wifi_.strength(); }
- virtual const std::string& cellular_name() const { return cellular_.name; }
- virtual bool cellular_connecting() const { return cellular_.connecting; }
- virtual bool cellular_connected() const { return cellular_.connected; }
- virtual int cellular_strength() const { return cellular_.strength; }
+ virtual const std::string& cellular_name() const { return cellular_.name(); }
+ virtual bool cellular_connecting() const { return cellular_.connecting(); }
+ virtual bool cellular_connected() const { return cellular_.connected(); }
+ virtual int cellular_strength() const { return cellular_.strength(); }
// Return true if any network is currently connected.
virtual bool Connected() const;
@@ -330,34 +348,34 @@ class NetworkLibraryImpl : public NetworkLibrary,
// Connect to the specified cellular network.
virtual void ConnectToCellularNetwork(CellularNetwork network);
- // Disconnect from the specified wifi network.
- virtual void DisconnectFromWifiNetwork(const WifiNetwork& network);
-
- // Disconnect from the specified cellular network.
- virtual void DisconnectFromCellularNetwork(const CellularNetwork& network);
+ // Disconnect from the specified wireless (either cellular or wifi) network.
+ virtual void DisconnectFromWirelessNetwork(const WirelessNetwork& network);
// Set whether or not to auto-connect to this network.
virtual void SaveWifiNetwork(const WifiNetwork& network);
- // Forget the passed in wifi network.
- virtual void ForgetWifiNetwork(const WifiNetwork& network);
-
- // Forget the passed in cellular network.
- virtual void ForgetCellularNetwork(const CellularNetwork& network);
+ // Forget the passed in wireless (either cellular or wifi) network.
+ virtual void ForgetWirelessNetwork(const WirelessNetwork& network);
virtual bool ethernet_available() const {
- return available_devices_ & (1 << TYPE_ETHERNET); }
+ return available_devices_ & (1 << TYPE_ETHERNET);
+ }
virtual bool wifi_available() const {
- return available_devices_ & (1 << TYPE_WIFI); }
+ return available_devices_ & (1 << TYPE_WIFI);
+ }
virtual bool cellular_available() const {
- return available_devices_ & (1 << TYPE_CELLULAR); }
+ return available_devices_ & (1 << TYPE_CELLULAR);
+ }
virtual bool ethernet_enabled() const {
- return enabled_devices_ & (1 << TYPE_ETHERNET); }
+ return enabled_devices_ & (1 << TYPE_ETHERNET);
+ }
virtual bool wifi_enabled() const {
- return enabled_devices_ & (1 << TYPE_WIFI); }
+ return enabled_devices_ & (1 << TYPE_WIFI);
+ }
virtual bool cellular_enabled() const {
- return enabled_devices_ & (1 << TYPE_CELLULAR); }
+ return enabled_devices_ & (1 << TYPE_CELLULAR);
+ }
virtual bool offline_mode() const { return offline_mode_; }
diff --git a/chrome/browser/chromeos/login/network_screen.cc b/chrome/browser/chromeos/login/network_screen.cc
index c0c86bb..6d80fdd 100644
--- a/chrome/browser/chromeos/login/network_screen.cc
+++ b/chrome/browser/chromeos/login/network_screen.cc
@@ -147,7 +147,7 @@ void NetworkScreen::ConnectToNetwork(NetworkList::NetworkType type,
networks_.GetNetworkById(type, id);
if (network && !IsSameNetwork(network, networks_.ConnectedNetwork())) {
if (NetworkList::NETWORK_WIFI == network->network_type) {
- if (network->wifi_network.encrypted) {
+ if (network->wifi_network.encrypted()) {
OpenPasswordDialog(network->wifi_network);
return;
} else {
diff --git a/chrome/browser/chromeos/login/network_screen_browsertest.cc b/chrome/browser/chromeos/login/network_screen_browsertest.cc
index 41c36e0..6d7203d 100644
--- a/chrome/browser/chromeos/login/network_screen_browsertest.cc
+++ b/chrome/browser/chromeos/login/network_screen_browsertest.cc
@@ -37,8 +37,8 @@ using ::testing::A;
class NetworkScreenTest : public WizardInProcessBrowserTest {
public:
NetworkScreenTest(): WizardInProcessBrowserTest("network") {
- cellular_.name = "Cellular network";
- wifi_.ssid = "WiFi network";
+ cellular_.set_name("Cellular network");
+ wifi_.set_name("WiFi network");
}
protected:
@@ -98,15 +98,15 @@ class NetworkScreenTest : public WizardInProcessBrowserTest {
void SetupWifiNetwork(bool connected, bool connecting) {
wifi_networks_.clear();
- wifi_.connected = connected;
- wifi_.connecting = connecting;
+ wifi_.set_connected(connected);
+ wifi_.set_connecting(connecting);
wifi_networks_.push_back(wifi_);
}
void SetupCellularNetwork(bool connected, bool connecting) {
cellular_networks_.clear();
- cellular_.connected = connected;
- cellular_.connecting = connecting;
+ cellular_.set_connected(connected);
+ cellular_.set_connecting(connecting);
cellular_networks_.push_back(cellular_);
}
@@ -129,7 +129,7 @@ class NetworkScreenTest : public WizardInProcessBrowserTest {
}
void WifiSsidExpectation(const std::string& ssid) {
- EXPECT_CALL(*mock_network_library_, wifi_ssid())
+ EXPECT_CALL(*mock_network_library_, wifi_name())
.Times(1)
.WillOnce((ReturnRef(ssid)));
}
@@ -200,28 +200,28 @@ IN_PROC_BROWSER_TEST_F(NetworkScreenTest, NetworksConnectedNotSelected) {
SetupCellularNetwork(true, false);
CellularExpectations(true, false);
WifiCellularNetworksExpectations();
- WifiSsidExpectation(wifi_.ssid);
- CellularNameExpectation(cellular_.name);
+ WifiSsidExpectation(wifi_.name());
+ CellularNameExpectation(cellular_.name());
network_screen->NetworkChanged(network_library);
ASSERT_EQ(network_screen, controller()->current_screen());
ASSERT_EQ(3, network_screen->GetItemCount());
- EXPECT_EQ(ASCIIToWide(wifi_.ssid), network_screen->GetItemAt(1));
- EXPECT_EQ(ASCIIToWide(cellular_.name), network_screen->GetItemAt(2));
+ EXPECT_EQ(ASCIIToWide(wifi_.name()), network_screen->GetItemAt(1));
+ EXPECT_EQ(ASCIIToWide(cellular_.name()), network_screen->GetItemAt(2));
// Ethernet, WiFi & Cellular - connected.
EthernetExpectations(true, false);
WifiExpectations(true, false);
CellularExpectations(true, false);
WifiCellularNetworksExpectations();
- WifiSsidExpectation(wifi_.ssid);
- CellularNameExpectation(cellular_.name);
+ WifiSsidExpectation(wifi_.name());
+ CellularNameExpectation(cellular_.name());
network_screen->NetworkChanged(network_library);
ASSERT_EQ(network_screen, controller()->current_screen());
ASSERT_EQ(4, network_screen->GetItemCount());
EXPECT_EQ(l10n_util::GetString(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET),
network_screen->GetItemAt(1));
- EXPECT_EQ(ASCIIToWide(wifi_.ssid), network_screen->GetItemAt(2));
- EXPECT_EQ(ASCIIToWide(cellular_.name), network_screen->GetItemAt(3));
+ EXPECT_EQ(ASCIIToWide(wifi_.name()), network_screen->GetItemAt(2));
+ EXPECT_EQ(ASCIIToWide(cellular_.name()), network_screen->GetItemAt(3));
}
IN_PROC_BROWSER_TEST_F(NetworkScreenTest, EthernetSelected) {
@@ -281,7 +281,7 @@ IN_PROC_BROWSER_TEST_F(NetworkScreenTest, WifiSelected) {
WifiSsidExpectation(std::string());
network_screen->NetworkChanged(network_library);
ASSERT_EQ(2, network_screen->GetItemCount());
- EXPECT_EQ(ASCIIToWide(wifi_.ssid), network_screen->GetItemAt(1));
+ EXPECT_EQ(ASCIIToWide(wifi_.name()), network_screen->GetItemAt(1));
DummyComboboxModel combobox_model;
views::Combobox combobox(&combobox_model);
@@ -304,7 +304,7 @@ IN_PROC_BROWSER_TEST_F(NetworkScreenTest, WifiSelected) {
SetupWifiNetwork(false, true);
WifiExpectations(false, true);
WifiCellularNetworksExpectations();
- WifiSsidExpectation(wifi_.ssid);
+ WifiSsidExpectation(wifi_.name());
network_screen->NetworkChanged(network_library);
ASSERT_EQ(network_screen, controller()->current_screen());
@@ -319,7 +319,7 @@ IN_PROC_BROWSER_TEST_F(NetworkScreenTest, WifiSelected) {
SetupWifiNetwork(true, false);
WifiExpectations(true, false);
WifiCellularNetworksExpectations();
- WifiSsidExpectation(wifi_.ssid);
+ WifiSsidExpectation(wifi_.name());
network_screen->NetworkChanged(network_library);
ui_test_utils::RunAllPendingInMessageLoop();
controller()->set_observer(NULL);
@@ -340,7 +340,7 @@ IN_PROC_BROWSER_TEST_F(NetworkScreenTest, CellularSelected) {
CellularNameExpectation(std::string());
network_screen->NetworkChanged(network_library);
ASSERT_EQ(2, network_screen->GetItemCount());
- EXPECT_EQ(ASCIIToWide(cellular_.name), network_screen->GetItemAt(1));
+ EXPECT_EQ(ASCIIToWide(cellular_.name()), network_screen->GetItemAt(1));
DummyComboboxModel combobox_model;
views::Combobox combobox(&combobox_model);
@@ -361,7 +361,7 @@ IN_PROC_BROWSER_TEST_F(NetworkScreenTest, CellularSelected) {
SetupCellularNetwork(false, true);
CellularExpectations(false, true);
WifiCellularNetworksExpectations();
- CellularNameExpectation(cellular_.name);
+ CellularNameExpectation(cellular_.name());
network_screen->NetworkChanged(network_library);
ASSERT_EQ(network_screen, controller()->current_screen());
@@ -376,7 +376,7 @@ IN_PROC_BROWSER_TEST_F(NetworkScreenTest, CellularSelected) {
SetupCellularNetwork(true, false);
CellularExpectations(true, false);
WifiCellularNetworksExpectations();
- CellularNameExpectation(cellular_.name);
+ CellularNameExpectation(cellular_.name());
network_screen->NetworkChanged(network_library);
ui_test_utils::RunAllPendingInMessageLoop();
controller()->set_observer(NULL);
diff --git a/chrome/browser/chromeos/network_list.cc b/chrome/browser/chromeos/network_list.cc
index fdc4794..cea21ce 100644
--- a/chrome/browser/chromeos/network_list.cc
+++ b/chrome/browser/chromeos/network_list.cc
@@ -38,12 +38,12 @@ int NetworkList::GetNetworkIndexById(NetworkType type,
return i;
case NETWORK_WIFI:
- if (network_id == networks_[i].wifi_network.ssid)
+ if (network_id == networks_[i].wifi_network.name())
return i;
break;
case NETWORK_CELLULAR:
- if (network_id == networks_[i].cellular_network.name)
+ if (network_id == networks_[i].cellular_network.name())
return i;
break;
@@ -101,10 +101,10 @@ void NetworkList::NetworkChanged(chromeos::NetworkLibrary* network_lib) {
for (WifiNetworkVector::const_iterator it = wifi.begin();
it != wifi.end(); ++it, ++index) {
networks_.push_back(NetworkItem(NETWORK_WIFI,
- ASCIIToUTF16(it->ssid),
+ ASCIIToUTF16(it->name()),
*it,
CellularNetwork()));
- if (network_lib->wifi_ssid() == it->ssid) {
+ if (network_lib->wifi_name() == it->name()) {
SetNetworksIndices(index,
network_lib->wifi_connected(),
network_lib->wifi_connecting());
@@ -115,10 +115,10 @@ void NetworkList::NetworkChanged(chromeos::NetworkLibrary* network_lib) {
for (CellularNetworkVector::const_iterator it = cellular.begin();
it != cellular.end(); ++it, ++index) {
networks_.push_back(NetworkItem(NETWORK_CELLULAR,
- ASCIIToUTF16(it->name),
+ ASCIIToUTF16(it->name()),
WifiNetwork(),
*it));
- if (network_lib->cellular_name() == it->name) {
+ if (network_lib->cellular_name() == it->name()) {
SetNetworksIndices(index,
network_lib->cellular_connected(),
network_lib->cellular_connecting());
diff --git a/chrome/browser/chromeos/options/internet_page_view.cc b/chrome/browser/chromeos/options/internet_page_view.cc
index 383a8b4..e297f09 100644
--- a/chrome/browser/chromeos/options/internet_page_view.cc
+++ b/chrome/browser/chromeos/options/internet_page_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -304,17 +304,17 @@ void WirelessSection::InitSection() {
// Wifi
wifi_networks_ = cros->wifi_networks();
for (size_t i = 0; i < wifi_networks_.size(); ++i) {
- std::wstring name = ASCIIToWide(wifi_networks_[i].ssid);
+ std::wstring name = ASCIIToWide(wifi_networks_[i].name());
SkBitmap icon = NetworkMenuButton::IconForNetworkStrength(
- wifi_networks_[i].strength, true);
- if (wifi_networks_[i].encrypted) {
+ wifi_networks_[i].strength(), true);
+ if (wifi_networks_[i].encrypted()) {
icon = NetworkMenuButton::IconForDisplay(icon,
*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE));
}
- bool connecting = wifi_networks_[i].connecting;
- bool connected = wifi_networks_[i].connected;
+ bool connecting = wifi_networks_[i].connecting();
+ bool connected = wifi_networks_[i].connected();
AddWirelessNetwork(i, icon, name, connecting, connected, TYPE_WIFI);
}
@@ -322,17 +322,17 @@ void WirelessSection::InitSection() {
celluar_networks_ = cros->cellular_networks();
// Cellular networks ssids.
for (size_t i = 0; i < celluar_networks_.size(); ++i) {
- std::wstring name = ASCIIToWide(celluar_networks_[i].name);
+ std::wstring name = ASCIIToWide(celluar_networks_[i].name());
SkBitmap icon = NetworkMenuButton::IconForNetworkStrength(
- celluar_networks_[i].strength, true);
+ celluar_networks_[i].strength(), true);
// TODO(chocobo): Check cellular network 3g/edge.
SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_3G);
// SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_EDGE);
icon = NetworkMenuButton::IconForDisplay(icon, badge);
- bool connecting = celluar_networks_[i].connecting;
- bool connected = celluar_networks_[i].connected;
+ bool connecting = celluar_networks_[i].connecting();
+ bool connected = celluar_networks_[i].connected();
AddWirelessNetwork(i, icon, name, connecting, connected, TYPE_CELLULAR);
}
}
@@ -345,7 +345,7 @@ void WirelessSection::ButtonClicked(int button, int connection_type, int id) {
CrosLibrary::Get()->GetNetworkLibrary()->ConnectToCellularNetwork(
celluar_networks_[id]);
} else if (button == DISCONNECT_BUTTON) {
- CrosLibrary::Get()->GetNetworkLibrary()->DisconnectFromCellularNetwork(
+ CrosLibrary::Get()->GetNetworkLibrary()->DisconnectFromWirelessNetwork(
celluar_networks_[id]);
} else {
CreateModalPopup(new NetworkConfigView(celluar_networks_[id]));
@@ -355,7 +355,7 @@ void WirelessSection::ButtonClicked(int button, int connection_type, int id) {
if (static_cast<int>(wifi_networks_.size()) > id) {
if (button == CONNECT_BUTTON) {
// Connect to wifi here. Open password page if appropriate.
- if (wifi_networks_[id].encrypted) {
+ if (wifi_networks_[id].encrypted()) {
NetworkConfigView* view =
new NetworkConfigView(wifi_networks_[id], true);
CreateModalPopup(view);
@@ -365,7 +365,7 @@ void WirelessSection::ButtonClicked(int button, int connection_type, int id) {
wifi_networks_[id], string16(), string16(), string16());
}
} else if (button == DISCONNECT_BUTTON) {
- CrosLibrary::Get()->GetNetworkLibrary()->DisconnectFromWifiNetwork(
+ CrosLibrary::Get()->GetNetworkLibrary()->DisconnectFromWirelessNetwork(
wifi_networks_[id]);
} else {
CreateModalPopup(new NetworkConfigView(wifi_networks_[id], false));
@@ -430,10 +430,10 @@ void RememberedSection::InitSection() {
// Wifi
wifi_networks_ = cros->remembered_wifi_networks();
for (size_t i = 0; i < wifi_networks_.size(); ++i) {
- std::wstring name = ASCIIToWide(wifi_networks_[i].ssid);
+ std::wstring name = ASCIIToWide(wifi_networks_[i].name());
SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0);
- if (wifi_networks_[i].encrypted) {
+ if (wifi_networks_[i].encrypted()) {
icon = NetworkMenuButton::IconForDisplay(icon,
*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE));
}
@@ -445,7 +445,7 @@ void RememberedSection::InitSection() {
celluar_networks_ = cros->remembered_cellular_networks();
// Cellular networks ssids.
for (size_t i = 0; i < celluar_networks_.size(); ++i) {
- std::wstring name = ASCIIToWide(celluar_networks_[i].name);
+ std::wstring name = ASCIIToWide(celluar_networks_[i].name());
SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0);
// TODO(chocobo): Check cellular network 3g/edge.
@@ -461,12 +461,12 @@ void RememberedSection::InitSection() {
void RememberedSection::ButtonClicked(int button, int connection_type, int id) {
if (connection_type == TYPE_CELLULAR) {
if (static_cast<int>(celluar_networks_.size()) > id) {
- CrosLibrary::Get()->GetNetworkLibrary()->ForgetCellularNetwork(
+ CrosLibrary::Get()->GetNetworkLibrary()->ForgetWirelessNetwork(
celluar_networks_[id]);
}
} else if (connection_type == TYPE_WIFI) {
if (static_cast<int>(wifi_networks_.size()) > id) {
- CrosLibrary::Get()->GetNetworkLibrary()->ForgetWifiNetwork(
+ CrosLibrary::Get()->GetNetworkLibrary()->ForgetWirelessNetwork(
wifi_networks_[id]);
}
} else {
diff --git a/chrome/browser/chromeos/options/network_config_view.cc b/chrome/browser/chromeos/options/network_config_view.cc
index fef22b1..b48a60a 100644
--- a/chrome/browser/chromeos/options/network_config_view.cc
+++ b/chrome/browser/chromeos/options/network_config_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -85,9 +85,9 @@ std::wstring NetworkConfigView::GetWindowTitle() const {
if (flags_ & FLAG_OTHER_NETWORK)
return l10n_util::GetString(IDS_OPTIONS_SETTINGS_OTHER_NETWORKS);
if (flags_ & FLAG_WIFI)
- return ASCIIToWide(wifi_.ssid);
+ return ASCIIToWide(wifi_.name());
if (flags_ & FLAG_CELLULAR)
- return ASCIIToWide(cellular_.name);
+ return ASCIIToWide(cellular_.name());
return l10n_util::GetString(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET);
}
@@ -135,11 +135,11 @@ void NetworkConfigView::Init() {
if (flags_ & FLAG_SHOW_IPCONFIG) {
if (flags_ & FLAG_WIFI)
- ipconfig_view_ = new IPConfigView(wifi_.device_path);
+ ipconfig_view_ = new IPConfigView(wifi_.device_path());
else if (flags_ & FLAG_CELLULAR)
- ipconfig_view_ = new IPConfigView(cellular_.device_path);
+ ipconfig_view_ = new IPConfigView(cellular_.device_path());
else
- ipconfig_view_ = new IPConfigView(ethernet_.device_path);
+ ipconfig_view_ = new IPConfigView(ethernet_.device_path());
tabs_->AddTab(
l10n_util::GetString(IDS_OPTIONS_SETTINGS_SECTION_TITLE_IP_CONFIG),
ipconfig_view_);
diff --git a/chrome/browser/chromeos/options/wifi_config_view.cc b/chrome/browser/chromeos/options/wifi_config_view.cc
index 83284d3..24c6343 100644
--- a/chrome/browser/chromeos/options/wifi_config_view.cc
+++ b/chrome/browser/chromeos/options/wifi_config_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -129,16 +129,16 @@ bool WifiConfigView::Save() {
bool changed = false;
bool auto_connect = autoconnect_checkbox_->checked();
- if (auto_connect != wifi_.auto_connect) {
- wifi_.auto_connect = auto_connect;
+ if (auto_connect != wifi_.auto_connect()) {
+ wifi_.set_auto_connect(auto_connect);
changed = true;
}
if (passphrase_textfield_) {
const std::string& passphrase =
UTF16ToUTF8(passphrase_textfield_->text());
- if (passphrase != wifi_.passphrase) {
- wifi_.passphrase = passphrase;
+ if (passphrase != wifi_.passphrase()) {
+ wifi_.set_passphrase(passphrase);
changed = true;
}
}
@@ -190,7 +190,7 @@ void WifiConfigView::Init() {
ssid_textfield_->SetController(this);
layout->AddView(ssid_textfield_);
} else {
- views::Label* label = new views::Label(ASCIIToWide(wifi_.ssid));
+ views::Label* label = new views::Label(ASCIIToWide(wifi_.name()));
label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
layout->AddView(label);
}
@@ -201,7 +201,7 @@ void WifiConfigView::Init() {
// in general, but very common. WPA Supplicant doesn't report the
// EAP type because it's unknown until the process begins, and we'd
// need some kind of callback.
- if (wifi_.encrypted && wifi_.encryption == SECURITY_8021X) {
+ if (wifi_.encrypted() && wifi_.encryption() == SECURITY_8021X) {
layout->StartRow(0, column_view_set_id);
layout->AddView(new views::Label(l10n_util::GetString(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY)));
@@ -221,10 +221,10 @@ void WifiConfigView::Init() {
}
// Add passphrase if other_network or wifi is encrypted.
- if (other_network_ || wifi_.encrypted) {
+ if (other_network_ || wifi_.encrypted()) {
layout->StartRow(0, column_view_set_id);
int label_text_id;
- if (wifi_.encryption == SECURITY_8021X)
+ if (wifi_.encryption() == SECURITY_8021X)
label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT;
else
label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE;
@@ -232,8 +232,8 @@ void WifiConfigView::Init() {
passphrase_textfield_ = new views::Textfield(
views::Textfield::STYLE_PASSWORD);
passphrase_textfield_->SetController(this);
- if (!wifi_.passphrase.empty())
- passphrase_textfield_->SetText(UTF8ToUTF16(wifi_.passphrase));
+ if (!wifi_.passphrase().empty())
+ passphrase_textfield_->SetText(UTF8ToUTF16(wifi_.passphrase()));
layout->AddView(passphrase_textfield_);
// Password visible button.
passphrase_visible_button_ = new views::ImageButton(this);
@@ -250,7 +250,7 @@ void WifiConfigView::Init() {
autoconnect_checkbox_ = new views::Checkbox(
l10n_util::GetString(IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_AUTO_CONNECT));
// For other network, default to autoconnect.
- bool autoconnect = other_network_ || wifi_.auto_connect;
+ bool autoconnect = other_network_ || wifi_.auto_connect();
autoconnect_checkbox_->SetChecked(autoconnect);
layout->StartRow(0, column_view_set_id);
layout->AddView(autoconnect_checkbox_, 3, 1);
diff --git a/chrome/browser/chromeos/options/wifi_config_view_browsertest.cc b/chrome/browser/chromeos/options/wifi_config_view_browsertest.cc
index 2f5bfd6..07e846e 100644
--- a/chrome/browser/chromeos/options/wifi_config_view_browsertest.cc
+++ b/chrome/browser/chromeos/options/wifi_config_view_browsertest.cc
@@ -44,7 +44,7 @@ IN_PROC_BROWSER_TEST_F(WifiConfigViewTest, ChangeAutoConnectSaveTest) {
IN_PROC_BROWSER_TEST_F(WifiConfigViewTest, ChangePasswordSaveTest) {
EXPECT_CALL(*mock_network_library_, SaveWifiNetwork(_)).Times(1);
WifiNetwork wifi = WifiNetwork();
- wifi.encrypted = true;
+ wifi.set_encryption(SECURITY_WEP);
WifiConfigView* view = new WifiConfigView(NULL, wifi);
view->passphrase_textfield_->SetText(ASCIIToUTF16("test"));
view->Save();
diff --git a/chrome/browser/chromeos/status/network_menu_button.cc b/chrome/browser/chromeos/status/network_menu_button.cc
index dea19d8..aa9b046 100644
--- a/chrome/browser/chromeos/status/network_menu_button.cc
+++ b/chrome/browser/chromeos/status/network_menu_button.cc
@@ -118,7 +118,7 @@ void NetworkMenuButton::ActivatedAt(int index) {
// If clicked on a network that we are already connected to or we are
// currently trying to connect to, then open config dialog.
- if (wifi.ssid == cros->wifi_ssid()) {
+ if (wifi.name() == cros->wifi_name()) {
if (cros->wifi_connected()) {
NetworkConfigView* view = new NetworkConfigView(wifi, false);
views::Window* window = views::Window::CreateChromeWindow(
@@ -129,7 +129,7 @@ void NetworkMenuButton::ActivatedAt(int index) {
} else {
// If wifi network is not encrypted, then directly connect.
// Otherwise, we open password dialog window.
- if (!wifi.encrypted) {
+ if (!wifi.encrypted()) {
cros->ConnectToWifiNetwork(wifi, string16(), string16(), string16());
} else {
NetworkConfigView* view = new NetworkConfigView(wifi, true);
@@ -145,7 +145,7 @@ void NetworkMenuButton::ActivatedAt(int index) {
// If clicked on a network that we are already connected to or we are
// currently trying to connect to, then open config dialog.
- if (cellular.name == cros->cellular_name()) {
+ if (cellular.name() == cros->cellular_name()) {
if (cros->cellular_connected()) {
NetworkConfigView* view = new NetworkConfigView(cellular);
views::Window* window = views::Window::CreateChromeWindow(
@@ -423,11 +423,11 @@ void NetworkMenuButton::InitMenuItems() {
const WifiNetworkVector& wifi_networks = cros->wifi_networks();
// Wifi networks ssids.
for (size_t i = 0; i < wifi_networks.size(); ++i) {
- label = ASCIIToUTF16(wifi_networks[i].ssid);
- SkBitmap icon = IconForNetworkStrength(wifi_networks[i].strength, true);
- SkBitmap badge = wifi_networks[i].encrypted ?
+ label = ASCIIToUTF16(wifi_networks[i].name());
+ SkBitmap icon = IconForNetworkStrength(wifi_networks[i].strength(), true);
+ SkBitmap badge = wifi_networks[i].encrypted() ?
*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE) : SkBitmap();
- flag = (wifi_networks[i].ssid == cros->wifi_ssid()) ?
+ flag = (wifi_networks[i].name() == cros->wifi_name()) ?
FLAG_WIFI | FLAG_ASSOCIATED : FLAG_WIFI;
menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label,
IconForDisplay(icon, badge), wifi_networks[i], CellularNetwork(),
@@ -438,12 +438,12 @@ void NetworkMenuButton::InitMenuItems() {
const CellularNetworkVector& cell_networks = cros->cellular_networks();
// Cellular networks ssids.
for (size_t i = 0; i < cell_networks.size(); ++i) {
- label = ASCIIToUTF16(cell_networks[i].name);
- SkBitmap icon = IconForNetworkStrength(cell_networks[i].strength, true);
+ label = ASCIIToUTF16(cell_networks[i].name());
+ SkBitmap icon = IconForNetworkStrength(cell_networks[i].strength(), true);
// TODO(chocobo): Check cellular network 3g/edge.
SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_3G);
// SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_EDGE);
- flag = (cell_networks[i].name == cros->cellular_name()) ?
+ flag = (cell_networks[i].name() == cros->cellular_name()) ?
FLAG_CELLULAR | FLAG_ASSOCIATED : FLAG_CELLULAR;
menu_items_.push_back(MenuItem(menus::MenuModel::TYPE_COMMAND, label,
IconForDisplay(icon, badge), WifiNetwork(), cell_networks[i], flag));