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

Side by Side Diff: ash/wm/dock/docked_window_resizer.h

Issue 13896026: Stick windows to sides of workspaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dock with zero width (comments on unit tests) Created 7 years, 6 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
(Empty)
1 // Copyright (c) 2013 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 #ifndef ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_
6 #define ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_
7
8 #include "ash/wm/window_resizer.h"
9 #include "base/compiler_specific.h"
10
11 namespace gfx {
12 class Point;
13 class Rect;
14 }
15
16 namespace aura {
17 class RootWindow;
18 }
19
20 namespace ash {
21
22 namespace internal {
23 class DockedWindowLayoutManager;
24 }
25
26 // DockWindowResizer is used by ToplevelWindowEventFilter to handle dragging,
27 // moving or resizing of a window while it is docked to the side of a screen.
28 class ASH_EXPORT DockedWindowResizer : public WindowResizer {
29 public:
30 virtual ~DockedWindowResizer();
31
32 // Creates a new DockWindowResizer. The caller takes ownership of the
33 // returned object. The ownership of |next_window_resizer| is taken by the
34 // returned object. Returns NULL if not resizable.
35 static DockedWindowResizer* Create(WindowResizer* next_window_resizer,
36 aura::Window* window,
37 const gfx::Point& location,
38 int window_component);
39
40 // WindowResizer:
41 virtual void Drag(const gfx::Point& location, int event_flags) OVERRIDE;
42 virtual void CompleteDrag(int event_flags) OVERRIDE;
43 virtual void RevertDrag() OVERRIDE;
44 virtual aura::Window* GetTarget() OVERRIDE;
45
46 private:
47 // WindowResizer:
48 virtual const gfx::Point& GetInitialLocationForTest() const OVERRIDE;
flackr 2013/06/17 18:49:42 protected
varkha 2013/06/17 19:05:36 Done.
49
50 // Creates DockWindowResizer that adds the ability to attach / detach
51 // windows to / from the dock. This object takes ownership of
52 // |next_window_resizer|.
53 DockedWindowResizer(WindowResizer* next_window_resizer,
54 const Details& details);
55
56 // Checks if the provided window bounds should snap to the side of a screen.
57 // If so the offset returned gives the necessary adjustment to snap.
58 void MaybeSnapToSide(const gfx::Rect& bounds, gfx::Point* offset);
59
60 // Tracks the window's initial position and attachment at the start of a drag
61 // and informs the DockLayoutManager that a drag has started if necessary.
62 void StartedDragging();
63
64 // Informs the DockLayoutManager that the drag is complete if it was informed
65 // of the drag start.
66 void FinishDragging();
67
68 const Details details_;
69
70 gfx::Point last_location_;
71
72 // Wraps a window resizer and adds detaching / reattaching during drags.
73 scoped_ptr<WindowResizer> next_window_resizer_;
74
75 // Dock container window.
76 internal::DockedWindowLayoutManager* dock_layout_;
77
78 // Set to true once Drag() is invoked and the bounds of the window change.
79 bool did_move_or_resize_;
80
81 DISALLOW_COPY_AND_ASSIGN(DockedWindowResizer);
82 };
83
84 } // namespace ash
85
86 #endif // ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698