Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4531)

Unified Diff: chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc

Issue 23684042: Eliminate NetworkManagerChanged (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
diff --git a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
index 2671fd25a441ae2d3fb3af2e3d51ae9de2fa13f2..6dd9c65e3c000bf357a0e3e71ee07ccde0feee92 100644
--- a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
+++ b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc
@@ -268,7 +268,8 @@ class MobileSetupHandler
void HandleGetDeviceInfo(const ListValue* args);
// NetworkStateHandlerObserver implementation.
- virtual void NetworkManagerChanged() OVERRIDE;
+ virtual void NetworkConnectionStateChanged(
+ const NetworkState* network) OVERRIDE;
virtual void DefaultNetworkChanged(
const NetworkState* default_network) OVERRIDE;
@@ -594,30 +595,36 @@ void MobileSetupHandler::GetPropertiesFailure(
web_ui()->CallJavascriptFunction(callback_name, device_dict);
}
-void MobileSetupHandler::NetworkManagerChanged() {
+void MobileSetupHandler::DefaultNetworkChanged(
+ const NetworkState* default_network) {
if (!web_ui())
return;
- std::string path = web_ui()->GetWebContents()->GetURL().path();
+ std::string path = web_ui()->GetWebContents()->GetURL().path().substr(1);
if (path.empty())
return;
const NetworkState* network =
- NetworkHandler::Get()->network_state_handler()->GetNetworkState(
- path.substr(1));
+ NetworkHandler::Get()->network_state_handler()->GetNetworkState(path);
if (!network) {
LOG(ERROR) << "Service path lost";
web_ui()->GetWebContents()->Close();
return;
}
- UpdatePortalReachability(network,
- false /* do not force notification */);
+ UpdatePortalReachability(network, false /* do not force notification */);
}
-void MobileSetupHandler::DefaultNetworkChanged(
- const NetworkState* default_network) {
- NetworkManagerChanged();
+void MobileSetupHandler::NetworkConnectionStateChanged(
+ const NetworkState* network) {
+ if (!web_ui())
+ return;
+
+ std::string path = web_ui()->GetWebContents()->GetURL().path().substr(1);
+ if (path.empty() || path != network->path())
+ return;
+
+ UpdatePortalReachability(network, false /* do not force notification */);
}
void MobileSetupHandler::UpdatePortalReachability(

Powered by Google App Engine
This is Rietveld 408576698