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 #include "athena/wm/split_view_controller.h" | 5 #include "athena/wm/split_view_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "athena/wm/public/window_list_provider.h" | 9 #include "athena/wm/public/window_list_provider.h" |
10 #include "athena/wm/public/window_manager.h" | 10 #include "athena/wm/public/window_manager.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 } | 60 } |
61 | 61 |
62 SplitViewController::~SplitViewController() { | 62 SplitViewController::~SplitViewController() { |
63 window_manager_->RemoveObserver(this); | 63 window_manager_->RemoveObserver(this); |
64 } | 64 } |
65 | 65 |
66 bool SplitViewController::IsSplitViewModeActive() const { | 66 bool SplitViewController::IsSplitViewModeActive() const { |
67 return state_ == ACTIVE; | 67 return state_ == ACTIVE; |
68 } | 68 } |
69 | 69 |
70 void SplitViewController::ActivateSplitMode(aura::Window* left, | |
71 aura::Window* right) { | |
72 aura::Window::Windows windows = window_list_provider_->GetWindowList(); | |
73 aura::Window::Windows::reverse_iterator iter = windows.rbegin(); | |
74 if (state_ == ACTIVE) { | |
75 if (!left) | |
76 left = left_window_; | |
77 if (!right) | |
78 right = right_window_; | |
79 } | |
80 | |
81 if (!left && iter != windows.rend()) { | |
82 left = *iter; | |
83 iter++; | |
84 if (left == right && iter != windows.rend()) { | |
85 left = *iter; | |
86 iter++; | |
87 } | |
88 } | |
89 | |
90 if (!right && iter != windows.rend()) { | |
91 right = *iter; | |
92 iter++; | |
93 if (right == left && iter != windows.rend()) { | |
94 right = *iter; | |
95 iter++; | |
96 } | |
97 } | |
98 | |
99 state_ = ACTIVE; | |
100 left_window_ = left; | |
101 right_window_ = right; | |
102 container_->StackChildAtTop(right_window_); | |
103 container_->StackChildAtTop(left_window_); | |
sadrul
2014/08/13 19:25:29
This is necessary to make sure that the two select
mfomitchev
2014/08/13 19:27:44
Acknowledged.
| |
104 UpdateLayout(true); | |
105 } | |
106 | |
70 void SplitViewController::UpdateLayout(bool animate) { | 107 void SplitViewController::UpdateLayout(bool animate) { |
71 if (!left_window_) | 108 if (!left_window_) |
72 return; | 109 return; |
73 CHECK(right_window_); | 110 CHECK(right_window_); |
74 gfx::Transform left_transform; | 111 gfx::Transform left_transform; |
75 gfx::Transform right_transform; | 112 gfx::Transform right_transform; |
76 int container_width = container_->GetBoundsInScreen().width(); | 113 int container_width = container_->GetBoundsInScreen().width(); |
77 if (state_ == ACTIVE) { | 114 if (state_ == ACTIVE) { |
78 // This method should only be called once in ACTIVE state when | 115 // This method should only be called once in ACTIVE state when |
79 // the left and rightwindows are still full screen and need to be resized. | 116 // the left and rightwindows are still full screen and need to be resized. |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
267 state_ = INACTIVE; | 304 state_ = INACTIVE; |
268 left_window_ = NULL; | 305 left_window_ = NULL; |
269 right_window_ = NULL; | 306 right_window_ = NULL; |
270 current_activity_window_ = NULL; | 307 current_activity_window_ = NULL; |
271 } | 308 } |
272 | 309 |
273 void SplitViewController::OnOverviewModeExit() { | 310 void SplitViewController::OnOverviewModeExit() { |
274 } | 311 } |
275 | 312 |
276 } // namespace athena | 313 } // namespace athena |
OLD | NEW |