Show devtools window in the middle of display

This commit is contained in:
Cheng Zhao 2015-08-04 22:50:30 +08:00
parent 0ef2857534
commit 5b4a42f7e9

View file

@ -183,8 +183,8 @@ InspectableWebContentsImpl::InspectableWebContentsImpl(
gfx::Rect display = gfx::Screen::GetNativeScreen() gfx::Rect display = gfx::Screen::GetNativeScreen()
->GetDisplayNearestWindow(web_contents->GetNativeView()).bounds(); ->GetDisplayNearestWindow(web_contents->GetNativeView()).bounds();
if (!IsPointInRect(devtools_bounds_.origin(), display)) { if (!IsPointInRect(devtools_bounds_.origin(), display)) {
devtools_bounds_.set_x(0); devtools_bounds_.set_x(display.x() + (display.width() - devtools_bounds_.width()) / 2);
devtools_bounds_.set_y(0); devtools_bounds_.set_y(display.y() + (display.height() - devtools_bounds_.height()) / 2);
} }
} }