Commit 38e53d43 authored by Jacob Dufault's avatar Jacob Dufault Committed by Commit Bot

cros: Temporary fix to show ProxyBasicAuth prompt on views-login.

When the basic auth widget appears, it is fetching the parent widget using
WebContentsModalDialogHost::GetHostView. CaptivePortalDialogDelegate overrides
this to return the captive portal widget, which is hidden. Thus, the auth widget
is also hidden because its parent widget is hidden.

I believe the correct long-term fix is to not share a WebContents instance
bewteen OoobeUIDialogDelegate and CaptivePortalDialogDelegate. However, that
seems like a much riskier change.

Add a hacky check to return the widget for OoobeUIDialogDelegate if the
CaptivePortalDialogDelegate widget is currently hidden.

Bug: 890976
Change-Id: I0d974449d7eb425a8bb99dcc8d34eb6582c097e7
Reviewed-on: https://chromium-review.googlesource.com/c/1263040Reviewed-by: default avatarQuan Nguyen <qnnguyen@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596865}
parent 8f6cb9c0
...@@ -67,8 +67,9 @@ class CaptivePortalDialogDelegate ...@@ -67,8 +67,9 @@ class CaptivePortalDialogDelegate
public ChromeWebModalDialogManagerDelegate, public ChromeWebModalDialogManagerDelegate,
public web_modal::WebContentsModalDialogHost { public web_modal::WebContentsModalDialogHost {
public: public:
explicit CaptivePortalDialogDelegate(content::WebContents* web_contents) explicit CaptivePortalDialogDelegate(views::WebDialogView* host_dialog_view)
: web_contents_(web_contents) { : host_view_(host_dialog_view),
web_contents_(host_dialog_view->web_contents()) {
view_ = new views::WebDialogView(ProfileHelper::GetSigninProfile(), this, view_ = new views::WebDialogView(ProfileHelper::GetSigninProfile(), this,
new ChromeWebContentsHandler); new ChromeWebContentsHandler);
view_->SetVisible(false); view_->SetVisible(false);
...@@ -106,7 +107,10 @@ class CaptivePortalDialogDelegate ...@@ -106,7 +107,10 @@ class CaptivePortalDialogDelegate
// web_modal::WebContentsModalDialogHost: // web_modal::WebContentsModalDialogHost:
gfx::NativeView GetHostView() const override { gfx::NativeView GetHostView() const override {
return widget_->GetNativeWindow(); if (widget_->IsVisible())
return widget_->GetNativeWindow();
else
return host_view_->GetWidget()->GetNativeWindow();
} }
gfx::Point GetDialogPosition(const gfx::Size& size) override { gfx::Point GetDialogPosition(const gfx::Size& size) override {
...@@ -160,6 +164,7 @@ class CaptivePortalDialogDelegate ...@@ -160,6 +164,7 @@ class CaptivePortalDialogDelegate
private: private:
views::Widget* widget_ = nullptr; views::Widget* widget_ = nullptr;
views::WebDialogView* view_ = nullptr; views::WebDialogView* view_ = nullptr;
views::WebDialogView* host_view_ = nullptr;
content::WebContents* web_contents_ = nullptr; content::WebContents* web_contents_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(CaptivePortalDialogDelegate); DISALLOW_COPY_AND_ASSIGN(CaptivePortalDialogDelegate);
...@@ -198,8 +203,7 @@ OobeUIDialogDelegate::OobeUIDialogDelegate( ...@@ -198,8 +203,7 @@ OobeUIDialogDelegate::OobeUIDialogDelegate(
dialog_view_->web_contents()->SetDelegate(this); dialog_view_->web_contents()->SetDelegate(this);
captive_portal_delegate_ = captive_portal_delegate_ = new CaptivePortalDialogDelegate(dialog_view_);
new CaptivePortalDialogDelegate(dialog_view_->web_contents());
GetOobeUI()->GetErrorScreen()->MaybeInitCaptivePortalWindowProxy( GetOobeUI()->GetErrorScreen()->MaybeInitCaptivePortalWindowProxy(
dialog_view_->web_contents()); dialog_view_->web_contents());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment