Center browser dialogs with respect to docked devtools

Currently browser dialogs are centered relatively to the main
webcontents. If one has docked devtools which occupy 90% of the browser
window, the dialog is hardly seen.

This patch makes dialogs to be centered with respect to open devtools,
which means centering to the container of both inspected webcontents
and and devtools.

BUG=

Review URL: https://codereview.chromium.org/169403004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252048 0039d316-1c4b-4281-b951-d872f2087c98
parent 2eb78c3d
...@@ -79,7 +79,7 @@ class BrowserViewLayout::WebContentsModalDialogHostViews ...@@ -79,7 +79,7 @@ class BrowserViewLayout::WebContentsModalDialogHostViews
} }
virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE { virtual gfx::Point GetDialogPosition(const gfx::Size& size) OVERRIDE {
views::View* view = browser_view_layout_->delegate_->GetContentsWebView(); views::View* view = browser_view_layout_->contents_container_;
gfx::Rect content_area = view->ConvertRectToWidget(view->GetLocalBounds()); gfx::Rect content_area = view->ConvertRectToWidget(view->GetLocalBounds());
const int middle_x = content_area.x() + content_area.width() / 2; const int middle_x = content_area.x() + content_area.width() / 2;
const int top = browser_view_layout_->web_contents_modal_dialog_top_y_; const int top = browser_view_layout_->web_contents_modal_dialog_top_y_;
...@@ -87,7 +87,7 @@ class BrowserViewLayout::WebContentsModalDialogHostViews ...@@ -87,7 +87,7 @@ class BrowserViewLayout::WebContentsModalDialogHostViews
} }
virtual gfx::Size GetMaximumDialogSize() OVERRIDE { virtual gfx::Size GetMaximumDialogSize() OVERRIDE {
views::View* view = browser_view_layout_->delegate_->GetContentsWebView(); views::View* view = browser_view_layout_->contents_container_;
gfx::Rect content_area = view->ConvertRectToWidget(view->GetLocalBounds()); gfx::Rect content_area = view->ConvertRectToWidget(view->GetLocalBounds());
const int top = browser_view_layout_->web_contents_modal_dialog_top_y_; const int top = browser_view_layout_->web_contents_modal_dialog_top_y_;
return gfx::Size(content_area.width(), content_area.bottom() - top); return gfx::Size(content_area.width(), content_area.bottom() - top);
......
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