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. |
mfomitchev
2014/09/02 16:23:28
It looks like we call UpdateLayout(false), which d
pkotwicz
2014/09/02 17:54:35
Yup
Aside: It turns out that there are two caller
| |
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 |
43 void ReplaceWindow(aura::Window* window, | 41 void ReplaceWindow(aura::Window* window, |
mfomitchev
2014/09/02 16:23:28
Would be good to document that this does a layout
pkotwicz
2014/09/02 17:54:35
Done.
Perhaps this method should also update |win
| |
44 aura::Window* replace_with); | 42 aura::Window* replace_with); |
45 | 43 |
46 // Returns the bounds that the left and right windows will have once split | 44 // 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 | 45 // view is active and they are done animating. If |left_window_| and |
48 // |right_window_| are still animating this may be different than their | 46 // |right_window_| are still animating this may be different than their |
49 // current bounds. | 47 // current bounds. |
50 gfx::Rect GetLeftTargetBounds(); | 48 gfx::Rect GetLeftTargetBounds(); |
51 gfx::Rect GetRightTargetBounds(); | 49 gfx::Rect GetRightTargetBounds(); |
52 | 50 |
53 aura::Window* left_window() { return left_window_; } | 51 aura::Window* left_window() { return left_window_; } |
54 aura::Window* right_window() { return right_window_; } | 52 aura::Window* right_window() { return right_window_; } |
55 | 53 |
56 private: | 54 private: |
57 enum State { | 55 enum State { |
58 // Split View mode is not active. |left_window_| and |right_window| are | 56 // Split View mode is not active. |left_window_| and |right_window| are |
59 // NULL. | 57 // NULL. |
60 INACTIVE, | 58 INACTIVE, |
61 // Two windows |left_window_| and |right_window| are shown side by side and | 59 // 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 | 60 // there is a horizontal scroll in progress which is dragging the separator |
63 // between the two windows. | 61 // between the two windows. |
64 SCROLLING, | 62 SCROLLING, |
65 // Split View mode is active with |left_window_| and |right_window| showing | 63 // 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. | 64 // side by side each occupying half the screen. No scroll in progress. |
67 ACTIVE | 65 ACTIVE |
68 }; | 66 }; |
69 | 67 |
70 void UpdateLayout(bool animate); | 68 void UpdateLayout(bool animate); |
71 | 69 |
72 void SetWindowTransform(aura::Window* left_window, | 70 void SetWindowTransforms(const gfx::Transform& left_transform, |
73 const gfx::Transform& transform, | 71 const gfx::Transform& right_transform, |
74 bool animate); | 72 bool animate); |
75 | 73 |
76 void OnAnimationCompleted(aura::Window* window); | 74 // Called when the animation initiated by SetWindowTransforms() completes. |
75 void OnAnimationCompleted(); | |
77 | 76 |
78 void UpdateSeparatorPositionFromScrollDelta(float delta); | 77 void UpdateSeparatorPositionFromScrollDelta(float delta); |
79 | 78 |
80 // BezelController::ScrollDelegate: | 79 // BezelController::ScrollDelegate: |
81 virtual void ScrollBegin(BezelController::Bezel bezel, float delta) OVERRIDE; | 80 virtual void ScrollBegin(BezelController::Bezel bezel, float delta) OVERRIDE; |
82 virtual void ScrollEnd() OVERRIDE; | 81 virtual void ScrollEnd() OVERRIDE; |
83 virtual void ScrollUpdate(float delta) OVERRIDE; | 82 virtual void ScrollUpdate(float delta) OVERRIDE; |
84 virtual bool CanScroll() OVERRIDE; | 83 virtual bool CanScroll() OVERRIDE; |
85 | 84 |
86 State state_; | 85 State state_; |
(...skipping 13 matching lines...) Expand all Loading... | |
100 int separator_position_; | 99 int separator_position_; |
101 | 100 |
102 base::WeakPtrFactory<SplitViewController> weak_factory_; | 101 base::WeakPtrFactory<SplitViewController> weak_factory_; |
103 | 102 |
104 DISALLOW_COPY_AND_ASSIGN(SplitViewController); | 103 DISALLOW_COPY_AND_ASSIGN(SplitViewController); |
105 }; | 104 }; |
106 | 105 |
107 } // namespace athena | 106 } // namespace athena |
108 | 107 |
109 #endif // ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ | 108 #endif // ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ |
OLD | NEW |