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

Side by Side Diff: ash/wm/default_window_resizer.cc

Issue 1898223002: Removes most aura dependencies from WindowResizer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_aura_from_window_state
Patch Set: nit and merge Created 4 years, 8 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/default_window_resizer.h ('k') | ash/wm/dock/docked_window_layout_manager.cc » ('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/default_window_resizer.h" 5 #include "ash/wm/default_window_resizer.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/wm/common/wm_globals.h"
8 #include "ash/wm/common/wm_window.h"
8 #include "ash/wm/window_state.h" 9 #include "ash/wm/window_state.h"
9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/env.h"
11 #include "ui/aura/window.h"
12 #include "ui/aura/window_delegate.h"
13 #include "ui/base/hit_test.h"
14 #include "ui/base/ui_base_types.h"
15 #include "ui/gfx/screen.h"
16 10
17 namespace ash { 11 namespace ash {
18 12
19 DefaultWindowResizer::~DefaultWindowResizer() { 13 DefaultWindowResizer::~DefaultWindowResizer() {
20 ash::Shell::GetInstance()->cursor_manager()->UnlockCursor(); 14 globals_->UnlockCursor();
21 } 15 }
22 16
23 // static 17 // static
24 DefaultWindowResizer* 18 DefaultWindowResizer*
25 DefaultWindowResizer::Create(wm::WindowState* window_state) { 19 DefaultWindowResizer::Create(wm::WindowState* window_state) {
26 return new DefaultWindowResizer(window_state); 20 return new DefaultWindowResizer(window_state);
27 } 21 }
28 22
29 void DefaultWindowResizer::Drag(const gfx::Point& location, int event_flags) { 23 void DefaultWindowResizer::Drag(const gfx::Point& location, int event_flags) {
30 gfx::Rect bounds(CalculateBoundsForDrag(location)); 24 gfx::Rect bounds(CalculateBoundsForDrag(location));
31 if (bounds != GetTarget()->bounds()) { 25 if (bounds != GetTarget()->GetBounds()) {
32 if (!did_move_or_resize_ && !details().restore_bounds.IsEmpty()) 26 if (!did_move_or_resize_ && !details().restore_bounds.IsEmpty())
33 window_state_->ClearRestoreBounds(); 27 window_state_->ClearRestoreBounds();
34 did_move_or_resize_ = true; 28 did_move_or_resize_ = true;
35 GetTarget()->SetBounds(bounds); 29 GetTarget()->SetBounds(bounds);
36 } 30 }
37 } 31 }
38 32
39 void DefaultWindowResizer::CompleteDrag() { 33 void DefaultWindowResizer::CompleteDrag() {
40 } 34 }
41 35
42 void DefaultWindowResizer::RevertDrag() { 36 void DefaultWindowResizer::RevertDrag() {
43 if (!did_move_or_resize_) 37 if (!did_move_or_resize_)
44 return; 38 return;
45 39
46 GetTarget()->SetBounds(details().initial_bounds_in_parent); 40 GetTarget()->SetBounds(details().initial_bounds_in_parent);
47 41
48 if (!details().restore_bounds.IsEmpty()) 42 if (!details().restore_bounds.IsEmpty())
49 window_state_->SetRestoreBoundsInScreen(details().restore_bounds); 43 window_state_->SetRestoreBoundsInScreen(details().restore_bounds);
50 } 44 }
51 45
52 DefaultWindowResizer::DefaultWindowResizer(wm::WindowState* window_state) 46 DefaultWindowResizer::DefaultWindowResizer(wm::WindowState* window_state)
53 : WindowResizer(window_state), 47 : WindowResizer(window_state),
54 did_move_or_resize_(false) { 48 did_move_or_resize_(false),
49 globals_(GetTarget()->GetGlobals()) {
55 DCHECK(details().is_resizable); 50 DCHECK(details().is_resizable);
56 ash::Shell::GetInstance()->cursor_manager()->LockCursor(); 51 globals_->LockCursor();
57 } 52 }
58 53
59 } // namespace aura 54 } // namespace aura
OLDNEW
« no previous file with comments | « ash/wm/default_window_resizer.h ('k') | ash/wm/dock/docked_window_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698