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

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

Issue 11201002: Removes worskpace 1 code. Will rename next. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove constants and add back kDisableLoginAnimations Created 8 years, 2 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 | « ash/shell/window_watcher.cc ('k') | ash/wm/always_on_top_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/wm/property_util.h" 10 #include "ash/wm/property_util.h"
(...skipping 18 matching lines...) Expand all
29 29
30 // These are the list of container ids of containers which may contain windows 30 // These are the list of container ids of containers which may contain windows
31 // that need to be activated in the order that they should be activated. 31 // that need to be activated in the order that they should be activated.
32 const int kWindowContainerIds[] = { 32 const int kWindowContainerIds[] = {
33 kShellWindowId_LockSystemModalContainer, 33 kShellWindowId_LockSystemModalContainer,
34 kShellWindowId_SettingBubbleContainer, 34 kShellWindowId_SettingBubbleContainer,
35 kShellWindowId_LockScreenContainer, 35 kShellWindowId_LockScreenContainer,
36 kShellWindowId_SystemModalContainer, 36 kShellWindowId_SystemModalContainer,
37 kShellWindowId_AlwaysOnTopContainer, 37 kShellWindowId_AlwaysOnTopContainer,
38 kShellWindowId_AppListContainer, 38 kShellWindowId_AppListContainer,
39 // TODO(sky): defaultcontainer shouldn't be in the list with workspace2.
40 kShellWindowId_DefaultContainer, 39 kShellWindowId_DefaultContainer,
41 40
42 // Panel, launcher and status are intentionally checked after other 41 // Panel, launcher and status are intentionally checked after other
43 // containers even though these layers are higher. The user expects their 42 // containers even though these layers are higher. The user expects their
44 // windows to be focused before these elements. 43 // windows to be focused before these elements.
45 kShellWindowId_PanelContainer, 44 kShellWindowId_PanelContainer,
46 kShellWindowId_LauncherContainer, 45 kShellWindowId_LauncherContainer,
47 kShellWindowId_StatusContainer, 46 kShellWindowId_StatusContainer,
48 }; 47 };
49 48
50 // Returns true if children of |window| can be activated. 49 // Returns true if children of |window| can be activated.
51 // These are the only containers in which windows can receive focus. 50 // These are the only containers in which windows can receive focus.
52 bool SupportsChildActivation(aura::Window* window) { 51 bool SupportsChildActivation(aura::Window* window) {
53 // TODO(sky): straighten this out when workspace2 is the default.
54 // kShellWindowId_WorkspaceContainer isn't in |kWindowContainerIds| since it
55 // needs to be special cased in GetTopmostWindowToActivate().
56 if (window->id() == kShellWindowId_WorkspaceContainer) 52 if (window->id() == kShellWindowId_WorkspaceContainer)
57 return true; 53 return true;
58 54
59 for (size_t i = 0; i < arraysize(kWindowContainerIds); i++) { 55 for (size_t i = 0; i < arraysize(kWindowContainerIds); i++) {
60 if (window->id() == kWindowContainerIds[i] && 56 if (window->id() == kWindowContainerIds[i] &&
61 (window->id() != kShellWindowId_DefaultContainer || 57 window->id() != kShellWindowId_DefaultContainer) {
62 !WorkspaceController::IsWorkspace2Enabled())) {
63 return true; 58 return true;
64 } 59 }
65 } 60 }
66 return false; 61 return false;
67 } 62 }
68 63
69 bool HasModalTransientChild(aura::Window* window) { 64 bool HasModalTransientChild(aura::Window* window) {
70 aura::Window::Windows::const_iterator it; 65 aura::Window::Windows::const_iterator it;
71 for (it = window->transient_children().begin(); 66 for (it = window->transient_children().begin();
72 it != window->transient_children().end(); 67 it != window->transient_children().end();
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 window = GetTopmostWindowToActivateInContainer((*iter), ignore); 351 window = GetTopmostWindowToActivateInContainer((*iter), ignore);
357 } 352 }
358 } 353 }
359 return window; 354 return window;
360 } 355 }
361 356
362 aura::Window* ActivationController::GetTopmostWindowToActivateInContainer( 357 aura::Window* ActivationController::GetTopmostWindowToActivateInContainer(
363 aura::Window* container, 358 aura::Window* container,
364 aura::Window* ignore) const { 359 aura::Window* ignore) const {
365 // Workspace2 has an extra level of windows that needs to be special cased. 360 // Workspace2 has an extra level of windows that needs to be special cased.
366 if (container->id() == kShellWindowId_DefaultContainer && 361 if (container->id() == kShellWindowId_DefaultContainer) {
367 WorkspaceController::IsWorkspace2Enabled()) {
368 for (aura::Window::Windows::const_reverse_iterator i = 362 for (aura::Window::Windows::const_reverse_iterator i =
369 container->children().rbegin(); 363 container->children().rbegin();
370 i != container->children().rend(); ++i) { 364 i != container->children().rend(); ++i) {
371 if ((*i)->IsVisible()) { 365 if ((*i)->IsVisible()) {
372 aura::Window* window = GetTopmostWindowToActivateInContainer( 366 aura::Window* window = GetTopmostWindowToActivateInContainer(
373 *i, ignore); 367 *i, ignore);
374 if (window) 368 if (window)
375 return window; 369 return window;
376 } 370 }
377 } 371 }
378 return NULL; 372 return NULL;
379 } 373 }
380 for (aura::Window::Windows::const_reverse_iterator i = 374 for (aura::Window::Windows::const_reverse_iterator i =
381 container->children().rbegin(); 375 container->children().rbegin();
382 i != container->children().rend(); 376 i != container->children().rend();
383 ++i) { 377 ++i) {
384 if (*i != ignore && 378 if (*i != ignore &&
385 CanActivateWindowWithEvent(*i, NULL, CURRENT_VISIBILITY) && 379 CanActivateWindowWithEvent(*i, NULL, CURRENT_VISIBILITY) &&
386 !wm::IsWindowMinimized(*i)) 380 !wm::IsWindowMinimized(*i))
387 return *i; 381 return *i;
388 } 382 }
389 return NULL; 383 return NULL;
390 } 384 }
391 385
392 } // namespace internal 386 } // namespace internal
393 } // namespace ash 387 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell/window_watcher.cc ('k') | ash/wm/always_on_top_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698