summaryrefslogtreecommitdiff
path: root/chromium/ash/wm/dock/docked_window_layout_manager.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ash/wm/dock/docked_window_layout_manager.h')
-rw-r--r--chromium/ash/wm/dock/docked_window_layout_manager.h57
1 files changed, 12 insertions, 45 deletions
diff --git a/chromium/ash/wm/dock/docked_window_layout_manager.h b/chromium/ash/wm/dock/docked_window_layout_manager.h
index a3019aa7175..aa02b343423 100644
--- a/chromium/ash/wm/dock/docked_window_layout_manager.h
+++ b/chromium/ash/wm/dock/docked_window_layout_manager.h
@@ -50,9 +50,7 @@ class ShelfLayoutManager;
// its layout manager to this instance, e.g.:
// dock_container->SetLayoutManager(
// new DockedWindowLayoutManager(dock_container));
-//
-// TODO(varkha): extend BaseLayoutManager instead of LayoutManager to inherit
-// common functionality.
+
class ASH_EXPORT DockedWindowLayoutManager
: public aura::LayoutManager,
public ash::ShellObserver,
@@ -72,35 +70,26 @@ class ASH_EXPORT DockedWindowLayoutManager
virtual void RemoveObserver(DockedWindowLayoutManagerObserver* observer);
// Called by a DockedWindowResizer to update which window is being dragged.
- // Starts observing the window unless it is a child.
void StartDragging(aura::Window* window);
-
- // Called by a DockedWindowResizer when a dragged window is docked.
- void DockDraggedWindow(aura::Window* window);
-
- // Called by a DockedWindowResizer when a dragged window is no longer docked.
- void UndockDraggedWindow();
-
- // Called by a DockedWindowResizer when a window is no longer being dragged.
- // Stops observing the window unless it is a child.
void FinishDragging();
+ // Returns true if a window is touching the side of the screen except 2 cases:
+ // when some other windows are already docked on the other side or
+ // when launcher (shelf) is aligned on the same side.
+ static bool ShouldWindowDock(aura::Window* window,
+ const gfx::Point& location);
+
ash::Launcher* launcher() { return launcher_; }
void SetLauncher(ash::Launcher* launcher);
- // Calculates if a window is touching the screen edges and returns edge.
- DockedAlignment GetAlignmentOfWindow(const aura::Window* window) const;
-
// Used to snap docked windows to the side of screen during drag.
DockedAlignment CalculateAlignment() const;
- aura::Window* dock_container() const { return dock_container_; }
-
// Returns current bounding rectangle of docked windows area.
const gfx::Rect& docked_bounds() const { return docked_bounds_; }
- // Returns last known coordinates of |dragged_window_| after Relayout.
- const gfx::Rect dragged_bounds() const { return dragged_bounds_;}
+ // Currently dragged window should be able to dock on another screen
+ aura::Window* dragged_window() const { return dragged_window_;}
// aura::LayoutManager:
virtual void OnWindowResized() OVERRIDE;
@@ -154,14 +143,8 @@ class ASH_EXPORT DockedWindowLayoutManager
void MinimizeWindow(aura::Window* window);
void RestoreWindow(aura::Window* window);
- // Updates docked layout state when a window gets inside the dock.
- void OnWindowDocked(aura::Window* window);
-
- // Updates docked layout state when a window gets outside the dock.
- void OnWindowUndocked();
-
- // Returns true if there are any windows currently docked.
- bool IsAnyWindowDocked();
+ // Calculates if a window is touching the screen edges and returns edge.
+ DockedAlignment AlignmentOfWindow(const aura::Window* window) const;
// Called whenever the window layout might change.
void Relayout();
@@ -182,21 +165,8 @@ class ASH_EXPORT DockedWindowLayoutManager
aura::Window* dock_container_;
// Protect against recursive calls to Relayout().
bool in_layout_;
-
- // A window that is being dragged (whether docked or not).
- // Windows are tracked by docked layout manager only if they are docked;
- // however we need to know if a window is being dragged in order to avoid
- // positioning it or even considering it for layout.
+ // The docked window being dragged.
aura::Window* dragged_window_;
-
- // True if the window being dragged is currently docked.
- bool is_dragged_window_docked_;
-
- // Previously docked windows use a more relaxed dragging sorting algorithm
- // that uses assumption that a window starts being dragged out of position
- // that was previously established in Relayout. This allows easier reordering.
- bool is_dragged_from_dock_;
-
// The launcher we are observing for launcher icon changes.
Launcher* launcher_;
// The shelf layout manager being observed for visibility changes.
@@ -210,9 +180,6 @@ class ASH_EXPORT DockedWindowLayoutManager
// Last bounds that were sent to observers.
gfx::Rect docked_bounds_;
- // Target bounds of a docked window being dragged.
- gfx::Rect dragged_bounds_;
-
// Side of the screen that the dock is positioned at.
DockedAlignment alignment_;