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

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

Issue 586933002: Re-Revert "[WebModals] New API for browser-scoped popup management." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2125
Patch Set: Created 6 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/chromeos/login/ui/captive_portal_window_proxy.cc
diff --git a/chrome/browser/chromeos/login/ui/captive_portal_window_proxy.cc b/chrome/browser/chromeos/login/ui/captive_portal_window_proxy.cc
index 24b00ecc3556eea6676f91f3af28a84fcc242824..11405f3a2dfcedbc2af4feadbbb176c4db8b1617 100644
--- a/chrome/browser/chromeos/login/ui/captive_portal_window_proxy.cc
+++ b/chrome/browser/chromeos/login/ui/captive_portal_window_proxy.cc
@@ -7,11 +7,12 @@
#include "chrome/browser/chromeos/login/ui/captive_portal_view.h"
#include "chrome/browser/chromeos/login/ui/proxy_settings_dialog.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
-#include "components/web_modal/popup_manager.h"
+#include "components/web_modal/web_contents_modal_dialog_host.h"
+#include "components/web_modal/web_contents_modal_dialog_manager.h"
+#include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
#include "ui/views/widget/widget.h"
namespace {
-
// The captive portal dialog is system-modal, but uses the web-content-modal
// dialog manager (odd) and requires this atypical dialog widget initialization.
views::Widget* CreateWindowAsFramelessChild(views::WidgetDelegate* delegate,
@@ -71,15 +72,16 @@ void CaptivePortalWindowProxy::Show() {
InitCaptivePortalView();
CaptivePortalView* portal = captive_portal_view_.release();
- web_modal::PopupManager* popup_manager =
- web_modal::PopupManager::FromWebContents(web_contents_);
- if (popup_manager) {
- widget_ =
- CreateWindowAsFramelessChild(portal, popup_manager->GetHostView());
- portal->Init();
- widget_->AddObserver(this);
- popup_manager->ShowModalDialog(widget_->GetNativeView(), web_contents_);
- }
+ web_modal::WebContentsModalDialogManager* manager =
+ web_modal::WebContentsModalDialogManager::FromWebContents(web_contents_);
+ const gfx::NativeWindow parent =
+ manager->delegate()->GetWebContentsModalDialogHost()->GetHostView();
+ widget_ = CreateWindowAsFramelessChild(portal, parent);
+ portal->Init();
+
+ widget_->AddObserver(this);
+ manager->ShowModalDialog(widget_->GetNativeView());
+ DCHECK(GetState() == STATE_DISPLAYED);
}
void CaptivePortalWindowProxy::Close() {

Powered by Google App Engine
This is Rietveld 408576698