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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 base::Bind(&SplitViewController::OnAnimationCompleted, | 156 base::Bind(&SplitViewController::OnAnimationCompleted, |
157 weak_factory_.GetWeakPtr(), | 157 weak_factory_.GetWeakPtr(), |
158 window))); | 158 window))); |
159 window->SetTransform(transform); | 159 window->SetTransform(transform); |
160 } else { | 160 } else { |
161 window->SetTransform(transform); | 161 window->SetTransform(transform); |
162 } | 162 } |
163 } | 163 } |
164 | 164 |
165 void SplitViewController::OnAnimationCompleted(aura::Window* window) { | 165 void SplitViewController::OnAnimationCompleted(aura::Window* window) { |
| 166 // Animation can be cancelled when deactivated. |
| 167 if (left_window_ == NULL) |
| 168 return; |
166 DCHECK(window == left_window_ || window == right_window_); | 169 DCHECK(window == left_window_ || window == right_window_); |
167 if (state_ == ACTIVE) { | 170 if (state_ == ACTIVE) { |
168 gfx::Rect window_bounds = gfx::Rect(container_->bounds().size()); | 171 gfx::Rect window_bounds = gfx::Rect(container_->bounds().size()); |
169 int container_width = window_bounds.width(); | 172 int container_width = window_bounds.width(); |
170 window_bounds.set_width(container_width / 2); | 173 window_bounds.set_width(container_width / 2); |
171 window->SetTransform(gfx::Transform()); | 174 window->SetTransform(gfx::Transform()); |
172 if (window == left_window_) { | 175 if (window == left_window_) { |
173 left_window_->SetBounds(window_bounds); | 176 left_window_->SetBounds(window_bounds); |
174 } else { | 177 } else { |
175 window_bounds.set_x(container_width / 2); | 178 window_bounds.set_x(container_width / 2); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 267 } |
265 | 268 |
266 bool SplitViewController::CanScroll() { | 269 bool SplitViewController::CanScroll() { |
267 // TODO(mfomitchev): return false in vertical orientation, in full screen. | 270 // TODO(mfomitchev): return false in vertical orientation, in full screen. |
268 bool result = (!IsSplitViewModeActive() && | 271 bool result = (!IsSplitViewModeActive() && |
269 window_list_provider_->GetWindowList().size() >= 2); | 272 window_list_provider_->GetWindowList().size() >= 2); |
270 return result; | 273 return result; |
271 } | 274 } |
272 | 275 |
273 } // namespace athena | 276 } // namespace athena |
OLD | NEW |