Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: ash/wm/workspace/workspace_window_resizer.cc

Issue 1924703002: Rename gfx::Display/Screen to display::Display/Screen in ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/wm/workspace/workspace_window_resizer.h" 5 #include "ash/wm/workspace/workspace_window_resizer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 11 matching lines...) Expand all
22 #include "ash/wm/common/wm_window.h" 22 #include "ash/wm/common/wm_window.h"
23 #include "ash/wm/dock/docked_window_resizer.h" 23 #include "ash/wm/dock/docked_window_resizer.h"
24 #include "ash/wm/drag_window_resizer.h" 24 #include "ash/wm/drag_window_resizer.h"
25 #include "ash/wm/panels/panel_window_resizer.h" 25 #include "ash/wm/panels/panel_window_resizer.h"
26 #include "ash/wm/workspace/phantom_window_controller.h" 26 #include "ash/wm/workspace/phantom_window_controller.h"
27 #include "ash/wm/workspace/two_step_edge_cycler.h" 27 #include "ash/wm/workspace/two_step_edge_cycler.h"
28 #include "base/memory/ptr_util.h" 28 #include "base/memory/ptr_util.h"
29 #include "base/memory/weak_ptr.h" 29 #include "base/memory/weak_ptr.h"
30 #include "ui/base/hit_test.h" 30 #include "ui/base/hit_test.h"
31 #include "ui/compositor/layer.h" 31 #include "ui/compositor/layer.h"
32 #include "ui/gfx/screen.h" 32 #include "ui/display/screen.h"
33 #include "ui/gfx/transform.h" 33 #include "ui/gfx/transform.h"
34 #include "ui/wm/public/window_types.h" 34 #include "ui/wm/public/window_types.h"
35 35
36 namespace ash { 36 namespace ash {
37 37
38 std::unique_ptr<WindowResizer> CreateWindowResizer( 38 std::unique_ptr<WindowResizer> CreateWindowResizer(
39 wm::WmWindow* window, 39 wm::WmWindow* window,
40 const gfx::Point& point_in_parent, 40 const gfx::Point& point_in_parent,
41 int window_component, 41 int window_component,
42 aura::client::WindowMoveSource source) { 42 aura::client::WindowMoveSource source) {
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 window_state()->ClearRestoreBounds(); 366 window_state()->ClearRestoreBounds();
367 RestackWindows(); 367 RestackWindows();
368 } 368 }
369 did_move_or_resize_ = true; 369 did_move_or_resize_ = true;
370 } 370 }
371 371
372 gfx::Point location_in_screen = 372 gfx::Point location_in_screen =
373 GetTarget()->GetParent()->ConvertPointToScreen(location_in_parent); 373 GetTarget()->GetParent()->ConvertPointToScreen(location_in_parent);
374 374
375 wm::WmWindow* root = nullptr; 375 wm::WmWindow* root = nullptr;
376 gfx::Display display = 376 display::Display display =
377 gfx::Screen::GetScreen()->GetDisplayNearestPoint(location_in_screen); 377 display::Screen::GetScreen()->GetDisplayNearestPoint(location_in_screen);
378 // Track the last screen that the pointer was on to keep the snap phantom 378 // Track the last screen that the pointer was on to keep the snap phantom
379 // window there. 379 // window there.
380 if (display.bounds().Contains(location_in_screen)) { 380 if (display.bounds().Contains(location_in_screen)) {
381 root = 381 root =
382 wm::WmRootWindowController::GetWithDisplayId(display.id())->GetWindow(); 382 wm::WmRootWindowController::GetWithDisplayId(display.id())->GetWindow();
383 } 383 }
384 if (!attached_windows_.empty()) 384 if (!attached_windows_.empty())
385 LayoutAttachedWindows(&bounds); 385 LayoutAttachedWindows(&bounds);
386 if (bounds != GetTarget()->GetBounds()) { 386 if (bounds != GetTarget()->GetBounds()) {
387 // SetBounds needs to be called to update the layout which affects where the 387 // SetBounds needs to be called to update the layout which affects where the
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 } 760 }
761 } 761 }
762 return false; 762 return false;
763 } 763 }
764 764
765 void WorkspaceWindowResizer::AdjustBoundsForMainWindow( 765 void WorkspaceWindowResizer::AdjustBoundsForMainWindow(
766 int sticky_size, 766 int sticky_size,
767 gfx::Rect* bounds) { 767 gfx::Rect* bounds) {
768 gfx::Point last_mouse_location_in_screen = 768 gfx::Point last_mouse_location_in_screen =
769 GetTarget()->GetParent()->ConvertPointToScreen(last_mouse_location_); 769 GetTarget()->GetParent()->ConvertPointToScreen(last_mouse_location_);
770 gfx::Display display = gfx::Screen::GetScreen()->GetDisplayNearestPoint( 770 display::Display display =
771 last_mouse_location_in_screen); 771 display::Screen::GetScreen()->GetDisplayNearestPoint(
772 last_mouse_location_in_screen);
772 gfx::Rect work_area = 773 gfx::Rect work_area =
773 GetTarget()->GetParent()->ConvertRectFromScreen(display.work_area()); 774 GetTarget()->GetParent()->ConvertRectFromScreen(display.work_area());
774 if (details().window_component == HTCAPTION) { 775 if (details().window_component == HTCAPTION) {
775 // Adjust the bounds to the work area where the mouse cursor is located. 776 // Adjust the bounds to the work area where the mouse cursor is located.
776 // Always keep kMinOnscreenHeight or the window height (whichever is less) 777 // Always keep kMinOnscreenHeight or the window height (whichever is less)
777 // on the bottom. 778 // on the bottom.
778 int max_y = work_area.bottom() - std::min(kMinOnscreenHeight, 779 int max_y = work_area.bottom() - std::min(kMinOnscreenHeight,
779 bounds->height()); 780 bounds->height());
780 if (bounds->y() > max_y) { 781 if (bounds->y() > max_y) {
781 bounds->set_y(max_y); 782 bounds->set_y(max_y);
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 DCHECK(snapped_type == wm::WINDOW_STATE_TYPE_LEFT_SNAPPED || 1034 DCHECK(snapped_type == wm::WINDOW_STATE_TYPE_LEFT_SNAPPED ||
1034 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED); 1035 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED);
1035 gfx::Rect snapped_bounds = wm::GetDisplayWorkAreaBoundsInParent(GetTarget()); 1036 gfx::Rect snapped_bounds = wm::GetDisplayWorkAreaBoundsInParent(GetTarget());
1036 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED) 1037 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED)
1037 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width()); 1038 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width());
1038 snapped_bounds.set_width(bounds_in_parent.width()); 1039 snapped_bounds.set_width(bounds_in_parent.width());
1039 return bounds_in_parent == snapped_bounds; 1040 return bounds_in_parent == snapped_bounds;
1040 } 1041 }
1041 1042
1042 } // namespace ash 1043 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager_unittest.cc ('k') | ash/wm/workspace/workspace_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698