diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-04 19:29:22 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-04 19:29:22 +0000 |
commit | e8e880cca9d6341d45305b18e73e1daec73375a6 (patch) | |
tree | 607c9b7c1a51810a3ffffeeb9e2c91046e3f5b4a /chrome | |
parent | 31a1f50d843be6bb3d3858327a60313aef454187 (diff) | |
download | chromium_src-e8e880cca9d6341d45305b18e73e1daec73375a6.zip chromium_src-e8e880cca9d6341d45305b18e73e1daec73375a6.tar.gz chromium_src-e8e880cca9d6341d45305b18e73e1daec73375a6.tar.bz2 |
Add "Other..." to wireless networks.
- Create a fake network item for "Other..." in InternetOptionsHandler;
- Update js to handle "Other...". That is, no icon, status and action buttons for this item and click on the item brings up the wifi dialog;
- Show default cursor on network item text;
BUG=chromium-os:4744
TEST=Verify that "Other..." shows up at the end of wireless networks and works.
Review URL: http://codereview.chromium.org/3046044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54941 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
3 files changed, 49 insertions, 5 deletions
diff --git a/chrome/browser/chromeos/dom_ui/internet_options_handler.cc b/chrome/browser/chromeos/dom_ui/internet_options_handler.cc index 6a2ed3d..0f4c336 100644 --- a/chrome/browser/chromeos/dom_ui/internet_options_handler.cc +++ b/chrome/browser/chromeos/dom_ui/internet_options_handler.cc @@ -30,6 +30,8 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "views/window/window.h" +static const char kOtherNetworksFakePath[] = "?"; + InternetOptionsHandler::InternetOptionsHandler() { chromeos::CrosLibrary::Get()->GetNetworkLibrary()->AddObserver(this); } @@ -128,6 +130,9 @@ void InternetOptionsHandler::ButtonClickCallback(const Value* value) { chromeos::WifiNetwork network; if (command == "forget") { cros->ForgetWirelessNetwork(service_path); + } else if (service_path == kOtherNetworksFakePath) { + // Other wifi networks. + CreateModalPopup(new chromeos::NetworkConfigView()); } else if (cros->FindWifiNetworkByPath(service_path, &network)) { if (command == "connect") { // Connect to wifi here. Open password page if appropriate. @@ -207,7 +212,8 @@ ListValue* InternetOptionsHandler::GetNetwork(const std::string& service_path, // connecting network->Append(Value::CreateBooleanValue(connecting)); // icon data url - network->Append(Value::CreateStringValue(ConvertSkBitmapToDataURL(icon))); + network->Append(Value::CreateStringValue(icon.isNull() ? "" : + ConvertSkBitmapToDataURL(icon))); // remembered network->Append(Value::CreateBooleanValue(remembered)); return network; @@ -280,6 +286,15 @@ ListValue* InternetOptionsHandler::GetWirelessList() { false)); } + list->Append(GetNetwork( + kOtherNetworksFakePath, + SkBitmap(), + l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_OTHER_NETWORKS), + false, + false, + chromeos::TYPE_WIFI, + false)); + return list; } diff --git a/chrome/browser/resources/options/chromeos_internet_network_element.js b/chrome/browser/resources/options/chromeos_internet_network_element.js index 10f54dd..e5dc255 100644 --- a/chrome/browser/resources/options/chromeos_internet_network_element.js +++ b/chrome/browser/resources/options/chromeos_internet_network_element.js @@ -41,10 +41,28 @@ cr.define('options.internet', function() { // Handle left button click if (e.button == 0) { var el = e.target; + + // If click is on action buttons of a network item. if (el.buttonType && el.networkType && el.servicePath) { chrome.send('buttonClickCallback', - [String(el.networkType), String(el.servicePath), - String(el.buttonType)]); + [String(el.networkType), el.servicePath, el.buttonType]); + } else { + // If click is on a network item or its label, walk up the DOM tree + // to find the network item. + var item = el; + while (item && !item.data) { + item = item.parentNode; + } + + if (item) { + var data = item.data; + + // If clicked on other networks item. + if (data && data.servicePath == '?') { + chrome.send('buttonClickCallback', + [String(data.networkType), data.servicePath, 'options']); + } + } } } } @@ -86,19 +104,29 @@ cr.define('options.internet', function() { /** @inheritDoc */ decorate: function() { + var isOtherNetworksItem = this.data.servicePath == '?'; + this.className = 'network-item'; this.connected = this.data.connected; // textDiv holds icon, name and status text. var textDiv = this.ownerDocument.createElement('div'); textDiv.className = 'network-item-text'; - textDiv.style.backgroundImage = url(this.data.iconURL); + if (this.data.iconURL) { + textDiv.style.backgroundImage = url(this.data.iconURL); + } var nameEl = this.ownerDocument.createElement('div'); nameEl.className = 'network-name-label'; nameEl.textContent = this.data.networkName; textDiv.appendChild(nameEl); + if (isOtherNetworksItem) { + // No status and buttons for "Other..." + this.appendChild(textDiv); + return; + } + var statusEl = this.ownerDocument.createElement('div'); statusEl.className = 'network-status-label'; statusEl.textContent = this.data.networkStatus; diff --git a/chrome/browser/resources/options/chromeos_internet_options_page.css b/chrome/browser/resources/options/chromeos_internet_options_page.css index 7879230ea..c09a5f8 100644 --- a/chrome/browser/resources/options/chromeos_internet_options_page.css +++ b/chrome/browser/resources/options/chromeos_internet_options_page.css @@ -8,12 +8,12 @@ #internetPage > section > h3 { font-size: 100%; + width: auto; } .networks { -webkit-margin-start: 15px; padding: 2px; - width: 100%; } .network-item { @@ -45,6 +45,7 @@ .network-item-text { -webkit-padding-start: 30px; background: 0 50% no-repeat; + cursor: default; line-height: 100%; max-width: 320px; overflow: hidden; |