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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 iter++; | 95 iter++; |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 state_ = ACTIVE; | 99 state_ = ACTIVE; |
100 left_window_ = left; | 100 left_window_ = left; |
101 right_window_ = right; | 101 right_window_ = right; |
102 UpdateLayout(true); | 102 UpdateLayout(true); |
103 } | 103 } |
104 | 104 |
105 void SplitViewController::ReplaceWindow(aura::Window* window, | |
106 aura::Window* replace_with) { | |
107 CHECK(IsSplitViewModeActive()); | |
108 CHECK(replace_with); | |
109 CHECK(window == left_window_ || window == right_window_); | |
110 CHECK(replace_with != left_window_ && replace_with != right_window_); | |
111 CHECK_EQ(container_, window->parent()); | |
mfomitchev
2014/08/14 14:38:13
might make more sense to check that windows belong
sadrul
2014/08/15 19:00:19
Done.
| |
112 CHECK_EQ(container_, replace_with->parent()); | |
113 | |
114 replace_with->SetBounds(window->bounds()); | |
115 replace_with->SetTransform(gfx::Transform()); | |
mfomitchev
2014/08/14 14:38:13
Any reason we wouldn't want to reset the bounds on
sadrul
2014/08/15 19:00:20
I added the change to reset the transform on |wind
mfomitchev
2014/08/15 19:15:03
Acknowledged.
| |
116 if (window == left_window_) | |
117 left_window_ = replace_with; | |
118 else | |
119 right_window_ = replace_with; | |
120 container_->StackChildAbove(replace_with, window); | |
mfomitchev
2014/08/14 14:38:13
I think we should use window_list_provider_->MoveT
sadrul
2014/08/15 19:00:20
Done (calling wm::ActivateWindow()).
| |
121 } | |
122 | |
105 void SplitViewController::UpdateLayout(bool animate) { | 123 void SplitViewController::UpdateLayout(bool animate) { |
106 if (!left_window_) | 124 if (!left_window_) |
107 return; | 125 return; |
108 CHECK(right_window_); | 126 CHECK(right_window_); |
109 gfx::Transform left_transform; | 127 gfx::Transform left_transform; |
110 gfx::Transform right_transform; | 128 gfx::Transform right_transform; |
111 int container_width = container_->GetBoundsInScreen().width(); | 129 int container_width = container_->GetBoundsInScreen().width(); |
112 if (state_ == ACTIVE) { | 130 if (state_ == ACTIVE) { |
113 // This method should only be called once in ACTIVE state when | 131 // This method should only be called once in ACTIVE state when |
114 // the left and rightwindows are still full screen and need to be resized. | 132 // 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... | |
302 state_ = INACTIVE; | 320 state_ = INACTIVE; |
303 left_window_ = NULL; | 321 left_window_ = NULL; |
304 right_window_ = NULL; | 322 right_window_ = NULL; |
305 current_activity_window_ = NULL; | 323 current_activity_window_ = NULL; |
306 } | 324 } |
307 | 325 |
308 void SplitViewController::OnOverviewModeExit() { | 326 void SplitViewController::OnOverviewModeExit() { |
309 } | 327 } |
310 | 328 |
311 } // namespace athena | 329 } // namespace athena |
OLD | NEW |