OLD | NEW |
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 "ui/aura/desktop.h" | 8 #include "ui/aura/desktop.h" |
9 #include "ui/aura/screen_aura.h" | 9 #include "ui/aura/screen_aura.h" |
10 #include "ui/aura/toplevel_window_container.h" | 10 #include "ui/aura/toplevel_window_container.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 void Shell::ToggleOverview() { | 149 void Shell::ToggleOverview() { |
150 workspace_controller_->ToggleOverview(); | 150 workspace_controller_->ToggleOverview(); |
151 } | 151 } |
152 | 152 |
153 //////////////////////////////////////////////////////////////////////////////// | 153 //////////////////////////////////////////////////////////////////////////////// |
154 // Shell, aura::DesktopDelegate implementation: | 154 // Shell, aura::DesktopDelegate implementation: |
155 | 155 |
156 void Shell::AddChildToDefaultParent(aura::Window* window) { | 156 void Shell::AddChildToDefaultParent(aura::Window* window) { |
157 aura::Window* parent = NULL; | 157 aura::Window* parent = NULL; |
158 intptr_t type = reinterpret_cast<intptr_t>( | 158 switch (window->type()) { |
159 ui::ViewProp::GetValue(window, views::NativeWidgetAura::kWindowTypeKey)); | 159 case aura::WINDOW_TYPE_NORMAL: |
160 switch (static_cast<Widget::InitParams::Type>(type)) { | 160 case aura::WINDOW_TYPE_POPUP: |
161 case Widget::InitParams::TYPE_WINDOW: | |
162 case Widget::InitParams::TYPE_WINDOW_FRAMELESS: | |
163 case Widget::InitParams::TYPE_CONTROL: | |
164 case Widget::InitParams::TYPE_BUBBLE: | |
165 case Widget::InitParams::TYPE_POPUP: | |
166 parent = GetContainer(internal::kShellWindowId_DefaultContainer); | 161 parent = GetContainer(internal::kShellWindowId_DefaultContainer); |
167 break; | 162 break; |
168 case Widget::InitParams::TYPE_MENU: | 163 case aura::WINDOW_TYPE_MENU: |
169 case Widget::InitParams::TYPE_TOOLTIP: | 164 case aura::WINDOW_TYPE_TOOLTIP: |
170 parent = GetContainer(internal::kShellWindowId_MenusAndTooltipsContainer); | 165 parent = GetContainer(internal::kShellWindowId_MenusAndTooltipsContainer); |
171 break; | 166 break; |
172 default: | 167 default: |
173 // This will crash for controls, since they can't be parented to anything. | 168 NOTREACHED() << "Window " << window->id() |
| 169 << " has unhandled type " << window->type(); |
174 break; | 170 break; |
175 } | 171 } |
176 parent->AddChild(window); | 172 parent->AddChild(window); |
177 } | 173 } |
178 | 174 |
179 aura::Window* Shell::GetTopmostWindowToActivate(aura::Window* ignore) const { | 175 aura::Window* Shell::GetTopmostWindowToActivate(aura::Window* ignore) const { |
180 const aura::ToplevelWindowContainer* container = | 176 const aura::ToplevelWindowContainer* container = |
181 GetContainer(internal::kShellWindowId_DefaultContainer)-> | 177 GetContainer(internal::kShellWindowId_DefaultContainer)-> |
182 AsToplevelWindowContainer(); | 178 AsToplevelWindowContainer(); |
183 return container->GetTopmostWindowToActivate(ignore); | 179 return container->GetTopmostWindowToActivate(ignore); |
184 } | 180 } |
185 | 181 |
186 } // namespace aura_shell | 182 } // namespace aura_shell |
OLD | NEW |