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

Unified Diff: ash/wm/workspace/workspace_window_resizer.h

Issue 9467021: Attempt 3: Makes managed mode constrain the height of windows so they don't (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Da fix Created 8 years, 10 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/workspace/workspace_layout_manager.cc ('k') | ash/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace/workspace_window_resizer.h
diff --git a/ash/wm/workspace/workspace_window_resizer.h b/ash/wm/workspace/workspace_window_resizer.h
new file mode 100644
index 0000000000000000000000000000000000000000..d32b0be1e5571b39f67fc2f6e07fe580716e1cbd
--- /dev/null
+++ b/ash/wm/workspace/workspace_window_resizer.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2012 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_WORKSPACE_WINDOW_RESIZER_H_
+#define ASH_WM_WORKSPACE_WINDOW_RESIZER_H_
+#pragma once
+
+#include "ash/wm/window_resizer.h"
+#include "base/compiler_specific.h"
+
+namespace ash {
+namespace internal {
+
+// WindowResizer implementation for workspaces. This enforces that windows are
+// not allowed to vertically move or resize outside of the work area. As windows
+// are moved outside the work area they are shrunk. We remember the height of
+// the window before it was moved so that if the window is again moved up we
+// attempt to restore the old height.
+class ASH_EXPORT WorkspaceWindowResizer : public WindowResizer {
+ public:
+ WorkspaceWindowResizer(aura::Window* window,
+ const gfx::Point& location,
+ int window_component,
+ int grid_size);
+ virtual ~WorkspaceWindowResizer();
+
+ protected:
+ // WindowResizer overrides:
+ virtual gfx::Rect GetBoundsForDrag(const gfx::Point& location) OVERRIDE;
+ virtual gfx::Rect GetFinalBounds() OVERRIDE;
+
+ private:
+ // Used to maintain the height of the window before we started collapsing it.
+ static void SetHeightBeforeObscured(aura::Window* window, int height);
+ static void ClearHeightBeforeObscured(aura::Window* window);
+ static int GetHeightBeforeObscured(aura::Window* window);
+
+ // Adjusts the bounds to enforce that windows are vertically contained in the
+ // work area.
+ void AdjustBounds(gfx::Rect* bounds) const;
+
+ // Returns true if the window touches the bottom of the work area.
+ bool WindowTouchesBottomOfScreen() const;
+
+ DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer);
+};
+
+} // namespace internal
+} // namespace ash
+
+#endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.cc ('k') | ash/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698