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

Unified 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 (rebase) 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager_unittest.cc ('k') | ash/wm/dock/docked_window_resizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/dock/docked_window_resizer.h
diff --git a/ash/wm/dock/docked_window_resizer.h b/ash/wm/dock/docked_window_resizer.h
new file mode 100644
index 0000000000000000000000000000000000000000..e9a578de73b0c707e834323c085627d79784ad9c
--- /dev/null
+++ b/ash/wm/dock/docked_window_resizer.h
@@ -0,0 +1,85 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_
+#define ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_
+
+#include "ash/wm/window_resizer.h"
+#include "base/compiler_specific.h"
+
+namespace gfx {
+class Point;
+class Rect;
+}
+
+namespace aura {
+class RootWindow;
+}
+
+namespace ash {
+
+namespace internal {
+class DockedWindowLayoutManager;
+}
+
+// DockWindowResizer is used by ToplevelWindowEventFilter to handle dragging,
+// moving or resizing of a window while it is docked to the side of a screen.
+class ASH_EXPORT DockedWindowResizer : public WindowResizer {
+ public:
+ virtual ~DockedWindowResizer();
+
+ // Creates a new DockWindowResizer. The caller takes ownership of the
+ // returned object. The ownership of |next_window_resizer| is taken by the
+ // returned object. Returns NULL if not resizable.
+ static DockedWindowResizer* Create(WindowResizer* next_window_resizer,
+ aura::Window* window,
+ const gfx::Point& location,
+ int window_component,
+ aura::client::WindowMoveSource source);
+
+ // WindowResizer:
+ virtual void Drag(const gfx::Point& location, int event_flags) OVERRIDE;
+ virtual void CompleteDrag(int event_flags) OVERRIDE;
+ virtual void RevertDrag() OVERRIDE;
+ virtual aura::Window* GetTarget() OVERRIDE;
+ virtual const gfx::Point& GetInitialLocation() const OVERRIDE;
+
+ private:
+ // Creates DockWindowResizer that adds the ability to attach / detach
+ // windows to / from the dock. This object takes ownership of
+ // |next_window_resizer|.
+ DockedWindowResizer(WindowResizer* next_window_resizer,
+ const Details& details);
+
+ // Checks if the provided window bounds should snap to the side of a screen.
+ // If so the offset returned gives the necessary adjustment to snap.
+ void MaybeSnapToSide(const gfx::Rect& bounds, gfx::Point* offset);
+
+ // Tracks the window's initial position and attachment at the start of a drag
+ // and informs the DockLayoutManager that a drag has started if necessary.
+ void StartedDragging();
+
+ // Informs the DockLayoutManager that the drag is complete if it was informed
+ // of the drag start.
+ void FinishDragging();
+
+ const Details details_;
+
+ gfx::Point last_location_;
+
+ // Wraps a window resizer and adds detaching / reattaching during drags.
+ scoped_ptr<WindowResizer> next_window_resizer_;
+
+ // Dock container window.
+ internal::DockedWindowLayoutManager* dock_layout_;
+
+ // Set to true once Drag() is invoked and the bounds of the window change.
+ bool did_move_or_resize_;
+
+ DISALLOW_COPY_AND_ASSIGN(DockedWindowResizer);
+};
+
+} // namespace ash
+
+#endif // ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_
« no previous file with comments | « ash/wm/dock/docked_window_layout_manager_unittest.cc ('k') | ash/wm/dock/docked_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698