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

Side by Side Diff: ash/wm/workspace/workspace_window_resizer.h

Issue 9455063: Makes windows scale slightly when dragging the caption. Also wired (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes tests Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/window_resizer.cc ('k') | ash/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ 5 #ifndef ASH_WM_WORKSPACE_WINDOW_RESIZER_H_
6 #define ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ 6 #define ASH_WM_WORKSPACE_WINDOW_RESIZER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "ash/wm/window_resizer.h" 9 #include "ash/wm/window_resizer.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 11
12 namespace ash { 12 namespace ash {
13 namespace internal { 13 namespace internal {
14 14
15 // WindowResizer implementation for workspaces. This enforces that windows are 15 // WindowResizer implementation for workspaces. This enforces that windows are
16 // not allowed to vertically move or resize outside of the work area. As windows 16 // not allowed to vertically move or resize outside of the work area. As windows
17 // are moved outside the work area they are shrunk. We remember the height of 17 // are moved outside the work area they are shrunk. We remember the height of
18 // the window before it was moved so that if the window is again moved up we 18 // the window before it was moved so that if the window is again moved up we
19 // attempt to restore the old height. 19 // attempt to restore the old height.
20 class ASH_EXPORT WorkspaceWindowResizer : public WindowResizer { 20 class ASH_EXPORT WorkspaceWindowResizer : public WindowResizer {
21 public: 21 public:
22 WorkspaceWindowResizer(aura::Window* window, 22 WorkspaceWindowResizer(aura::Window* window,
23 const gfx::Point& location, 23 const gfx::Point& location,
24 int window_component, 24 int window_component,
25 int grid_size); 25 int grid_size);
26 virtual ~WorkspaceWindowResizer(); 26 virtual ~WorkspaceWindowResizer();
27 27
28 // Sets whether windows should be scaled when dragging from the caption.
29 static void SetScaleWindowsForTest(bool value);
30
31 // WindowResizer overrides:
32 virtual void CompleteDrag() OVERRIDE;
33 virtual void RevertDrag() OVERRIDE;
34
28 protected: 35 protected:
29 // WindowResizer overrides: 36 // WindowResizer overrides:
30 virtual gfx::Rect GetBoundsForDrag(const gfx::Point& location) OVERRIDE; 37 virtual gfx::Rect GetBoundsForDrag(const gfx::Point& location) OVERRIDE;
31 virtual gfx::Rect GetFinalBounds() OVERRIDE; 38 virtual gfx::Rect GetFinalBounds() OVERRIDE;
32 39
33 private: 40 private:
34 // Used to maintain the height of the window before we started collapsing it. 41 // Used to maintain the height of the window before we started collapsing it.
35 static void SetHeightBeforeObscured(aura::Window* window, int height); 42 static void SetHeightBeforeObscured(aura::Window* window, int height);
36 static void ClearHeightBeforeObscured(aura::Window* window); 43 static void ClearHeightBeforeObscured(aura::Window* window);
37 static int GetHeightBeforeObscured(aura::Window* window); 44 static int GetHeightBeforeObscured(aura::Window* window);
38 45
39 // Adjusts the bounds to enforce that windows are vertically contained in the 46 // Adjusts the bounds to enforce that windows are vertically contained in the
40 // work area. 47 // work area.
41 void AdjustBounds(gfx::Rect* bounds) const; 48 void AdjustBounds(gfx::Rect* bounds) const;
42 49
43 // Returns true if the window touches the bottom of the work area. 50 // Returns true if the window touches the bottom of the work area.
44 bool WindowTouchesBottomOfScreen() const; 51 bool WindowTouchesBottomOfScreen() const;
45 52
53 // True if we scaled the window.
54 const bool scale_window_;
55
56 static bool scale_windows_;
57
46 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); 58 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer);
47 }; 59 };
48 60
49 } // namespace internal 61 } // namespace internal
50 } // namespace ash 62 } // namespace ash
51 63
52 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ 64 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_
OLDNEW
« no previous file with comments | « ash/wm/window_resizer.cc ('k') | ash/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698