summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/options/internet_page_view.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/chromeos/options/internet_page_view.cc')
-rw-r--r--chrome/browser/chromeos/options/internet_page_view.cc81
1 files changed, 28 insertions, 53 deletions
diff --git a/chrome/browser/chromeos/options/internet_page_view.cc b/chrome/browser/chromeos/options/internet_page_view.cc
index c22e1c5..14ad91d 100644
--- a/chrome/browser/chromeos/options/internet_page_view.cc
+++ b/chrome/browser/chromeos/options/internet_page_view.cc
@@ -301,7 +301,7 @@ class WirelessSection : public NetworkSection {
bool connected, int connection_type);
WifiNetworkVector wifi_networks_;
- CellularNetworkVector celluar_networks_;
+ CellularNetworkVector cellular_networks_;
DISALLOW_COPY_AND_ASSIGN(WirelessSection);
};
@@ -319,58 +319,56 @@ 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].name());
+ std::wstring name = ASCIIToWide(wifi_networks_[i]->name());
SkBitmap icon = NetworkMenu::IconForNetworkStrength(
- wifi_networks_[i].strength(), true);
- if (wifi_networks_[i].encrypted()) {
+ wifi_networks_[i]->strength(), true);
+ if (wifi_networks_[i]->encrypted()) {
icon = NetworkMenu::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);
}
// Cellular
- 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());
+ cellular_networks_ = cros->cellular_networks();
+ for (size_t i = 0; i < cellular_networks_.size(); ++i) {
+ std::wstring name = ASCIIToWide(cellular_networks_[i]->name());
SkBitmap icon = NetworkMenu::IconForNetworkStrength(
- 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);
+ cellular_networks_[i]->strength(), true);
+ SkBitmap badge =
+ NetworkMenu::BadgeForNetworkTechnology(cellular_networks_[i]);
icon = NetworkMenu::IconForDisplay(icon, badge);
- bool connecting = celluar_networks_[i].connecting();
- bool connected = celluar_networks_[i].connected();
+ bool connecting = cellular_networks_[i]->connecting();
+ bool connected = cellular_networks_[i]->connected();
AddWirelessNetwork(i, icon, name, connecting, connected, TYPE_CELLULAR);
}
}
void WirelessSection::ButtonClicked(int button, int connection_type, int id) {
if (connection_type == TYPE_CELLULAR) {
- if (static_cast<int>(celluar_networks_.size()) > id) {
+ if (static_cast<int>(cellular_networks_.size()) > id) {
if (button == CONNECT_BUTTON) {
// Connect to cellular network.
CrosLibrary::Get()->GetNetworkLibrary()->ConnectToCellularNetwork(
- celluar_networks_[id]);
+ cellular_networks_[id]);
} else if (button == DISCONNECT_BUTTON) {
CrosLibrary::Get()->GetNetworkLibrary()->DisconnectFromWirelessNetwork(
- celluar_networks_[id]);
+ cellular_networks_[id]);
} else {
- CreateModalPopup(new NetworkConfigView(celluar_networks_[id]));
+ CreateModalPopup(new NetworkConfigView(cellular_networks_[id]));
}
}
} else if (connection_type == TYPE_WIFI) {
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);
@@ -428,7 +426,6 @@ class RememberedSection : public NetworkSection {
private:
WifiNetworkVector wifi_networks_;
- CellularNetworkVector celluar_networks_;
DISALLOW_COPY_AND_ASSIGN(RememberedSection);
};
@@ -446,44 +443,23 @@ 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].name());
+ std::wstring name = ASCIIToWide(wifi_networks_[i]->name());
- SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0);
- if (wifi_networks_[i].encrypted()) {
+ SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0_BLACK);
+ if (wifi_networks_[i]->encrypted()) {
icon = NetworkMenu::IconForDisplay(icon,
*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE));
}
AddNetwork(i, icon, name, false, std::wstring(), FORGET_BUTTON, TYPE_WIFI);
}
-
- // Cellular
- 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());
-
- SkBitmap icon = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0);
- // TODO(chocobo): Check cellular network 3g/edge.
- SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_3G);
-// SkBitmap badge = *rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_EDGE);
- icon = NetworkMenu::IconForDisplay(icon, badge);
-
- AddNetwork(i, icon, name, false, std::wstring(), FORGET_BUTTON,
- TYPE_CELLULAR);
- }
}
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()->ForgetWirelessNetwork(
- celluar_networks_[id].service_path());
- }
- } else if (connection_type == TYPE_WIFI) {
+ if (connection_type == TYPE_WIFI) {
if (static_cast<int>(wifi_networks_.size()) > id) {
- CrosLibrary::Get()->GetNetworkLibrary()->ForgetWirelessNetwork(
- wifi_networks_[id].service_path());
+ CrosLibrary::Get()->GetNetworkLibrary()->ForgetWifiNetwork(
+ wifi_networks_[id]->service_path());
}
} else {
NOTREACHED();
@@ -590,15 +566,14 @@ InternetPageView::InternetPageView(Profile* profile)
contents_view_(new InternetPageContentView(profile)),
scroll_view_(new views::ScrollView) {
NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
- cros->UpdateSystemInfo();
- cros->AddObserver(this);
+ cros->AddNetworkManagerObserver(this);
}
InternetPageView::~InternetPageView() {
- CrosLibrary::Get()->GetNetworkLibrary()->RemoveObserver(this);
+ CrosLibrary::Get()->GetNetworkLibrary()->RemoveNetworkManagerObserver(this);
}
-void InternetPageView::NetworkChanged(NetworkLibrary* obj) {
+void InternetPageView::OnNetworkManagerChanged(NetworkLibrary* obj) {
// Refresh wired, wireless, and remembered networks.
// Remember the current scroll region, and try to scroll back afterwards.
gfx::Rect rect = scroll_view_->GetVisibleRect();