Commit dd6f8fa7 authored by pkotwicz@chromium.org's avatar pkotwicz@chromium.org

Exit overview mode when a new activity is opened in athena.

This has the side effect of fixing the crash in 396368

BUG=396368
TEST=Manual, see bug

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=285393

Review URL: https://codereview.chromium.org/411813002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285763 0039d316-1c4b-4281-b951-d872f2087c98
parent 65cc2345
...@@ -57,10 +57,6 @@ TEST_F(HomeCardTest, AppSelection) { ...@@ -57,10 +57,6 @@ TEST_F(HomeCardTest, AppSelection) {
athena::ActivityFactory::Get()->CreateWebActivity( athena::ActivityFactory::Get()->CreateWebActivity(
NULL, GURL("http://www.google.com/"))); NULL, GURL("http://www.google.com/")));
EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
// Overview mode has to finish before ending test, otherwise it crashes.
// TODO(mukai): fix this.
WindowManager::GetInstance()->ToggleOverview();
} }
TEST_F(HomeCardTest, Accelerators) { TEST_F(HomeCardTest, Accelerators) {
...@@ -84,10 +80,6 @@ TEST_F(HomeCardTest, Accelerators) { ...@@ -84,10 +80,6 @@ TEST_F(HomeCardTest, Accelerators) {
EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState());
generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN); generator.PressKey(ui::VKEY_L, ui::EF_CONTROL_DOWN);
EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState()); EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState());
// Overview mode has to finish before ending test, otherwise it crashes.
// TODO(mukai): fix this.
WindowManager::GetInstance()->ToggleOverview();
} }
} // namespace athena } // namespace athena
...@@ -39,6 +39,9 @@ class WindowManagerImpl : public WindowManager, ...@@ -39,6 +39,9 @@ class WindowManagerImpl : public WindowManager,
COMMAND_TOGGLE_OVERVIEW, COMMAND_TOGGLE_OVERVIEW,
}; };
// Sets whether overview mode is active.
void SetInOverview(bool active);
void InstallAccelerators(); void InstallAccelerators();
// WindowManager: // WindowManager:
...@@ -101,6 +104,7 @@ WindowManagerImpl::WindowManagerImpl() { ...@@ -101,6 +104,7 @@ WindowManagerImpl::WindowManagerImpl() {
} }
WindowManagerImpl::~WindowManagerImpl() { WindowManagerImpl::~WindowManagerImpl() {
overview_.reset();
if (container_) { if (container_) {
container_->RemoveObserver(this); container_->RemoveObserver(this);
container_->RemovePreTargetHandler(bezel_controller_.get()); container_->RemovePreTargetHandler(bezel_controller_.get());
...@@ -112,6 +116,7 @@ WindowManagerImpl::~WindowManagerImpl() { ...@@ -112,6 +116,7 @@ WindowManagerImpl::~WindowManagerImpl() {
void WindowManagerImpl::Layout() { void WindowManagerImpl::Layout() {
if (!container_) if (!container_)
return; return;
SetInOverview(false);
gfx::Rect bounds = gfx::Rect(container_->bounds().size()); gfx::Rect bounds = gfx::Rect(container_->bounds().size());
const aura::Window::Windows& children = container_->children(); const aura::Window::Windows& children = container_->children();
for (aura::Window::Windows::const_iterator iter = children.begin(); for (aura::Window::Windows::const_iterator iter = children.begin();
...@@ -124,14 +129,22 @@ void WindowManagerImpl::Layout() { ...@@ -124,14 +129,22 @@ void WindowManagerImpl::Layout() {
} }
void WindowManagerImpl::ToggleOverview() { void WindowManagerImpl::ToggleOverview() {
if (overview_) { SetInOverview(overview_.get() == NULL);
overview_.reset(); }
FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
OnOverviewModeExit()); void WindowManagerImpl::SetInOverview(bool active) {
} else { bool in_overview = !!overview_;
if (active == in_overview)
return;
if (active) {
overview_ = WindowOverviewMode::Create(container_.get(), this); overview_ = WindowOverviewMode::Create(container_.get(), this);
FOR_EACH_OBSERVER(WindowManagerObserver, observers_, FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
OnOverviewModeEnter()); OnOverviewModeEnter());
} else {
overview_.reset();
FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
OnOverviewModeExit());
} }
} }
...@@ -156,9 +169,7 @@ void WindowManagerImpl::OnSelectWindow(aura::Window* window) { ...@@ -156,9 +169,7 @@ void WindowManagerImpl::OnSelectWindow(aura::Window* window) {
CHECK_EQ(container_.get(), window->parent()); CHECK_EQ(container_.get(), window->parent());
container_->StackChildAtTop(window); container_->StackChildAtTop(window);
wm::ActivateWindow(window); wm::ActivateWindow(window);
overview_.reset(); SetInOverview(false);
FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
OnOverviewModeExit());
} }
void WindowManagerImpl::OnWindowDestroying(aura::Window* window) { void WindowManagerImpl::OnWindowDestroying(aura::Window* window) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment