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

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

Issue 287123002: [WebModals] New API for browser-scoped popup management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 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 11405f3a2dfcedbc2af4feadbbb176c4db8b1617..24b00ecc3556eea6676f91f3af28a84fcc242824 100644
--- a/chrome/browser/chromeos/login/ui/captive_portal_window_proxy.cc
+++ b/chrome/browser/chromeos/login/ui/captive_portal_window_proxy.cc
@@ -7,12 +7,11 @@
#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/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 "components/web_modal/popup_manager.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,
@@ -72,16 +71,15 @@ void CaptivePortalWindowProxy::Show() {
InitCaptivePortalView();
CaptivePortalView* portal = captive_portal_view_.release();
- 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);
+ 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_);
+ }
}
void CaptivePortalWindowProxy::Close() {

Powered by Google App Engine
This is Rietveld 408576698