| 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 if (!right && iter != windows.rend()) { | 88 if (!right && iter != windows.rend()) { |
| 89 right = *iter; | 89 right = *iter; |
| 90 iter++; | 90 iter++; |
| 91 if (right == left && iter != windows.rend()) { | 91 if (right == left && iter != windows.rend()) { |
| 92 right = *iter; | 92 right = *iter; |
| 93 iter++; | 93 iter++; |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 SetState(ACTIVE); | 97 SetState(ACTIVE); |
| 98 if (right_window_ != right) { | 98 right_window_ = right; |
| 99 right_window_ = right; | 99 left_window_ = left; |
| 100 // Since the |window_list_provider_| controls directly the order of windows, | |
| 101 // it needs to change the window order accordingly. | |
| 102 window_list_provider_->MoveToFront(right_window_); | |
| 103 } | |
| 104 if (left_window_ != left) { | |
| 105 left_window_ = left; | |
| 106 // Since the |window_list_provider_| controls directly the order of windows, | |
| 107 // it needs to change the window order accordingly. | |
| 108 window_list_provider_->MoveToFront(left_window_); | |
| 109 } | |
| 110 UpdateLayout(true); | 100 UpdateLayout(true); |
| 111 } | 101 } |
| 112 | 102 |
| 113 void SplitViewController::ReplaceWindow(aura::Window* window, | 103 void SplitViewController::ReplaceWindow(aura::Window* window, |
| 114 aura::Window* replace_with) { | 104 aura::Window* replace_with) { |
| 115 CHECK(IsSplitViewModeActive()); | 105 CHECK(IsSplitViewModeActive()); |
| 116 CHECK(replace_with); | 106 CHECK(replace_with); |
| 117 CHECK(window == left_window_ || window == right_window_); | 107 CHECK(window == left_window_ || window == right_window_); |
| 118 CHECK(replace_with != left_window_ && replace_with != right_window_); | 108 CHECK(replace_with != left_window_ && replace_with != right_window_); |
| 119 #if !defined(NDEBUG) | 109 #if !defined(NDEBUG) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 if (!wm::IsActiveWindow(left_window_)) | 162 if (!wm::IsActiveWindow(left_window_)) |
| 173 left_window_->Hide(); | 163 left_window_->Hide(); |
| 174 if (!wm::IsActiveWindow(right_window_)) | 164 if (!wm::IsActiveWindow(right_window_)) |
| 175 right_window_->Hide(); | 165 right_window_->Hide(); |
| 176 SetWindowTransforms(gfx::Transform(), gfx::Transform(), false); | 166 SetWindowTransforms(gfx::Transform(), gfx::Transform(), false); |
| 177 return; | 167 return; |
| 178 } | 168 } |
| 179 | 169 |
| 180 left_window_->Show(); | 170 left_window_->Show(); |
| 181 right_window_->Show(); | 171 right_window_->Show(); |
| 172 window_list_provider_->MoveToFront(right_window_); |
| 173 window_list_provider_->MoveToFront(left_window_); |
| 174 |
| 182 if (state_ == ACTIVE) { | 175 if (state_ == ACTIVE) { |
| 183 if (animate) { | 176 if (animate) { |
| 184 gfx::Transform left_transform = GetTargetTransformForBoundsAnimation( | 177 gfx::Transform left_transform = GetTargetTransformForBoundsAnimation( |
| 185 left_window_->bounds(), GetLeftTargetBounds()); | 178 left_window_->bounds(), GetLeftTargetBounds()); |
| 186 gfx::Transform right_transform = GetTargetTransformForBoundsAnimation( | 179 gfx::Transform right_transform = GetTargetTransformForBoundsAnimation( |
| 187 right_window_->bounds(), GetRightTargetBounds()); | 180 right_window_->bounds(), GetRightTargetBounds()); |
| 188 SetWindowTransforms(left_transform, right_transform, true); | 181 SetWindowTransforms(left_transform, right_transform, true); |
| 189 } else { | 182 } else { |
| 190 left_window_->SetBounds(GetLeftTargetBounds()); | 183 left_window_->SetBounds(GetLeftTargetBounds()); |
| 191 right_window_->SetBounds(GetRightTargetBounds()); | 184 right_window_->SetBounds(GetRightTargetBounds()); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 bool SplitViewController::CanScroll() { | 309 bool SplitViewController::CanScroll() { |
| 317 // TODO(mfomitchev): return false in full screen. | 310 // TODO(mfomitchev): return false in full screen. |
| 318 bool result = (!IsSplitViewModeActive() && | 311 bool result = (!IsSplitViewModeActive() && |
| 319 window_list_provider_->GetWindowList().size() >= 2 && | 312 window_list_provider_->GetWindowList().size() >= 2 && |
| 320 IsLandscapeOrientation(gfx::Screen::GetNativeScreen()-> | 313 IsLandscapeOrientation(gfx::Screen::GetNativeScreen()-> |
| 321 GetDisplayNearestWindow(container_).rotation())); | 314 GetDisplayNearestWindow(container_).rotation())); |
| 322 return result; | 315 return result; |
| 323 } | 316 } |
| 324 | 317 |
| 325 } // namespace athena | 318 } // namespace athena |
| OLD | NEW |