OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ | 5 #ifndef ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ |
6 #define ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ | 6 #define ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ |
7 | 7 |
8 #include "athena/athena_export.h" | 8 #include "athena/athena_export.h" |
9 #include "athena/wm/bezel_controller.h" | 9 #include "athena/wm/bezel_controller.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 virtual ~SplitViewController(); | 29 virtual ~SplitViewController(); |
30 | 30 |
31 bool IsSplitViewModeActive() const; | 31 bool IsSplitViewModeActive() const; |
32 | 32 |
33 // Activates split-view mode with |left| and |right| windows. If |left| and/or | 33 // Activates split-view mode with |left| and |right| windows. If |left| and/or |
34 // |right| is NULL, then the first window in the window-list (which is neither | 34 // |right| is NULL, then the first window in the window-list (which is neither |
35 // |left| nor |right|) is selected instead. | 35 // |left| nor |right|) is selected instead. |
36 void ActivateSplitMode(aura::Window* left, aura::Window* right); | 36 void ActivateSplitMode(aura::Window* left, aura::Window* right); |
37 | 37 |
38 // Resets the internal state to an inactive state. Calling this does not | 38 // Resets the internal state to an inactive state. |
39 // change the window bounds/transforms etc. The caller must take care of | |
40 // making any necessary changes. | |
41 void DeactivateSplitMode(); | 39 void DeactivateSplitMode(); |
42 | 40 |
| 41 // Replaces |window| in split-view mode with |replace_with|. Adjusts |
| 42 // |replace_with|'s visibility, transform and bounds. Resets |window|'s |
| 43 // visibility and transform but does not change its bounds. |
43 void ReplaceWindow(aura::Window* window, | 44 void ReplaceWindow(aura::Window* window, |
44 aura::Window* replace_with); | 45 aura::Window* replace_with); |
45 | 46 |
46 // Returns the bounds that the left and right windows will have once split | 47 // Returns the bounds that the left and right windows will have once split |
47 // view is active and they are done animating. If |left_window_| and | 48 // view is active and they are done animating. If |left_window_| and |
48 // |right_window_| are still animating this may be different than their | 49 // |right_window_| are still animating this may be different than their |
49 // current bounds. | 50 // current bounds. |
50 gfx::Rect GetLeftTargetBounds(); | 51 gfx::Rect GetLeftTargetBounds(); |
51 gfx::Rect GetRightTargetBounds(); | 52 gfx::Rect GetRightTargetBounds(); |
52 | 53 |
53 aura::Window* left_window() { return left_window_; } | 54 aura::Window* left_window() { return left_window_; } |
54 aura::Window* right_window() { return right_window_; } | 55 aura::Window* right_window() { return right_window_; } |
55 | 56 |
56 private: | 57 private: |
57 enum State { | 58 enum State { |
58 // Split View mode is not active. |left_window_| and |right_window| are | 59 // Split View mode is not active. |left_window_| and |right_window| are |
59 // NULL. | 60 // NULL. |
60 INACTIVE, | 61 INACTIVE, |
61 // Two windows |left_window_| and |right_window| are shown side by side and | 62 // Two windows |left_window_| and |right_window| are shown side by side and |
62 // there is a horizontal scroll in progress which is dragging the separator | 63 // there is a horizontal scroll in progress which is dragging the separator |
63 // between the two windows. | 64 // between the two windows. |
64 SCROLLING, | 65 SCROLLING, |
65 // Split View mode is active with |left_window_| and |right_window| showing | 66 // Split View mode is active with |left_window_| and |right_window| showing |
66 // side by side each occupying half the screen. No scroll in progress. | 67 // side by side each occupying half the screen. No scroll in progress. |
67 ACTIVE | 68 ACTIVE |
68 }; | 69 }; |
69 | 70 |
70 void UpdateLayout(bool animate); | 71 void UpdateLayout(bool animate); |
71 | 72 |
72 void SetWindowTransform(aura::Window* left_window, | 73 void SetWindowTransforms(const gfx::Transform& left_transform, |
73 const gfx::Transform& transform, | 74 const gfx::Transform& right_transform, |
74 bool animate); | 75 bool animate); |
75 | 76 |
76 void OnAnimationCompleted(aura::Window* window); | 77 // Called when the animation initiated by SetWindowTransforms() completes. |
| 78 void OnAnimationCompleted(); |
77 | 79 |
78 void UpdateSeparatorPositionFromScrollDelta(float delta); | 80 void UpdateSeparatorPositionFromScrollDelta(float delta); |
79 | 81 |
80 // BezelController::ScrollDelegate: | 82 // BezelController::ScrollDelegate: |
81 virtual void ScrollBegin(BezelController::Bezel bezel, float delta) OVERRIDE; | 83 virtual void ScrollBegin(BezelController::Bezel bezel, float delta) OVERRIDE; |
82 virtual void ScrollEnd() OVERRIDE; | 84 virtual void ScrollEnd() OVERRIDE; |
83 virtual void ScrollUpdate(float delta) OVERRIDE; | 85 virtual void ScrollUpdate(float delta) OVERRIDE; |
84 virtual bool CanScroll() OVERRIDE; | 86 virtual bool CanScroll() OVERRIDE; |
85 | 87 |
86 State state_; | 88 State state_; |
(...skipping 13 matching lines...) Expand all Loading... |
100 int separator_position_; | 102 int separator_position_; |
101 | 103 |
102 base::WeakPtrFactory<SplitViewController> weak_factory_; | 104 base::WeakPtrFactory<SplitViewController> weak_factory_; |
103 | 105 |
104 DISALLOW_COPY_AND_ASSIGN(SplitViewController); | 106 DISALLOW_COPY_AND_ASSIGN(SplitViewController); |
105 }; | 107 }; |
106 | 108 |
107 } // namespace athena | 109 } // namespace athena |
108 | 110 |
109 #endif // ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ | 111 #endif // ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ |
OLD | NEW |