Index: chrome/browser/chromeos/login/captive_portal_window_proxy.cc |
diff --git a/chrome/browser/chromeos/login/captive_portal_window_proxy.cc b/chrome/browser/chromeos/login/captive_portal_window_proxy.cc |
index 1a1239f54d74bfb16ffe4ce5fd0e69684610b7a8..09735ca69fd76d58d73992a1ebb1a17272132f08 100644 |
--- a/chrome/browser/chromeos/login/captive_portal_window_proxy.cc |
+++ b/chrome/browser/chromeos/login/captive_portal_window_proxy.cc |
@@ -31,24 +31,25 @@ CaptivePortalWindowProxy::~CaptivePortalWindowProxy() { |
} |
void CaptivePortalWindowProxy::ShowIfRedirected() { |
+ // Dialog is already shown, no need to reload. |
+ if (widget_ && !captive_portal_view_.get()) |
+ return; |
+ |
+ // Dialog is not initialized yet. |
+ // Create view. |
if (!widget_ && !captive_portal_view_.get()) { |
captive_portal_view_.reset( |
new CaptivePortalView(ProfileManager::GetDefaultProfile(), this)); |
- captive_portal_view_->StartLoad(); |
} |
-} |
-void CaptivePortalWindowProxy::Close() { |
- if (widget_) { |
- widget_->Close(); |
- } else { |
- captive_portal_view_.reset(); |
- } |
+ // Dialog has been already initialized (this call or previously), |
+ // force reload. |
+ captive_portal_view_->StartLoad(); |
} |
-void CaptivePortalWindowProxy::OnRedirected() { |
+void CaptivePortalWindowProxy::Show() { |
if (!captive_portal_view_.get() || widget_) { |
- NOTREACHED(); |
+ // Dialog already shown, do nothing. |
return; |
} |
CaptivePortalView* captive_portal_view = captive_portal_view_.release(); |
@@ -63,6 +64,18 @@ void CaptivePortalWindowProxy::OnRedirected() { |
widget_->AddObserver(this); |
widget_->Show(); |
+} |
+ |
+void CaptivePortalWindowProxy::Close() { |
+ if (widget_) { |
+ widget_->Close(); |
+ } else { |
+ captive_portal_view_.reset(); |
+ } |
+} |
+ |
+void CaptivePortalWindowProxy::OnRedirected() { |
+ Show(); |
delegate_->OnPortalDetected(); |
} |