summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-26 08:02:21 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-26 08:02:21 +0000
commit8378c537e2399d99a9cfbafe11967c328429b5dc (patch)
treecab536d1663848043521a3227733c4d14036b663
parenta705c7ee7f55f4740a7f595e6bffbb60b2c91917 (diff)
downloadchromium_src-8378c537e2399d99a9cfbafe11967c328429b5dc.zip
chromium_src-8378c537e2399d99a9cfbafe11967c328429b5dc.tar.gz
chromium_src-8378c537e2399d99a9cfbafe11967c328429b5dc.tar.bz2
Use GetDisplayNearestWindow instead of GetDislpaymatching where appropriate
This is correct way to tell on which display the window is on as a window doesn't overlap two displays on ash. BUG=none Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=213347 Review URL: https://chromiumcodereview.appspot.com/19593008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213788 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/wm/drag_window_resizer.cc3
-rw-r--r--ash/wm/workspace/auto_window_management.cc9
-rw-r--r--ash/wm/workspace/frame_maximize_button.cc3
-rw-r--r--chrome/browser/ui/views/chrome_views_delegate.cc2
4 files changed, 12 insertions, 5 deletions
diff --git a/ash/wm/drag_window_resizer.cc b/ash/wm/drag_window_resizer.cc
index ca332b9..e8f977e 100644
--- a/ash/wm/drag_window_resizer.cc
+++ b/ash/wm/drag_window_resizer.cc
@@ -181,8 +181,7 @@ void DragWindowResizer::UpdateDragWindow(const gfx::Rect& bounds,
new DragWindowController(GetTarget()));
// Always show the drag phantom on the |another_root| window.
drag_window_controller_->SetDestinationDisplay(
- Shell::GetScreen()->GetDisplayMatching(
- another_root->GetBoundsInScreen()));
+ Shell::GetScreen()->GetDisplayNearestWindow(another_root));
drag_window_controller_->Show();
} else {
// No animation.
diff --git a/ash/wm/workspace/auto_window_management.cc b/ash/wm/workspace/auto_window_management.cc
index 067ee9e..64a4564 100644
--- a/ash/wm/workspace/auto_window_management.cc
+++ b/ash/wm/workspace/auto_window_management.cc
@@ -69,11 +69,18 @@ bool GetOtherVisibleAndManageableWindow(const aura::Window* window,
}
// Get the work area for a given |window|.
-gfx::Rect GetWorkAreaForWindow(const aura::Window* window) {
+gfx::Rect GetWorkAreaForWindow(aura::Window* window) {
+#if defined(OS_WIN)
+ // On Win 8, the host window can't be resized, so
+ // use window's bounds instead.
+ // TODO(oshima): Emulate host window resize on win8.
gfx::Rect work_area = gfx::Rect(window->parent()->bounds().size());
work_area.Inset(Shell::GetScreen()->GetDisplayMatching(
work_area).GetWorkAreaInsets());
return work_area;
+#else
+ return Shell::GetScreen()->GetDisplayNearestWindow(window).work_area();
+#endif
}
// Move the given |bounds| on the available |parent_width| to the
diff --git a/ash/wm/workspace/frame_maximize_button.cc b/ash/wm/workspace/frame_maximize_button.cc
index f5ca589..683ffc0 100644
--- a/ash/wm/workspace/frame_maximize_button.cc
+++ b/ash/wm/workspace/frame_maximize_button.cc
@@ -597,7 +597,8 @@ FrameMaximizeButton::GetMaximizeBubbleFrameState() const {
return FRAME_STATE_FULL;
// For Left/right maximize we need to check the dimensions.
gfx::Rect bounds = frame_->GetWidget()->GetWindowBoundsInScreen();
- gfx::Rect screen = Shell::GetScreen()->GetDisplayMatching(bounds).work_area();
+ gfx::Rect screen = Shell::GetScreen()->GetDisplayNearestWindow(
+ frame_->GetWidget()->GetNativeView()).work_area();
if (bounds.width() < (screen.width() * kMinSnapSizePercent) / 100)
return FRAME_STATE_NONE;
// We might still have a horizontally filled window at this point which we
diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc
index f25f15a..f658bf2 100644
--- a/chrome/browser/ui/views/chrome_views_delegate.cc
+++ b/chrome/browser/ui/views/chrome_views_delegate.cc
@@ -84,7 +84,7 @@ void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window,
window_preferences->SetBoolean("maximized",
show_state == ui::SHOW_STATE_MAXIMIZED);
gfx::Rect work_area(gfx::Screen::GetScreenFor(window->GetNativeView())->
- GetDisplayMatching(bounds).work_area());
+ GetDisplayNearestWindow(window->GetNativeView()).work_area());
window_preferences->SetInteger("work_area_left", work_area.x());
window_preferences->SetInteger("work_area_top", work_area.y());
window_preferences->SetInteger("work_area_right", work_area.right());