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/screen/public/screen_manager.h" | 9 #include "athena/screen/public/screen_manager.h" |
10 #include "athena/wm/public/window_list_provider.h" | 10 #include "athena/wm/public/window_list_provider.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 iter++; | 88 iter++; |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 to_hide_.clear(); | 92 to_hide_.clear(); |
93 if (left_window_ && left_window_ != left && left_window_ != right) | 93 if (left_window_ && left_window_ != left && left_window_ != right) |
94 to_hide_.push_back(left_window_); | 94 to_hide_.push_back(left_window_); |
95 if (right_window_ && right_window_ != left && right_window_ != right) | 95 if (right_window_ && right_window_ != left && right_window_ != right) |
96 to_hide_.push_back(right_window_); | 96 to_hide_.push_back(right_window_); |
97 | 97 |
98 SetState(ACTIVE); | |
99 right_window_ = right; | 98 right_window_ = right; |
100 left_window_ = left; | 99 left_window_ = left; |
100 | |
101 window_list_provider_->MoveToFront(right_window_); | |
102 window_list_provider_->MoveToFront(left_window_); | |
103 SetState(ACTIVE); | |
101 UpdateLayout(true); | 104 UpdateLayout(true); |
102 } | 105 } |
103 | 106 |
104 void SplitViewController::ReplaceWindow(aura::Window* window, | 107 void SplitViewController::ReplaceWindow(aura::Window* window, |
105 aura::Window* replace_with) { | 108 aura::Window* replace_with) { |
106 CHECK(IsSplitViewModeActive()); | 109 CHECK(IsSplitViewModeActive()); |
107 CHECK(replace_with); | 110 CHECK(replace_with); |
108 CHECK(window == left_window_ || window == right_window_); | 111 CHECK(window == left_window_ || window == right_window_); |
109 CHECK(replace_with != left_window_ && replace_with != right_window_); | 112 CHECK(replace_with != left_window_ && replace_with != right_window_); |
110 #if !defined(NDEBUG) | 113 #if !defined(NDEBUG) |
111 aura::Window::Windows windows = window_list_provider_->GetWindowList(); | 114 aura::Window::Windows windows = window_list_provider_->GetWindowList(); |
112 DCHECK(std::find(windows.begin(), windows.end(), replace_with) != | 115 DCHECK(std::find(windows.begin(), windows.end(), replace_with) != |
113 windows.end()); | 116 windows.end()); |
114 #endif | 117 #endif |
115 | 118 |
116 if (window == left_window_) | 119 if (window == left_window_) |
117 left_window_ = replace_with; | 120 left_window_ = replace_with; |
118 else | 121 else |
119 right_window_ = replace_with; | 122 right_window_ = replace_with; |
120 wm::ActivateWindow(replace_with); | 123 wm::ActivateWindow(replace_with); |
124 window_list_provider_->MoveToFront(right_window_); | |
125 window_list_provider_->MoveToFront(left_window_); | |
mfomitchev
2014/09/18 02:36:29
ActivateWindow already moves the window to front w
pkotwicz
2014/09/18 13:54:45
I have removed the call to wm::ActivateWindow(). T
mfomitchev
2014/09/18 18:11:52
We still use ActivateWindow in ScrollEnd - that's
| |
121 UpdateLayout(false); | 126 UpdateLayout(false); |
122 window->SetTransform(gfx::Transform()); | 127 window->SetTransform(gfx::Transform()); |
123 window->Hide(); | 128 window->Hide(); |
124 } | 129 } |
125 | 130 |
126 void SplitViewController::DeactivateSplitMode() { | 131 void SplitViewController::DeactivateSplitMode() { |
127 CHECK_EQ(ACTIVE, state_); | 132 CHECK_EQ(ACTIVE, state_); |
128 SetState(INACTIVE); | 133 SetState(INACTIVE); |
129 UpdateLayout(false); | 134 UpdateLayout(false); |
130 left_window_ = right_window_ = NULL; | 135 left_window_ = right_window_ = NULL; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 if (!wm::IsActiveWindow(left_window_)) | 168 if (!wm::IsActiveWindow(left_window_)) |
164 left_window_->Hide(); | 169 left_window_->Hide(); |
165 if (!wm::IsActiveWindow(right_window_)) | 170 if (!wm::IsActiveWindow(right_window_)) |
166 right_window_->Hide(); | 171 right_window_->Hide(); |
167 SetWindowTransforms(gfx::Transform(), gfx::Transform(), false); | 172 SetWindowTransforms(gfx::Transform(), gfx::Transform(), false); |
168 return; | 173 return; |
169 } | 174 } |
170 | 175 |
171 left_window_->Show(); | 176 left_window_->Show(); |
172 right_window_->Show(); | 177 right_window_->Show(); |
173 window_list_provider_->MoveToFront(right_window_); | |
174 window_list_provider_->MoveToFront(left_window_); | |
175 | 178 |
176 if (state_ == ACTIVE) { | 179 if (state_ == ACTIVE) { |
177 if (animate) { | 180 if (animate) { |
178 gfx::Transform left_transform = GetTargetTransformForBoundsAnimation( | 181 gfx::Transform left_transform = GetTargetTransformForBoundsAnimation( |
179 left_window_->bounds(), GetLeftTargetBounds()); | 182 left_window_->bounds(), GetLeftTargetBounds()); |
180 gfx::Transform right_transform = GetTargetTransformForBoundsAnimation( | 183 gfx::Transform right_transform = GetTargetTransformForBoundsAnimation( |
181 right_window_->bounds(), GetRightTargetBounds()); | 184 right_window_->bounds(), GetRightTargetBounds()); |
182 SetWindowTransforms(left_transform, right_transform, true); | 185 SetWindowTransforms(left_transform, right_transform, true); |
183 } else { | 186 } else { |
184 left_window_->SetBounds(GetLeftTargetBounds()); | 187 left_window_->SetBounds(GetLeftTargetBounds()); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
314 bool SplitViewController::CanScroll() { | 317 bool SplitViewController::CanScroll() { |
315 // TODO(mfomitchev): return false in full screen. | 318 // TODO(mfomitchev): return false in full screen. |
316 bool result = (!IsSplitViewModeActive() && | 319 bool result = (!IsSplitViewModeActive() && |
317 window_list_provider_->GetWindowList().size() >= 2 && | 320 window_list_provider_->GetWindowList().size() >= 2 && |
318 IsLandscapeOrientation(gfx::Screen::GetNativeScreen()-> | 321 IsLandscapeOrientation(gfx::Screen::GetNativeScreen()-> |
319 GetDisplayNearestWindow(container_).rotation())); | 322 GetDisplayNearestWindow(container_).rotation())); |
320 return result; | 323 return result; |
321 } | 324 } |
322 | 325 |
323 } // namespace athena | 326 } // namespace athena |
OLD | NEW |