Commit 5276c883 authored by benchan's avatar benchan Committed by Commit bot

Handle no cellular device more gracefully in choose-mobile-network UI.

chrome://choose-mobile-network can be launched on a Chromebook without
any cellular modem. This CL changes the UI to handle such case more
gracefully:

- Without overhauling the UI too much, the UI is changed to simply show
  'No networks found'.
- When the Cancel button is pressed, the UI performs nothing.

BUG=714547
TEST=Tested the following:
- Launch chrome://choose-mobile-network on a Chromebook without a
  cellular modem. Verify that the UI shows 'No networks found'.
  Click the Cancel button and verify that the UI doesn't crash.
- Launch chrome://choose-mobile-network on a Chromebook with a cellular
  modem. Verify that the UI can populate a list of networks after
  successfully scanning for networks, and the Connect and Cancel button
  function correctly.

Review-Url: https://codereview.chromium.org/2851863003
Cr-Commit-Position: refs/heads/master@{#468176}
parent 2a938c3d
......@@ -136,6 +136,9 @@ ChooseMobileNetworkHandler::ChooseMobileNetworkHandler()
NET_LOG_ERROR(
"A cellular device is not available.",
"Cannot initiate a cellular network scan without a cellular device.");
// If there is no cellular device, we set |has_pending_results_| to true so
// that HandlePageReady() will show "No networks found." on the web UI.
has_pending_results_ = true;
return;
}
handler->AddObserver(this, FROM_HERE);
......@@ -221,6 +224,9 @@ void ChooseMobileNetworkHandler::HandleCancel(const base::ListValue* args) {
return;
}
if (device_path_.empty())
return;
// Switch to automatic mode.
GetNetworkDeviceHandler()->RegisterCellularNetwork(
device_path_,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment