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

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

Issue 8387043: [Aura] Support always-on-top top level window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync and address oshima's comments in patch 6 Created 9 years, 1 month 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/shell.h" 5 #include "ui/aura_shell/shell.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "ui/aura/aura_constants.h"
9 #include "ui/aura/aura_switches.h" 10 #include "ui/aura/aura_switches.h"
10 #include "ui/aura/desktop.h" 11 #include "ui/aura/desktop.h"
11 #include "ui/aura/screen_aura.h" 12 #include "ui/aura/screen_aura.h"
12 #include "ui/aura/toplevel_window_container.h" 13 #include "ui/aura/toplevel_window_container.h"
13 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
14 #include "ui/aura/window_types.h" 15 #include "ui/aura/window_types.h"
15 #include "ui/aura_shell/default_container_event_filter.h" 16 #include "ui/aura_shell/default_container_event_filter.h"
16 #include "ui/aura_shell/default_container_layout_manager.h" 17 #include "ui/aura_shell/default_container_layout_manager.h"
17 #include "ui/aura_shell/desktop_layout_manager.h" 18 #include "ui/aura_shell/desktop_layout_manager.h"
18 #include "ui/aura_shell/launcher/launcher.h" 19 #include "ui/aura_shell/launcher/launcher.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 76
76 //////////////////////////////////////////////////////////////////////////////// 77 ////////////////////////////////////////////////////////////////////////////////
77 // Shell, public: 78 // Shell, public:
78 79
79 Shell::Shell() 80 Shell::Shell()
80 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { 81 : ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
81 aura::Desktop::GetInstance()->SetDelegate(this); 82 aura::Desktop::GetInstance()->SetDelegate(this);
82 } 83 }
83 84
84 Shell::~Shell() { 85 Shell::~Shell() {
86 DCHECK(instance_ == this);
87 instance_ = NULL;
85 } 88 }
86 89
87 // static 90 // static
88 Shell* Shell::GetInstance() { 91 Shell* Shell::GetInstance() {
89 if (!instance_) { 92 if (!instance_) {
90 instance_ = new Shell; 93 instance_ = new Shell;
91 instance_->Init(); 94 instance_->Init();
92 } 95 }
93 return instance_; 96 return instance_;
94 } 97 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 168 }
166 169
167 //////////////////////////////////////////////////////////////////////////////// 170 ////////////////////////////////////////////////////////////////////////////////
168 // Shell, aura::DesktopDelegate implementation: 171 // Shell, aura::DesktopDelegate implementation:
169 172
170 void Shell::AddChildToDefaultParent(aura::Window* window) { 173 void Shell::AddChildToDefaultParent(aura::Window* window) {
171 aura::Window* parent = NULL; 174 aura::Window* parent = NULL;
172 switch (window->type()) { 175 switch (window->type()) {
173 case aura::WINDOW_TYPE_NORMAL: 176 case aura::WINDOW_TYPE_NORMAL:
174 case aura::WINDOW_TYPE_POPUP: 177 case aura::WINDOW_TYPE_POPUP:
175 parent = GetContainer(internal::kShellWindowId_DefaultContainer); 178 if (!!window->GetProperty(aura::kAlwaysOnTopKey))
179 parent = GetContainer(internal::kShellWindowId_AlwaysOnTopContainer);
180 else
181 parent = GetContainer(internal::kShellWindowId_DefaultContainer);
176 break; 182 break;
177 case aura::WINDOW_TYPE_MENU: 183 case aura::WINDOW_TYPE_MENU:
178 case aura::WINDOW_TYPE_TOOLTIP: 184 case aura::WINDOW_TYPE_TOOLTIP:
179 parent = GetContainer(internal::kShellWindowId_MenusAndTooltipsContainer); 185 parent = GetContainer(internal::kShellWindowId_MenusAndTooltipsContainer);
180 break; 186 break;
181 default: 187 default:
182 NOTREACHED() << "Window " << window->id() 188 NOTREACHED() << "Window " << window->id()
183 << " has unhandled type " << window->type(); 189 << " has unhandled type " << window->type();
184 break; 190 break;
185 } 191 }
186 parent->AddChild(window); 192 parent->AddChild(window);
187 } 193 }
188 194
189 aura::Window* Shell::GetTopmostWindowToActivate(aura::Window* ignore) const { 195 aura::Window* Shell::GetTopmostWindowToActivate(aura::Window* ignore) const {
190 const aura::ToplevelWindowContainer* container = 196 const aura::ToplevelWindowContainer* container =
191 GetContainer(internal::kShellWindowId_DefaultContainer)-> 197 GetContainer(internal::kShellWindowId_DefaultContainer)->
192 AsToplevelWindowContainer(); 198 AsToplevelWindowContainer();
193 return container->GetTopmostWindowToActivate(ignore); 199 return container->GetTopmostWindowToActivate(ignore);
194 } 200 }
195 201
196 } // namespace aura_shell 202 } // namespace aura_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698