Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2693)

Unified Diff: athena/wm/window_manager_impl.cc

Issue 546123002: Ensure that an activity is activated when overview mode is exited (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « athena/wm/window_manager_impl.h ('k') | athena/wm/window_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/wm/window_manager_impl.cc
diff --git a/athena/wm/window_manager_impl.cc b/athena/wm/window_manager_impl.cc
index 3b15cd3eeb9479fd7720292bbf1c5008e97afde4..ba052812cf75b1bb78ddca2af8e61d6bd741ac5c 100644
--- a/athena/wm/window_manager_impl.cc
+++ b/athena/wm/window_manager_impl.cc
@@ -14,6 +14,7 @@
#include "athena/wm/title_drag_controller.h"
#include "athena/wm/window_list_provider_impl.h"
#include "athena/wm/window_overview_mode.h"
+#include "base/auto_reset.h"
#include "base/bind.h"
#include "base/logging.h"
#include "ui/aura/layout_manager.h"
@@ -101,7 +102,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()) {
child->Show();
wm::ActivateWindow(child);
instance->split_view_controller_->ReplaceWindow(
@@ -111,6 +114,12 @@ 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->OnSelectWindow(child);
+ }
}
void AthenaContainerLayoutManager::OnWillRemoveWindowFromLayout(
@@ -133,7 +142,7 @@ void AthenaContainerLayoutManager::SetChildBounds(
SetChildBoundsDirect(child, requested_bounds);
}
-WindowManagerImpl::WindowManagerImpl() {
+WindowManagerImpl::WindowManagerImpl() : selecting_window_(false) {
ScreenManager::ContainerParams params("DefaultContainer", CP_DEFAULT);
params.can_activate_children = true;
container_.reset(ScreenManager::Get()->CreateDefaultContainer(params));
@@ -202,6 +211,13 @@ void WindowManagerImpl::SetInOverview(bool active) {
if (active == in_overview)
return;
+ if (!active && !selecting_window_) {
+ overview_->SelectDefaultWindow();
+ // If SelectDefaultWindow() did not select a window (e.g. there are no
+ // windows open), it should not be possible to exit overview.
+ return;
+ }
+
bezel_controller_->set_left_right_delegate(
active ? NULL : split_view_controller_.get());
if (active) {
@@ -245,12 +261,16 @@ void WindowManagerImpl::ToggleSplitViewForTest() {
}
void WindowManagerImpl::OnSelectWindow(aura::Window* window) {
+ base::AutoReset<bool> selecting_window(&selecting_window_, true);
+ SetInOverview(false);
+
+ window->Show();
+ wm::ActivateWindow(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 =
@@ -263,7 +283,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();
pkotwicz 2014/09/08 19:39:24 We do not want to abort the opacity animation star
ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
settings.SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
@@ -276,24 +295,18 @@ void WindowManagerImpl::OnSelectWindow(aura::Window* window) {
}
}
-void WindowManagerImpl::OnSplitViewMode(aura::Window* left,
- aura::Window* right) {
+void WindowManagerImpl::OnSelectSplitViewWindow(aura::Window* left,
+ aura::Window* right,
+ aura::Window* to_activate) {
+ base::AutoReset<bool> selecting_window(&selecting_window_, true);
SetInOverview(false);
+
+ to_activate->Show();
+ wm::ActivateWindow(to_activate);
FOR_EACH_OBSERVER(WindowManagerObserver, observers_, OnSplitViewModeEnter());
- if (right)
- wm::ActivateWindow(right);
- else
- wm::ActivateWindow(left);
split_view_controller_->ActivateSplitMode(left, right);
}
-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::OnWindowDestroying(aura::Window* window) {
if (window == container_)
container_.reset();
« no previous file with comments | « athena/wm/window_manager_impl.h ('k') | athena/wm/window_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698