| 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 UpdateLayout(true); |
| 103 } |
| 104 |
| 70 void SplitViewController::UpdateLayout(bool animate) { | 105 void SplitViewController::UpdateLayout(bool animate) { |
| 71 if (!left_window_) | 106 if (!left_window_) |
| 72 return; | 107 return; |
| 73 CHECK(right_window_); | 108 CHECK(right_window_); |
| 74 gfx::Transform left_transform; | 109 gfx::Transform left_transform; |
| 75 gfx::Transform right_transform; | 110 gfx::Transform right_transform; |
| 76 int container_width = container_->GetBoundsInScreen().width(); | 111 int container_width = container_->GetBoundsInScreen().width(); |
| 77 if (state_ == ACTIVE) { | 112 if (state_ == ACTIVE) { |
| 78 // This method should only be called once in ACTIVE state when | 113 // 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. | 114 // 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; | 302 state_ = INACTIVE; |
| 268 left_window_ = NULL; | 303 left_window_ = NULL; |
| 269 right_window_ = NULL; | 304 right_window_ = NULL; |
| 270 current_activity_window_ = NULL; | 305 current_activity_window_ = NULL; |
| 271 } | 306 } |
| 272 | 307 |
| 273 void SplitViewController::OnOverviewModeExit() { | 308 void SplitViewController::OnOverviewModeExit() { |
| 274 } | 309 } |
| 275 | 310 |
| 276 } // namespace athena | 311 } // namespace athena |
| OLD | NEW |