Chromium Code Reviews| Index: athena/wm/split_view_controller.cc |
| diff --git a/athena/wm/split_view_controller.cc b/athena/wm/split_view_controller.cc |
| index 36ce6c230ddff40b9de3dfd9c1509125463b01b6..2ac83ce49a4ace3b07ead7a8fcc994d7b38ebadb 100644 |
| --- a/athena/wm/split_view_controller.cc |
| +++ b/athena/wm/split_view_controller.cc |
| @@ -18,6 +18,7 @@ |
| #include "ui/gfx/display.h" |
| #include "ui/gfx/screen.h" |
| #include "ui/wm/core/window_util.h" |
| +#include "ui/wm/public/activation_client.h" |
| namespace athena { |
| @@ -69,7 +70,8 @@ bool SplitViewController::IsSplitViewModeActive() const { |
| } |
| void SplitViewController::ActivateSplitMode(aura::Window* left, |
| - aura::Window* right) { |
| + aura::Window* right, |
| + aura::Window* to_activate) { |
| const aura::Window::Windows& windows = window_list_provider_->GetWindowList(); |
| aura::Window::Windows::const_reverse_iterator iter = windows.rbegin(); |
| if (state_ == ACTIVE) { |
| @@ -103,10 +105,25 @@ void SplitViewController::ActivateSplitMode(aura::Window* left, |
| if (right_window_ && right_window_ != left && right_window_ != right) |
| to_hide_.push_back(right_window_); |
| - SetState(ACTIVE); |
| - right_window_ = right; |
| left_window_ = left; |
| + right_window_ = right; |
| + |
| + SetState(ACTIVE); |
| UpdateLayout(true); |
| + |
| + if (to_activate) |
|
pkotwicz
2014/09/19 21:58:00
I am activating the window after calling UpdateLay
|
| + wm::ActivateWindow(to_activate); |
| + |
| + aura::client::ActivationClient* activation_client = |
| + aura::client::GetActivationClient(container_->GetRootWindow()); |
| + aura::Window* active_window = activation_client->GetActiveWindow(); |
| + |
| + if (active_window == left_window_) { |
| + window_list_provider_->StackWindowBehindTo(right_window_, left_window_); |
| + } else { |
| + DCHECK_EQ(active_window, right_window_); |
|
mfomitchev
2014/09/22 18:04:24
I'd actually make it into a CHECK for now so that
pkotwicz
2014/09/22 18:30:24
Done.
|
| + window_list_provider_->StackWindowBehindTo(left_window_, right_window_); |
| + } |
| } |
| void SplitViewController::ReplaceWindow(aura::Window* window, |
| @@ -117,12 +134,19 @@ void SplitViewController::ReplaceWindow(aura::Window* window, |
| CHECK(replace_with != left_window_ && replace_with != right_window_); |
| DCHECK(window_list_provider_->IsWindowInList(replace_with)); |
| - if (window == left_window_) |
| + aura::Window* not_replaced = NULL; |
| + if (window == left_window_) { |
| left_window_ = replace_with; |
| - else |
| + not_replaced = right_window_; |
| + } else { |
| right_window_ = replace_with; |
| - wm::ActivateWindow(replace_with); |
| + not_replaced = left_window_; |
| + } |
| UpdateLayout(false); |
| + |
| + wm::ActivateWindow(replace_with); |
| + window_list_provider_->StackWindowBehindTo(not_replaced, replace_with); |
| + |
| window->SetTransform(gfx::Transform()); |
| window->Hide(); |
| } |
| @@ -174,8 +198,6 @@ void SplitViewController::UpdateLayout(bool animate) { |
| left_window_->Show(); |
| right_window_->Show(); |
| - window_list_provider_->MoveToFront(right_window_); |
| - window_list_provider_->MoveToFront(left_window_); |
| if (state_ == ACTIVE) { |
| if (animate) { |