| Index: content/browser/web_contents/web_contents_impl.cc
|
| diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
| index d9ac63172636991e1e6bc750d49ea34d9cf6129a..2e248c6993e3bf67a733e60c122d32d1d8d066ae 100644
|
| --- a/content/browser/web_contents/web_contents_impl.cc
|
| +++ b/content/browser/web_contents/web_contents_impl.cc
|
| @@ -1469,11 +1469,41 @@ void WebContentsImpl::ShowCreatedWindow(int route_id,
|
| const gfx::Rect& initial_pos,
|
| bool user_gesture) {
|
| WebContentsImpl* contents = GetCreatedWindow(route_id);
|
| +
|
| + gfx::Rect newContentsWindowPos = initial_pos;
|
| + if (disposition == PRESENTATION_WINDOW) {
|
| + gfx::Screen* screen = gfx::Screen::GetNativeScreen();
|
| + gfx::Rect windowBounds;
|
| + WebContentsView* view = GetView();
|
| + CHECK(view);
|
| + view->GetContainerBounds(&windowBounds);
|
| + gfx::Display thisDisplay = screen->GetDisplayMatching(windowBounds);
|
| +
|
| + std::vector<gfx::Display> displays = screen->GetAllDisplays();
|
| + gfx::Display presentationDisplay;
|
| + // TODO: Instead of just finding the next different display,
|
| + // enable a screen selection here.
|
| + for (std::vector<gfx::Display>::iterator it = displays.begin();
|
| + it != displays.end();
|
| + ++it) {
|
| + if ((*it).id() != thisDisplay.id())
|
| + presentationDisplay = *it;
|
| + }
|
| + if (presentationDisplay.is_valid()) {
|
| + newContentsWindowPos = presentationDisplay.work_area();
|
| + newContentsWindowPos.Inset(200, 200);
|
| + }
|
| + }
|
| +
|
| if (contents) {
|
| WebContentsDelegate* delegate = GetDelegate();
|
| if (delegate) {
|
| - delegate->AddNewContents(
|
| - this, contents, disposition, initial_pos, user_gesture, NULL);
|
| + delegate->AddNewContents(this,
|
| + contents,
|
| + disposition,
|
| + newContentsWindowPos,
|
| + user_gesture,
|
| + NULL);
|
| }
|
| }
|
| }
|
|
|