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

Side by Side Diff: trunk/src/athena/wm/window_manager_impl.cc

Issue 414133002: Revert 285393 "Exit overview mode when a new activity is opened ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/src/athena/home/home_card_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/public/window_manager.h" 5 #include "athena/wm/public/window_manager.h"
6 6
7 #include "athena/common/container_priorities.h" 7 #include "athena/common/container_priorities.h"
8 #include "athena/input/public/accelerator_manager.h" 8 #include "athena/input/public/accelerator_manager.h"
9 #include "athena/screen/public/screen_manager.h" 9 #include "athena/screen/public/screen_manager.h"
10 #include "athena/wm/bezel_controller.h" 10 #include "athena/wm/bezel_controller.h"
(...skipping 21 matching lines...) Expand all
32 void Layout(); 32 void Layout();
33 33
34 // WindowManager: 34 // WindowManager:
35 virtual void ToggleOverview() OVERRIDE; 35 virtual void ToggleOverview() OVERRIDE;
36 36
37 private: 37 private:
38 enum Command { 38 enum Command {
39 COMMAND_TOGGLE_OVERVIEW, 39 COMMAND_TOGGLE_OVERVIEW,
40 }; 40 };
41 41
42 // Sets whether overview mode is active.
43 void SetInOverview(bool active);
44
45 void InstallAccelerators(); 42 void InstallAccelerators();
46 43
47 // WindowManager: 44 // WindowManager:
48 virtual void AddObserver(WindowManagerObserver* observer) OVERRIDE; 45 virtual void AddObserver(WindowManagerObserver* observer) OVERRIDE;
49 virtual void RemoveObserver(WindowManagerObserver* observer) OVERRIDE; 46 virtual void RemoveObserver(WindowManagerObserver* observer) OVERRIDE;
50 47
51 // WindowOverviewModeDelegate: 48 // WindowOverviewModeDelegate:
52 virtual void OnSelectWindow(aura::Window* window) OVERRIDE; 49 virtual void OnSelectWindow(aura::Window* window) OVERRIDE;
53 50
54 // aura::WindowObserver 51 // aura::WindowObserver
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 container_->RemoveObserver(this); 105 container_->RemoveObserver(this);
109 container_->RemovePreTargetHandler(bezel_controller_.get()); 106 container_->RemovePreTargetHandler(bezel_controller_.get());
110 } 107 }
111 container_.reset(); 108 container_.reset();
112 instance = NULL; 109 instance = NULL;
113 } 110 }
114 111
115 void WindowManagerImpl::Layout() { 112 void WindowManagerImpl::Layout() {
116 if (!container_) 113 if (!container_)
117 return; 114 return;
118 SetInOverview(false);
119 gfx::Rect bounds = gfx::Rect(container_->bounds().size()); 115 gfx::Rect bounds = gfx::Rect(container_->bounds().size());
120 const aura::Window::Windows& children = container_->children(); 116 const aura::Window::Windows& children = container_->children();
121 for (aura::Window::Windows::const_iterator iter = children.begin(); 117 for (aura::Window::Windows::const_iterator iter = children.begin();
122 iter != children.end(); 118 iter != children.end();
123 ++iter) { 119 ++iter) {
124 if ((*iter)->type() == ui::wm::WINDOW_TYPE_NORMAL || 120 if ((*iter)->type() == ui::wm::WINDOW_TYPE_NORMAL ||
125 (*iter)->type() == ui::wm::WINDOW_TYPE_POPUP) 121 (*iter)->type() == ui::wm::WINDOW_TYPE_POPUP)
126 (*iter)->SetBounds(bounds); 122 (*iter)->SetBounds(bounds);
127 } 123 }
128 } 124 }
129 125
130 void WindowManagerImpl::ToggleOverview() { 126 void WindowManagerImpl::ToggleOverview() {
131 SetInOverview(overview_.get() == NULL); 127 if (overview_) {
132 } 128 overview_.reset();
133 129 FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
134 void WindowManagerImpl::SetInOverview(bool active) { 130 OnOverviewModeExit());
135 bool in_overview = !!overview_; 131 } else {
136 if (active == in_overview)
137 return;
138
139 if (active) {
140 overview_ = WindowOverviewMode::Create(container_.get(), this); 132 overview_ = WindowOverviewMode::Create(container_.get(), this);
141 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, 133 FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
142 OnOverviewModeEnter()); 134 OnOverviewModeEnter());
143 } else {
144 overview_.reset();
145 FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
146 OnOverviewModeExit());
147 } 135 }
148 } 136 }
149 137
150 void WindowManagerImpl::InstallAccelerators() { 138 void WindowManagerImpl::InstallAccelerators() {
151 const AcceleratorData accelerator_data[] = { 139 const AcceleratorData accelerator_data[] = {
152 {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_NONE, COMMAND_TOGGLE_OVERVIEW, 140 {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_NONE, COMMAND_TOGGLE_OVERVIEW,
153 AF_NONE}, 141 AF_NONE},
154 }; 142 };
155 AcceleratorManager::Get()->RegisterAccelerators( 143 AcceleratorManager::Get()->RegisterAccelerators(
156 accelerator_data, arraysize(accelerator_data), this); 144 accelerator_data, arraysize(accelerator_data), this);
157 } 145 }
158 146
159 void WindowManagerImpl::AddObserver(WindowManagerObserver* observer) { 147 void WindowManagerImpl::AddObserver(WindowManagerObserver* observer) {
160 observers_.AddObserver(observer); 148 observers_.AddObserver(observer);
161 } 149 }
162 150
163 void WindowManagerImpl::RemoveObserver(WindowManagerObserver* observer) { 151 void WindowManagerImpl::RemoveObserver(WindowManagerObserver* observer) {
164 observers_.RemoveObserver(observer); 152 observers_.RemoveObserver(observer);
165 } 153 }
166 154
167 void WindowManagerImpl::OnSelectWindow(aura::Window* window) { 155 void WindowManagerImpl::OnSelectWindow(aura::Window* window) {
168 CHECK_EQ(container_.get(), window->parent()); 156 CHECK_EQ(container_.get(), window->parent());
169 container_->StackChildAtTop(window); 157 container_->StackChildAtTop(window);
170 wm::ActivateWindow(window); 158 wm::ActivateWindow(window);
171 SetInOverview(false); 159 overview_.reset();
160 FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
161 OnOverviewModeExit());
172 } 162 }
173 163
174 void WindowManagerImpl::OnWindowDestroying(aura::Window* window) { 164 void WindowManagerImpl::OnWindowDestroying(aura::Window* window) {
175 if (window == container_) 165 if (window == container_)
176 container_.reset(); 166 container_.reset();
177 } 167 }
178 168
179 bool WindowManagerImpl::IsCommandEnabled(int command_id) const { 169 bool WindowManagerImpl::IsCommandEnabled(int command_id) const {
180 return true; 170 return true;
181 } 171 }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 DCHECK(!instance); 233 DCHECK(!instance);
244 } 234 }
245 235
246 // static 236 // static
247 WindowManager* WindowManager::GetInstance() { 237 WindowManager* WindowManager::GetInstance() {
248 DCHECK(instance); 238 DCHECK(instance);
249 return instance; 239 return instance;
250 } 240 }
251 241
252 } // namespace athena 242 } // namespace athena
OLDNEW
« no previous file with comments | « trunk/src/athena/home/home_card_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698