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

Side by Side Diff: ash/wm/activation_controller.cc

Issue 9570013: Activate the status area only when it's focused using the keyboard (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: uber tray support Created 8 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/wm/activation_controller.h" 5 #include "ash/wm/activation_controller.h"
6 6
7 #include "ash/ash_switches.h"
7 #include "ash/shell.h" 8 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
9 #include "ash/wm/window_modality_controller.h" 10 #include "ash/wm/window_modality_controller.h"
10 #include "ash/wm/window_util.h" 11 #include "ash/wm/window_util.h"
11 #include "base/auto_reset.h" 12 #include "base/auto_reset.h"
13 #include "base/command_line.h"
12 #include "ui/aura/client/activation_delegate.h" 14 #include "ui/aura/client/activation_delegate.h"
13 #include "ui/aura/client/aura_constants.h" 15 #include "ui/aura/client/aura_constants.h"
16 #include "ui/aura/client/window_types.h"
14 #include "ui/aura/env.h" 17 #include "ui/aura/env.h"
15 #include "ui/aura/root_window.h" 18 #include "ui/aura/root_window.h"
16 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
17 #include "ui/aura/window_delegate.h" 20 #include "ui/aura/window_delegate.h"
18 #include "ui/base/ui_base_types.h" 21 #include "ui/base/ui_base_types.h"
19 22
20 namespace ash { 23 namespace ash {
21 namespace internal { 24 namespace internal {
22 namespace { 25 namespace {
23 26
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // ActivationController, aura::RootWindowObserver implementation: 198 // ActivationController, aura::RootWindowObserver implementation:
196 199
197 void ActivationController::OnWindowFocused(aura::Window* window) { 200 void ActivationController::OnWindowFocused(aura::Window* window) {
198 ActivateWindow(GetActivatableWindow(window)); 201 ActivateWindow(GetActivatableWindow(window));
199 } 202 }
200 203
201 //////////////////////////////////////////////////////////////////////////////// 204 ////////////////////////////////////////////////////////////////////////////////
202 // ActivationController, private: 205 // ActivationController, private:
203 206
204 void ActivationController::ActivateNextWindow(aura::Window* window) { 207 void ActivationController::ActivateNextWindow(aura::Window* window) {
205 if (wm::IsActiveWindow(window)) 208 if (wm::IsActiveWindow(window) ||
209 // TODO(yusukes): Remove the code when uber tray becomes the default.
210 (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshUberTray) &&
211 window && window->type() == aura::client::WINDOW_TYPE_MENU)) {
sadrul 2012/03/02 10:17:01 I wonder if you can just use if (window && windo
Yusuke Sato 2012/03/02 11:51:09 To handle the uber tray here, I tried this: windo
206 ActivateWindow(GetTopmostWindowToActivate(window)); 212 ActivateWindow(GetTopmostWindowToActivate(window));
213 }
207 } 214 }
208 215
209 aura::Window* ActivationController::GetTopmostWindowToActivate( 216 aura::Window* ActivationController::GetTopmostWindowToActivate(
210 aura::Window* ignore) const { 217 aura::Window* ignore) const {
211 const aura::Window* container = 218 const aura::Window* container =
212 default_container_for_test_ ? default_container_for_test_ : 219 default_container_for_test_ ? default_container_for_test_ :
213 GetContainer(kShellWindowId_DefaultContainer); 220 GetContainer(kShellWindowId_DefaultContainer);
214 // When destructing an active window that is in a container destructed after 221 // When destructing an active window that is in a container destructed after
215 // the default container during shell shutdown, |container| would be NULL 222 // the default container during shell shutdown, |container| would be NULL
216 // because default container is destructed at this point. 223 // because default container is destructed at this point.
217 if (container) { 224 if (container) {
218 for (aura::Window::Windows::const_reverse_iterator i = 225 for (aura::Window::Windows::const_reverse_iterator i =
219 container->children().rbegin(); 226 container->children().rbegin();
220 i != container->children().rend(); 227 i != container->children().rend();
221 ++i) { 228 ++i) {
222 if (*i != ignore && CanActivateWindow(*i)) 229 if (*i != ignore && CanActivateWindow(*i))
223 return *i; 230 return *i;
224 } 231 }
225 } 232 }
226 return NULL; 233 return NULL;
227 } 234 }
228 235
229 } // namespace internal 236 } // namespace internal
230 } // namespace ash 237 } // namespace ash
OLDNEW
« ash/system/tray/system_tray.cc ('K') | « ash/system/tray/system_tray.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698