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

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

Issue 1921973004: Moves DefaultWindowResizer to common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@first_move
Patch Set: merge 2 trunk 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/default_window_resizer.h ('k') | ash/wm/dock/docked_window_resizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ash/wm/default_window_resizer.h"
6
7 #include "ash/wm/common/window_state.h"
8 #include "ash/wm/common/wm_globals.h"
9 #include "ash/wm/common/wm_window.h"
10
11 namespace ash {
12
13 DefaultWindowResizer::~DefaultWindowResizer() {
14 globals_->UnlockCursor();
15 }
16
17 // static
18 DefaultWindowResizer*
19 DefaultWindowResizer::Create(wm::WindowState* window_state) {
20 return new DefaultWindowResizer(window_state);
21 }
22
23 void DefaultWindowResizer::Drag(const gfx::Point& location, int event_flags) {
24 gfx::Rect bounds(CalculateBoundsForDrag(location));
25 if (bounds != GetTarget()->GetBounds()) {
26 if (!did_move_or_resize_ && !details().restore_bounds.IsEmpty())
27 window_state_->ClearRestoreBounds();
28 did_move_or_resize_ = true;
29 GetTarget()->SetBounds(bounds);
30 }
31 }
32
33 void DefaultWindowResizer::CompleteDrag() {
34 }
35
36 void DefaultWindowResizer::RevertDrag() {
37 if (!did_move_or_resize_)
38 return;
39
40 GetTarget()->SetBounds(details().initial_bounds_in_parent);
41
42 if (!details().restore_bounds.IsEmpty())
43 window_state_->SetRestoreBoundsInScreen(details().restore_bounds);
44 }
45
46 DefaultWindowResizer::DefaultWindowResizer(wm::WindowState* window_state)
47 : WindowResizer(window_state),
48 did_move_or_resize_(false),
49 globals_(GetTarget()->GetGlobals()) {
50 DCHECK(details().is_resizable);
51 globals_->LockCursor();
52 }
53
54 } // namespace aura
OLDNEW
« no previous file with comments | « ash/wm/default_window_resizer.h ('k') | ash/wm/dock/docked_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698