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

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

Issue 1943603002: Makes ash/wm/common a library (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge again 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
« no previous file with comments | « ash/wm/common/workspace/workspace_window_resizer.h ('k') | ash/wm/drag_window_resizer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/common/workspace/workspace_window_resizer.h" 5 #include "ash/wm/common/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>
11 11
12 #include "ash/wm/common/default_window_resizer.h" 12 #include "ash/wm/common/default_window_resizer.h"
13 #include "ash/wm/common/dock/docked_window_layout_manager.h" 13 #include "ash/wm/common/dock/docked_window_layout_manager.h"
14 #include "ash/wm/common/dock/docked_window_resizer.h" 14 #include "ash/wm/common/dock/docked_window_resizer.h"
15 #include "ash/wm/common/panels/panel_window_resizer.h" 15 #include "ash/wm/common/panels/panel_window_resizer.h"
16 #include "ash/wm/common/window_positioning_utils.h" 16 #include "ash/wm/common/window_positioning_utils.h"
17 #include "ash/wm/common/window_state.h" 17 #include "ash/wm/common/window_state.h"
18 #include "ash/wm/common/wm_event.h" 18 #include "ash/wm/common/wm_event.h"
19 #include "ash/wm/common/wm_globals.h" 19 #include "ash/wm/common/wm_globals.h"
20 #include "ash/wm/common/wm_lookup.h"
20 #include "ash/wm/common/wm_root_window_controller.h" 21 #include "ash/wm/common/wm_root_window_controller.h"
21 #include "ash/wm/common/wm_screen_util.h" 22 #include "ash/wm/common/wm_screen_util.h"
22 #include "ash/wm/common/wm_shell_window_ids.h" 23 #include "ash/wm/common/wm_shell_window_ids.h"
23 #include "ash/wm/common/wm_user_metrics_action.h" 24 #include "ash/wm/common/wm_user_metrics_action.h"
24 #include "ash/wm/common/wm_window.h" 25 #include "ash/wm/common/wm_window.h"
25 #include "ash/wm/common/workspace/phantom_window_controller.h" 26 #include "ash/wm/common/workspace/phantom_window_controller.h"
26 #include "ash/wm/common/workspace/two_step_edge_cycler.h" 27 #include "ash/wm/common/workspace/two_step_edge_cycler.h"
27 #include "base/memory/ptr_util.h" 28 #include "base/memory/ptr_util.h"
28 #include "base/memory/weak_ptr.h" 29 #include "base/memory/weak_ptr.h"
29 #include "ui/base/hit_test.h" 30 #include "ui/base/hit_test.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 356
356 gfx::Point location_in_screen = 357 gfx::Point location_in_screen =
357 GetTarget()->GetParent()->ConvertPointToScreen(location_in_parent); 358 GetTarget()->GetParent()->ConvertPointToScreen(location_in_parent);
358 359
359 wm::WmWindow* root = nullptr; 360 wm::WmWindow* root = nullptr;
360 display::Display display = 361 display::Display display =
361 display::Screen::GetScreen()->GetDisplayNearestPoint(location_in_screen); 362 display::Screen::GetScreen()->GetDisplayNearestPoint(location_in_screen);
362 // Track the last screen that the pointer was on to keep the snap phantom 363 // Track the last screen that the pointer was on to keep the snap phantom
363 // window there. 364 // window there.
364 if (display.bounds().Contains(location_in_screen)) { 365 if (display.bounds().Contains(location_in_screen)) {
365 root = 366 root = wm::WmLookup::Get()
366 wm::WmRootWindowController::GetWithDisplayId(display.id())->GetWindow(); 367 ->GetRootWindowControllerWithDisplayId(display.id())
368 ->GetWindow();
367 } 369 }
368 if (!attached_windows_.empty()) 370 if (!attached_windows_.empty())
369 LayoutAttachedWindows(&bounds); 371 LayoutAttachedWindows(&bounds);
370 if (bounds != GetTarget()->GetBounds()) { 372 if (bounds != GetTarget()->GetBounds()) {
371 // SetBounds needs to be called to update the layout which affects where the 373 // SetBounds needs to be called to update the layout which affects where the
372 // phantom window is drawn. Keep track if the window was destroyed during 374 // phantom window is drawn. Keep track if the window was destroyed during
373 // the drag and quit early if so. 375 // the drag and quit early if so.
374 base::WeakPtr<WorkspaceWindowResizer> resizer( 376 base::WeakPtr<WorkspaceWindowResizer> resizer(
375 weak_ptr_factory_.GetWeakPtr()); 377 weak_ptr_factory_.GetWeakPtr());
376 GetTarget()->SetBounds(bounds); 378 GetTarget()->SetBounds(bounds);
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 DCHECK(snapped_type == wm::WINDOW_STATE_TYPE_LEFT_SNAPPED || 1015 DCHECK(snapped_type == wm::WINDOW_STATE_TYPE_LEFT_SNAPPED ||
1014 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED); 1016 snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED);
1015 gfx::Rect snapped_bounds = wm::GetDisplayWorkAreaBoundsInParent(GetTarget()); 1017 gfx::Rect snapped_bounds = wm::GetDisplayWorkAreaBoundsInParent(GetTarget());
1016 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED) 1018 if (snapped_type == wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED)
1017 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width()); 1019 snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width());
1018 snapped_bounds.set_width(bounds_in_parent.width()); 1020 snapped_bounds.set_width(bounds_in_parent.width());
1019 return bounds_in_parent == snapped_bounds; 1021 return bounds_in_parent == snapped_bounds;
1020 } 1022 }
1021 1023
1022 } // namespace ash 1024 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/common/workspace/workspace_window_resizer.h ('k') | ash/wm/drag_window_resizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698