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

Unified Diff: chrome/browser/chromeos/login/captive_portal_window_proxy.cc

Issue 9861015: [cros] Captive portal dialog fixes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clarify Created 8 years, 9 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/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..994a6d42b26d7feca2863d855451d211028d6801 100644
--- a/chrome/browser/chromeos/login/captive_portal_window_proxy.cc
+++ b/chrome/browser/chromeos/login/captive_portal_window_proxy.cc
@@ -31,24 +31,29 @@ CaptivePortalWindowProxy::~CaptivePortalWindowProxy() {
}
void CaptivePortalWindowProxy::ShowIfRedirected() {
- if (!widget_ && !captive_portal_view_.get()) {
+ if (widget_) {
+ // Invalid state as when widget is created (Show())
+ // CaptivePortalView ownership is transferred to it.
+ if (captive_portal_view_.get()) {
+ NOTREACHED();
+ }
+ // Dialog is already shown, no need to reload.
+ return;
+ }
+
+ // Dialog is not initialized yet.
+ if (!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();
- }
+ // If dialog has been created (but not shown) previously, force reload.
+ captive_portal_view_->StartLoad();
}
-void CaptivePortalWindowProxy::OnRedirected() {
+void CaptivePortalWindowProxy::Show() {
if (!captive_portal_view_.get() || widget_) {
- NOTREACHED();
+ // Dialog is already shown, do nothing.
return;
}
CaptivePortalView* captive_portal_view = captive_portal_view_.release();
@@ -63,6 +68,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();
}

Powered by Google App Engine
This is Rietveld 408576698