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/wm/bezel_controller.h" | 8 #include "athena/wm/bezel_controller.h" |
9 #include "athena/wm/public/window_manager_observer.h" | |
10 #include "athena/wm/window_overview_mode.h" | |
9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | |
13 | |
14 namespace gfx { | |
15 class Transform; | |
16 } | |
10 | 17 |
11 namespace athena { | 18 namespace athena { |
19 class WindowListProvider; | |
20 class WindowManager; | |
21 class WindowOverviewModeDelegate; | |
12 | 22 |
13 // Responsible for entering split view mode, exiting from split view mode, and | 23 // Responsible for entering split view mode, exiting from split view mode, and |
14 // laying out the windows in split view mode. | 24 // laying out the windows in split view mode. |
15 class SplitViewController : public BezelController::ScrollDelegate { | 25 class SplitViewController : public BezelController::ScrollDelegate, |
26 public WindowManagerObserver { | |
16 public: | 27 public: |
17 SplitViewController(); | 28 SplitViewController(aura::Window* container, |
29 WindowListProvider* window_list_provider, | |
30 WindowManager* window_manager); | |
31 | |
18 virtual ~SplitViewController(); | 32 virtual ~SplitViewController(); |
19 | 33 |
34 bool IsSplitViewModeActive() const; | |
35 | |
20 private: | 36 private: |
37 enum State { | |
38 // Split View mode is not active. |left_window_| and |right_window| are | |
39 // NULL. | |
40 INACTIVE, | |
41 // Two windows |left_window_| and |right_window| are shown side by side and | |
42 // there is a horizontal scroll in progress which is dragging the separator | |
43 // between the two windows. | |
44 SCROLLING, | |
45 // Split View mode is active with |left_window_| and |right_window| showing | |
46 // side by side each occupying half the screen. No scroll in progress. | |
47 ACTIVE | |
48 }; | |
49 | |
50 void UpdateLayout(bool animate); | |
51 | |
52 void SetWindowTransform(aura::Window* left_window, | |
53 const gfx::Transform& transform, | |
54 bool animate); | |
55 | |
56 void OnAnimationCompleted(aura::Window* window); | |
57 | |
58 void UpdateSeparatorPositionFromScrollDelta(float delta); | |
59 | |
60 // Returns the current activity shown to the user. Persists through the | |
61 // SCROLLING and ACTIVE states and gets updated if the current activity goes | |
62 // off screen when the user switches between activities. | |
63 aura::Window* GetCurrentActivityWindow(); | |
64 | |
21 // BezelController::ScrollDelegate overrides. | 65 // BezelController::ScrollDelegate overrides. |
22 virtual void ScrollBegin(BezelController::Bezel bezel, float delta) OVERRIDE; | 66 virtual void ScrollBegin(BezelController::Bezel bezel, float delta) OVERRIDE; |
23 virtual void ScrollEnd() OVERRIDE; | 67 virtual void ScrollEnd() OVERRIDE; |
24 virtual void ScrollUpdate(float delta) OVERRIDE; | 68 virtual void ScrollUpdate(float delta) OVERRIDE; |
25 virtual bool CanScroll() OVERRIDE; | 69 virtual bool CanScroll() OVERRIDE; |
26 | 70 |
71 // WindowManagerObserver | |
72 virtual void OnOverviewModeEnter() OVERRIDE; | |
73 virtual void OnOverviewModeExit() OVERRIDE; | |
74 | |
75 base::WeakPtrFactory<SplitViewController> weak_factory_; | |
sadrul
2014/08/09 13:32:40
This should be the last member variable. (see http
mfomitchev
2014/08/09 18:29:56
Done, good to know, thanks for pointing this out.
| |
76 | |
77 State state_; | |
78 | |
79 aura::Window* container_; | |
80 WindowManager* window_manager_; | |
81 // Provider of the list of windows to cycle through. Not owned. | |
82 WindowListProvider* window_list_provider_; | |
83 | |
84 // Keeps track of the current activity shown as the user switches between | |
85 // activities. Persists through the SCROLLING and ACTIVE states. Gets reset | |
86 // to NULL when overview mode is activated. | |
87 aura::Window* current_activity_window_; | |
88 | |
89 // Windows for the left and right activities shown in SCROLLING and ACTIVE | |
90 // states. In INACTIVE state these are NULL. | |
91 aura::Window* left_window_; | |
92 aura::Window* right_window_; | |
93 | |
94 // Position of the separator between left_window_ and right_window_ in | |
95 // container_ coordinates (along the x axis). | |
96 int separator_position_; | |
97 | |
27 DISALLOW_COPY_AND_ASSIGN(SplitViewController); | 98 DISALLOW_COPY_AND_ASSIGN(SplitViewController); |
28 }; | 99 }; |
29 | 100 |
30 } // namespace athena | 101 } // namespace athena |
31 | 102 |
32 #endif // ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ | 103 #endif // ATHENA_WM_SPLIT_VIEW_CONTROLLER_H_ |
OLD | NEW |