| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 right_window_ = right; | 78 right_window_ = right; |
| 79 container_->StackChildAtTop(right_window_); | 79 container_->StackChildAtTop(right_window_); |
| 80 } | 80 } |
| 81 if (left_window_ != left) { | 81 if (left_window_ != left) { |
| 82 left_window_ = left; | 82 left_window_ = left; |
| 83 container_->StackChildAtTop(left_window_); | 83 container_->StackChildAtTop(left_window_); |
| 84 } | 84 } |
| 85 UpdateLayout(true); | 85 UpdateLayout(true); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void SplitViewController::ReplaceWindow(aura::Window* window, |
| 89 aura::Window* replace_with) { |
| 90 CHECK(IsSplitViewModeActive()); |
| 91 CHECK(replace_with); |
| 92 CHECK(window == left_window_ || window == right_window_); |
| 93 CHECK(replace_with != left_window_ && replace_with != right_window_); |
| 94 #if !defined(NDEBUG) |
| 95 aura::Window::Windows windows = window_list_provider_->GetWindowList(); |
| 96 DCHECK(std::find(windows.begin(), windows.end(), replace_with) != |
| 97 windows.end()); |
| 98 #endif |
| 99 |
| 100 replace_with->SetBounds(window->bounds()); |
| 101 replace_with->SetTransform(gfx::Transform()); |
| 102 if (window == left_window_) |
| 103 left_window_ = replace_with; |
| 104 else |
| 105 right_window_ = replace_with; |
| 106 wm::ActivateWindow(replace_with); |
| 107 window->SetTransform(gfx::Transform()); |
| 108 } |
| 109 |
| 88 void SplitViewController::DeactivateSplitMode() { | 110 void SplitViewController::DeactivateSplitMode() { |
| 89 CHECK_NE(SCROLLING, state_); | 111 CHECK_NE(SCROLLING, state_); |
| 90 state_ = INACTIVE; | 112 state_ = INACTIVE; |
| 91 left_window_ = right_window_ = NULL; | 113 left_window_ = right_window_ = NULL; |
| 92 } | 114 } |
| 93 | 115 |
| 94 void SplitViewController::UpdateLayout(bool animate) { | 116 void SplitViewController::UpdateLayout(bool animate) { |
| 95 if (!left_window_) | 117 if (!left_window_) |
| 96 return; | 118 return; |
| 97 CHECK(right_window_); | 119 CHECK(right_window_); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 } | 264 } |
| 243 | 265 |
| 244 bool SplitViewController::CanScroll() { | 266 bool SplitViewController::CanScroll() { |
| 245 // TODO(mfomitchev): return false in vertical orientation, in full screen. | 267 // TODO(mfomitchev): return false in vertical orientation, in full screen. |
| 246 bool result = (!IsSplitViewModeActive() && | 268 bool result = (!IsSplitViewModeActive() && |
| 247 window_list_provider_->GetWindowList().size() >= 2); | 269 window_list_provider_->GetWindowList().size() >= 2); |
| 248 return result; | 270 return result; |
| 249 } | 271 } |
| 250 | 272 |
| 251 } // namespace athena | 273 } // namespace athena |
| OLD | NEW |