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

Side by Side Diff: ui/aura_shell/stacking_controller.cc

Issue 8638013: [cros Aura] Added modal container for screen lock. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 9 years 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 | « ui/aura_shell/stacking_controller.h ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/aura_shell/stacking_controller.h" 5 #include "ui/aura_shell/stacking_controller.h"
6 6
7 #include "ui/aura/client/aura_constants.h" 7 #include "ui/aura/client/aura_constants.h"
8 #include "ui/aura/desktop.h" 8 #include "ui/aura/desktop.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/aura_shell/always_on_top_controller.h" 10 #include "ui/aura_shell/always_on_top_controller.h"
11 #include "ui/aura_shell/shell.h" 11 #include "ui/aura_shell/shell.h"
12 #include "ui/aura_shell/shell_window_ids.h" 12 #include "ui/aura_shell/shell_window_ids.h"
13 13
14 namespace aura_shell { 14 namespace aura_shell {
15 namespace internal { 15 namespace internal {
16 namespace { 16 namespace {
17 17
18 aura::Window* GetContainer(int id) { 18 aura::Window* GetContainer(int id) {
19 return Shell::GetInstance()->GetContainer(id); 19 return Shell::GetInstance()->GetContainer(id);
20 } 20 }
21 21
22 // Returns true if children of |window| can be activated. 22 // Returns true if children of |window| can be activated.
23 bool SupportsChildActivation(aura::Window* window) { 23 bool SupportsChildActivation(aura::Window* window) {
24 return window->id() == kShellWindowId_DefaultContainer || 24 return window->id() == kShellWindowId_DefaultContainer ||
25 window->id() == kShellWindowId_AlwaysOnTopContainer || 25 window->id() == kShellWindowId_AlwaysOnTopContainer ||
26 window->id() == kShellWindowId_ModalContainer; 26 window->id() == kShellWindowId_ModalContainer ||
27 window->id() == kShellWindowId_LockModalContainer;
27 } 28 }
28 29
29 bool IsWindowModal(aura::Window* window) { 30 bool IsWindowModal(aura::Window* window) {
30 return window->transient_parent() && window->GetIntProperty(aura::kModalKey); 31 return window->transient_parent() && window->GetIntProperty(aura::kModalKey);
31 } 32 }
32 33
33 } // namespace 34 } // namespace
34 35
35 //////////////////////////////////////////////////////////////////////////////// 36 ////////////////////////////////////////////////////////////////////////////////
36 // StackingController, public: 37 // StackingController, public:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 69
69 //////////////////////////////////////////////////////////////////////////////// 70 ////////////////////////////////////////////////////////////////////////////////
70 // StackingController, aura::StackingClient implementation: 71 // StackingController, aura::StackingClient implementation:
71 72
72 void StackingController::AddChildToDefaultParent(aura::Window* window) { 73 void StackingController::AddChildToDefaultParent(aura::Window* window) {
73 aura::Window* parent = NULL; 74 aura::Window* parent = NULL;
74 switch (window->type()) { 75 switch (window->type()) {
75 case aura::WINDOW_TYPE_NORMAL: 76 case aura::WINDOW_TYPE_NORMAL:
76 case aura::WINDOW_TYPE_POPUP: 77 case aura::WINDOW_TYPE_POPUP:
77 if (IsWindowModal(window)) { 78 if (IsWindowModal(window)) {
78 parent = GetContainer(internal::kShellWindowId_ModalContainer); 79 parent = GetModalContainer(window);
79 break; 80 break;
80 } 81 }
81 parent = always_on_top_controller_->GetContainer(window); 82 parent = always_on_top_controller_->GetContainer(window);
82 break; 83 break;
83 case aura::WINDOW_TYPE_MENU: 84 case aura::WINDOW_TYPE_MENU:
84 case aura::WINDOW_TYPE_TOOLTIP: 85 case aura::WINDOW_TYPE_TOOLTIP:
85 parent = GetContainer(internal::kShellWindowId_MenusAndTooltipsContainer); 86 parent = GetContainer(internal::kShellWindowId_MenusAndTooltipsContainer);
86 break; 87 break;
87 default: 88 default:
88 NOTREACHED() << "Window " << window->id() 89 NOTREACHED() << "Window " << window->id()
(...skipping 17 matching lines...) Expand all
106 if (*i != ignore && (*i)->CanActivate()) 107 if (*i != ignore && (*i)->CanActivate())
107 return *i; 108 return *i;
108 } 109 }
109 return NULL; 110 return NULL;
110 } 111 }
111 112
112 113
113 //////////////////////////////////////////////////////////////////////////////// 114 ////////////////////////////////////////////////////////////////////////////////
114 // StackingController, private: 115 // StackingController, private:
115 116
117 aura::Window* StackingController::GetModalContainer(
118 aura::Window* window) const {
119 if (!IsWindowModal(window))
120 return NULL;
121
122 // If screen lock is not active, all modal windows are placed into the
123 // normal modal container.
124 aura::Window* lock_container =
125 GetContainer(internal::kShellWindowId_LockScreenContainer);
126 if (!lock_container->children().size())
127 return GetContainer(internal::kShellWindowId_ModalContainer);
128
129 // Otherwise those that originate from LockScreen container and above are
130 // placed in the screen lock modal container.
131 int lock_container_id = lock_container->id();
132 int window_container_id = window->transient_parent()->parent()->id();
133
134 if (window_container_id < lock_container_id)
135 return GetContainer(internal::kShellWindowId_ModalContainer);
136 else
Ben Goodger (Google) 2011/11/29 16:42:26 nit: no else after return
Nikita (slow) 2011/11/29 17:12:32 Done.
137 return GetContainer(internal::kShellWindowId_LockModalContainer);
138 }
139
116 } // namespace internal 140 } // namespace internal
117 } // namespace aura_shell 141 } // namespace aura_shell
OLDNEW
« no previous file with comments | « ui/aura_shell/stacking_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698