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

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

Issue 9027020: Bypass ToplevelWindowEventFilter for panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 12 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) 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/root_window.h" 8 #include "ui/aura/root_window.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 bool IsWindowModal(aura::Window* window) { 22 bool IsWindowModal(aura::Window* window) {
23 return window->transient_parent() && window->GetIntProperty(aura::kModalKey); 23 return window->transient_parent() && window->GetIntProperty(aura::kModalKey);
24 } 24 }
25 25
26 bool IsWindowPanel(aura::Window* window) {
27 return window->GetIntProperty(aura::kPanelKey);
28 }
29
26 } // namespace 30 } // namespace
27 31
28 //////////////////////////////////////////////////////////////////////////////// 32 ////////////////////////////////////////////////////////////////////////////////
29 // StackingController, public: 33 // StackingController, public:
30 34
31 StackingController::StackingController() { 35 StackingController::StackingController() {
32 aura::client::SetStackingClient(this); 36 aura::client::SetStackingClient(this);
33 always_on_top_controller_.reset(new internal::AlwaysOnTopController); 37 always_on_top_controller_.reset(new internal::AlwaysOnTopController);
34 always_on_top_controller_->SetContainers( 38 always_on_top_controller_->SetContainers(
35 GetContainer(internal::kShellWindowId_DefaultContainer), 39 GetContainer(internal::kShellWindowId_DefaultContainer),
36 GetContainer(internal::kShellWindowId_AlwaysOnTopContainer)); 40 GetContainer(internal::kShellWindowId_AlwaysOnTopContainer));
37 } 41 }
38 42
39 StackingController::~StackingController() { 43 StackingController::~StackingController() {
40 } 44 }
41 45
42 //////////////////////////////////////////////////////////////////////////////// 46 ////////////////////////////////////////////////////////////////////////////////
43 // StackingController, aura::StackingClient implementation: 47 // StackingController, aura::StackingClient implementation:
44 48
45 aura::Window* StackingController::GetDefaultParent(aura::Window* window) { 49 aura::Window* StackingController::GetDefaultParent(aura::Window* window) {
46 switch (window->type()) { 50 switch (window->type()) {
47 case aura::WINDOW_TYPE_NORMAL: 51 case aura::WINDOW_TYPE_NORMAL:
48 case aura::WINDOW_TYPE_POPUP: 52 case aura::WINDOW_TYPE_POPUP:
49 if (IsWindowModal(window)) 53 if (IsWindowModal(window))
50 return GetModalContainer(window); 54 return GetModalContainer(window);
51 return always_on_top_controller_->GetContainer(window); 55 else if (IsWindowPanel(window))
Ben Goodger (Google) 2011/12/22 23:22:45 nit: no else after return, here and below:
prasadt 2011/12/23 01:51:40 Done.
56 return GetContainer(internal::kShellWindowId_PanelContainer);
57 else
58 return always_on_top_controller_->GetContainer(window);
52 case aura::WINDOW_TYPE_MENU: 59 case aura::WINDOW_TYPE_MENU:
53 case aura::WINDOW_TYPE_TOOLTIP: 60 case aura::WINDOW_TYPE_TOOLTIP:
54 return GetContainer(internal::kShellWindowId_MenusAndTooltipsContainer); 61 return GetContainer(internal::kShellWindowId_MenusAndTooltipsContainer);
55 default: 62 default:
56 NOTREACHED() << "Window " << window->id() 63 NOTREACHED() << "Window " << window->id()
57 << " has unhandled type " << window->type(); 64 << " has unhandled type " << window->type();
58 break; 65 break;
59 } 66 }
60 return NULL; 67 return NULL;
61 } 68 }
(...skipping 22 matching lines...) Expand all
84 if (window_container_id < lock_container_id) 91 if (window_container_id < lock_container_id)
85 container = GetContainer(internal::kShellWindowId_ModalContainer); 92 container = GetContainer(internal::kShellWindowId_ModalContainer);
86 else 93 else
87 container = GetContainer(internal::kShellWindowId_LockModalContainer); 94 container = GetContainer(internal::kShellWindowId_LockModalContainer);
88 95
89 return container; 96 return container;
90 } 97 }
91 98
92 } // namespace internal 99 } // namespace internal
93 } // namespace aura_shell 100 } // namespace aura_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698