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

Unified Diff: chrome/browser/chromeos/net/network_portal_notification_controller.cc

Issue 2823323002: cros: close dialog when shill detects captive portal network switched to online (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « chrome/browser/chromeos/net/network_portal_notification_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/net/network_portal_notification_controller.cc
diff --git a/chrome/browser/chromeos/net/network_portal_notification_controller.cc b/chrome/browser/chromeos/net/network_portal_notification_controller.cc
index fcf4817f0fa05a4f8af007b1b1f5939fbb573f34..1a56ac5323886f888abf4b38ce8923d265cce05a 100644
--- a/chrome/browser/chromeos/net/network_portal_notification_controller.cc
+++ b/chrome/browser/chromeos/net/network_portal_notification_controller.cc
@@ -259,6 +259,14 @@ void NetworkPortalNotificationController::DefaultNetworkChanged(
const NetworkState* network) {
if (!network)
return;
+
+ bool network_changed = (default_network_id_ != network->guid());
+ default_network_id_ = network->guid();
+ if (!network_changed && network->connection_state() == shill::kStateOnline &&
+ dialog_) {
+ dialog_->Close();
+ }
+
Profile* profile = GetProfileForPrimaryUser();
extensions::NetworkingConfigService* networking_config_service =
GetNetworkingConfigService(profile);
@@ -276,16 +284,6 @@ void NetworkPortalNotificationController::OnPortalDetectionCompleted(
if (!network ||
state.status != NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL) {
last_network_guid_.clear();
-
- // In browser tests we initiate fake network portal detection, but network
- // state usually stays connected. This way, after dialog is shown, it is
- // immediately closed. The testing check below prevents dialog from closing.
- if (dialog_ &&
- (!ignore_no_network_for_testing_ ||
- state.status == NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE)) {
- dialog_->Close();
- }
-
CloseNotification();
return;
}
@@ -432,10 +430,6 @@ void NetworkPortalNotificationController::OnExtensionFinishedAuthentication() {
retry_detection_callback_.Run();
}
-void NetworkPortalNotificationController::SetIgnoreNoNetworkForTesting() {
- ignore_no_network_for_testing_ = true;
-}
-
void NetworkPortalNotificationController::CloseDialog() {
if (dialog_)
dialog_->Close();
« no previous file with comments | « chrome/browser/chromeos/net/network_portal_notification_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698