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

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

Issue 2700523004: Remove docked windows entirely in M59. (Closed)
Patch Set: Rebase Created 3 years, 9 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_COMMON_WM_DOCK_DOCKED_WINDOW_RESIZER_H_
6 #define ASH_COMMON_WM_DOCK_DOCKED_WINDOW_RESIZER_H_
7
8 #include <memory>
9
10 #include "ash/ash_export.h"
11 #include "ash/common/wm/dock/dock_types.h"
12 #include "ash/common/wm/window_resizer.h"
13 #include "base/macros.h"
14 #include "base/memory/weak_ptr.h"
15
16 namespace gfx {
17 class Point;
18 class Rect;
19 }
20
21 namespace ash {
22 class DockedWindowLayoutManager;
23
24 // DockWindowResizer is used by ToplevelWindowEventFilter to handle dragging,
25 // moving or resizing of a window while it is docked to the side of a screen.
26 class ASH_EXPORT DockedWindowResizer : public WindowResizer {
27 public:
28 ~DockedWindowResizer() override;
29
30 // Creates a new DockWindowResizer. The caller takes ownership of the
31 // returned object. The ownership of |next_window_resizer| is taken by the
32 // returned object. Returns NULL if not resizable.
33 static DockedWindowResizer* Create(WindowResizer* next_window_resizer,
34 wm::WindowState* window_state);
35
36 // WindowResizer:
37 void Drag(const gfx::Point& location, int event_flags) override;
38 void CompleteDrag() override;
39 void RevertDrag() override;
40
41 private:
42 // Creates DockWindowResizer that adds the ability to attach / detach
43 // windows to / from the dock. This object takes ownership of
44 // |next_window_resizer|.
45 DockedWindowResizer(WindowResizer* next_window_resizer,
46 wm::WindowState* window_state);
47
48 // If the provided window bounds should snap to the side of a screen,
49 // returns the offset that gives the necessary adjustment to snap.
50 void MaybeSnapToEdge(const gfx::Rect& bounds, gfx::Point* offset);
51
52 // Tracks the window's initial position and attachment at the start of a drag
53 // and informs the DockLayoutManager that a drag has started if necessary.
54 // |resizer| can be used to check if the resizer has been deleted during
55 // StartedDragging.
56 void StartedDragging(base::WeakPtr<DockedWindowResizer>& resizer);
57
58 // Informs the DockLayoutManager that the drag is complete if it was informed
59 // of the drag start. |move_result| specifies if the drag was completed or
60 // reverted.
61 void FinishedDragging(aura::client::WindowMoveResult move_result);
62
63 // Reparents dragged window as necessary to the docked container or back to
64 // workspace at the end of the drag. Calculates and returns action taken that
65 // can be reported in UMA stats. |is_resized| reports if the window is merely
66 // being resized rather than repositioned. |attached_panel| is necessary to
67 // avoid docking panels that have been attached to the launcher shelf at the
68 // end of the drag.
69 DockedAction MaybeReparentWindowOnDragCompletion(bool is_resized,
70 bool is_attached_panel);
71
72 gfx::Point last_location_;
73
74 // Wraps a window resizer and adds detaching / reattaching during drags.
75 std::unique_ptr<WindowResizer> next_window_resizer_;
76
77 // Dock container window.
78 DockedWindowLayoutManager* dock_layout_;
79 DockedWindowLayoutManager* initial_dock_layout_;
80
81 // Set to true once Drag() is invoked and the bounds of the window change.
82 bool did_move_or_resize_;
83
84 // Set to true if the window that is being dragged was docked before drag.
85 bool was_docked_;
86
87 // True if the dragged window is docked during the drag.
88 bool is_docked_;
89
90 // True if the dragged window had |bounds_changed_by_user| before the drag.
91 // Cleared whenever the target window gets dragged outside of the docked area.
92 bool was_bounds_changed_by_user_;
93
94 base::WeakPtrFactory<DockedWindowResizer> weak_ptr_factory_;
95
96 DISALLOW_COPY_AND_ASSIGN(DockedWindowResizer);
97 };
98
99 } // namespace ash
100
101 #endif // ASH_COMMON_WM_DOCK_DOCKED_WINDOW_RESIZER_H_
OLDNEW
« no previous file with comments | « ash/common/wm/dock/docked_window_layout_manager_observer.h ('k') | ash/common/wm/dock/docked_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698