Chromium Code Reviews| Index: athena/wm/window_manager_impl.cc |
| diff --git a/athena/wm/window_manager_impl.cc b/athena/wm/window_manager_impl.cc |
| index bd93b2350cbca65bc48af2ab0addf40162dae5b7..aeeacf192cca2a6244bcab25150a0500ecfe2f46 100644 |
| --- a/athena/wm/window_manager_impl.cc |
| +++ b/athena/wm/window_manager_impl.cc |
| @@ -101,7 +101,9 @@ void AthenaContainerLayoutManager::OnWindowAddedToLayout(aura::Window* child) { |
| aura::Window::Windows list = instance->window_list_provider_->GetWindowList(); |
| if (std::find(list.begin(), list.end(), child) == list.end()) |
| return; |
| - if (instance->split_view_controller_->IsSplitViewModeActive()) { |
| + |
| + if (instance->split_view_controller_->IsSplitViewModeActive() && |
| + !instance->IsOverviewModeActive()) { |
|
pkotwicz
2014/09/07 01:57:24
Opening up new activities as full size when in ove
|
| instance->split_view_controller_->ReplaceWindow( |
| instance->split_view_controller_->left_window(), child); |
| } else { |
| @@ -109,6 +111,13 @@ void AthenaContainerLayoutManager::OnWindowAddedToLayout(aura::Window* child) { |
| gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().work_area().size(); |
| child->SetBounds(gfx::Rect(size)); |
| } |
| + |
| + if (instance->IsOverviewModeActive()) { |
| + // TODO(pkotwicz|oshima). Creating a new window should only exit overview |
| + // mode if the new window is activated. |
| + instance->ExitOverview(child, WindowOverviewModeDelegate::SPLIT_NONE); |
| + return; |
| + } |
| } |
| void AthenaContainerLayoutManager::OnWillRemoveWindowFromLayout( |
| @@ -167,67 +176,67 @@ WindowManagerImpl::~WindowManagerImpl() { |
| } |
| void WindowManagerImpl::ToggleOverview() { |
| - SetInOverview(overview_.get() == NULL); |
| + if (IsOverviewModeActive()) |
| + ExitOverview(); |
| + else |
| + EnterOverview(); |
| } |
| bool WindowManagerImpl::IsOverviewModeActive() { |
| return overview_; |
| } |
| -void WindowManagerImpl::SetInOverview(bool active) { |
| - bool in_overview = !!overview_; |
| - if (active == in_overview) |
| +void WindowManagerImpl::EnterOverview() { |
| + if (overview_) |
| return; |
| - bezel_controller_->set_left_right_delegate( |
| - active ? NULL : split_view_controller_.get()); |
| - if (active) { |
| - FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeEnter()); |
| - |
| - // Re-stack all windows in the order defined by window_list_provider_. |
| - aura::Window::Windows window_list = window_list_provider_->GetWindowList(); |
| - aura::Window::Windows::iterator it; |
| - for (it = window_list.begin(); it != window_list.end(); ++it) |
| - container_->StackChildAtTop(*it); |
| - overview_ = WindowOverviewMode::Create( |
| - container_.get(), window_list_provider_.get(), |
| - split_view_controller_.get(), this); |
| - } else { |
| - overview_.reset(); |
| - FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeExit()); |
| - } |
| -} |
| + FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeEnter()); |
| -void WindowManagerImpl::InstallAccelerators() { |
| - const AcceleratorData accelerator_data[] = { |
| - {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_NONE, CMD_TOGGLE_OVERVIEW, |
| - AF_NONE}, |
| - {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_CONTROL_DOWN, |
| - CMD_TOGGLE_SPLIT_VIEW, AF_NONE}, |
| - }; |
| - AcceleratorManager::Get()->RegisterAccelerators( |
| - accelerator_data, arraysize(accelerator_data), this); |
| -} |
| + bezel_controller_->set_left_right_delegate(NULL); |
| -void WindowManagerImpl::AddObserver(WindowManagerObserver* observer) { |
| - observers_.AddObserver(observer); |
| + // Re-stack all windows in the order defined by window_list_provider_. |
| + aura::Window::Windows window_list = window_list_provider_->GetWindowList(); |
| + aura::Window::Windows::iterator it; |
| + for (it = window_list.begin(); it != window_list.end(); ++it) |
| + container_->StackChildAtTop(*it); |
| + overview_ = WindowOverviewMode::Create( |
| + container_.get(), window_list_provider_.get(), |
| + split_view_controller_.get(), this); |
| } |
| -void WindowManagerImpl::RemoveObserver(WindowManagerObserver* observer) { |
| - observers_.RemoveObserver(observer); |
| -} |
| +void WindowManagerImpl::ExitOverview(aura::Window* window, |
| + SplitType split_type) { |
| + if (!overview_) |
| + return; |
| -void WindowManagerImpl::ToggleSplitViewForTest() { |
| - ToggleSplitview(); |
| -} |
| + overview_.reset(); |
| + FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnOverviewModeExit()); |
| + |
| + bezel_controller_->set_left_right_delegate(split_view_controller_.get()); |
| + |
| + if (!window) |
| + return; |
| + |
| + window->layer()->SetOpacity(1.0f); |
| + window->Show(); |
| + wm::ActivateWindow(window); |
| + |
| + if (split_type != SPLIT_NONE) { |
| + FOR_EACH_OBSERVER(WindowManagerObserver, |
| + observers_, |
| + OnSplitViewModeEnter()); |
| + if (split_type == SPLIT_LEFT) |
| + split_view_controller_->ActivateSplitMode(window, NULL); |
| + else |
| + split_view_controller_->ActivateSplitMode(NULL, window); |
| + return; |
| + } |
| -void WindowManagerImpl::OnSelectWindow(aura::Window* window) { |
| if (split_view_controller_->IsSplitViewModeActive()) { |
| split_view_controller_->DeactivateSplitMode(); |
| FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnSplitViewModeExit()); |
| } |
| - wm::ActivateWindow(window); |
| - SetInOverview(false); |
| + |
| // If |window| does not have the size of the work-area, then make sure it is |
| // resized. |
| const gfx::Size work_area = |
| @@ -240,7 +249,6 @@ void WindowManagerImpl::OnSelectWindow(aura::Window* window) { |
| desired_bounds.y() - window_bounds.y()); |
| transform.Scale(desired_bounds.width() / window_bounds.width(), |
| desired_bounds.height() / window_bounds.height()); |
| - window->layer()->GetAnimator()->AbortAllAnimations(); |
| ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); |
| settings.SetPreemptionStrategy( |
| ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| @@ -253,18 +261,37 @@ void WindowManagerImpl::OnSelectWindow(aura::Window* window) { |
| } |
| } |
| -void WindowManagerImpl::OnSplitViewMode(aura::Window* left, |
| - aura::Window* right) { |
| - SetInOverview(false); |
| - FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnSplitViewModeEnter()); |
| - split_view_controller_->ActivateSplitMode(left, right); |
| +void WindowManagerImpl::ExitOverview() { |
| + if (overview_) |
| + overview_->SelectDefaultWindow(); |
| +} |
| + |
| +void WindowManagerImpl::InstallAccelerators() { |
| + const AcceleratorData accelerator_data[] = { |
| + {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_NONE, CMD_TOGGLE_OVERVIEW, |
| + AF_NONE}, |
| + {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_CONTROL_DOWN, |
| + CMD_TOGGLE_SPLIT_VIEW, AF_NONE}, |
| + }; |
| + AcceleratorManager::Get()->RegisterAccelerators( |
| + accelerator_data, arraysize(accelerator_data), this); |
| +} |
| + |
| +void WindowManagerImpl::AddObserver(WindowManagerObserver* observer) { |
| + observers_.AddObserver(observer); |
| +} |
| + |
| +void WindowManagerImpl::RemoveObserver(WindowManagerObserver* observer) { |
| + observers_.RemoveObserver(observer); |
| +} |
| + |
| +void WindowManagerImpl::ToggleSplitViewForTest() { |
| + ToggleSplitview(); |
| } |
| -void WindowManagerImpl::OnWindowAdded(aura::Window* new_window) { |
| - // TODO(oshima): Creating a new window should updates the ovewview mode |
| - // instead of exitting. |
| - if (new_window->type() == ui::wm::WINDOW_TYPE_NORMAL) |
| - SetInOverview(false); |
| +void WindowManagerImpl::OnSelectWindow(aura::Window* window, |
| + SplitType split_type) { |
| + ExitOverview(window, split_type); |
| } |
| void WindowManagerImpl::OnWindowDestroying(aura::Window* window) { |