| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 96 } |
| 97 | 97 |
| 98 void Shell::Init() { | 98 void Shell::Init() { |
| 99 aura::Desktop* desktop_window = aura::Desktop::GetInstance(); | 99 aura::Desktop* desktop_window = aura::Desktop::GetInstance(); |
| 100 desktop_window->SetCursor(aura::kCursorPointer); | 100 desktop_window->SetCursor(aura::kCursorPointer); |
| 101 | 101 |
| 102 aura::Window::Windows containers; | 102 aura::Window::Windows containers; |
| 103 CreateSpecialContainers(&containers); | 103 CreateSpecialContainers(&containers); |
| 104 aura::Window::Windows::const_iterator i; | 104 aura::Window::Windows::const_iterator i; |
| 105 for (i = containers.begin(); i != containers.end(); ++i) { | 105 for (i = containers.begin(); i != containers.end(); ++i) { |
| 106 (*i)->Init(ui::Layer::LAYER_HAS_NO_TEXTURE); | 106 (*i)->Init(ui::Layer::LAYER_HAS_NO_TEXTURE, |
| 107 aura::Window::LAYER_INITIALLY_INVISIBLE); |
| 107 desktop_window->AddChild(*i); | 108 desktop_window->AddChild(*i); |
| 108 (*i)->Show(); | 109 (*i)->Show(); |
| 109 } | 110 } |
| 110 | 111 |
| 111 internal::DesktopLayoutManager* desktop_layout = | 112 internal::DesktopLayoutManager* desktop_layout = |
| 112 new internal::DesktopLayoutManager(desktop_window); | 113 new internal::DesktopLayoutManager(desktop_window); |
| 113 desktop_window->SetLayoutManager(desktop_layout); | 114 desktop_window->SetLayoutManager(desktop_layout); |
| 114 | 115 |
| 115 desktop_layout->set_background_widget(internal::CreateDesktopBackground()); | 116 desktop_layout->set_background_widget(internal::CreateDesktopBackground()); |
| 116 aura::ToplevelWindowContainer* toplevel_container = | 117 aura::ToplevelWindowContainer* toplevel_container = |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 152 |
| 152 void Shell::ToggleOverview() { | 153 void Shell::ToggleOverview() { |
| 153 workspace_manager_->SetOverview(!workspace_manager_->is_overview()); | 154 workspace_manager_->SetOverview(!workspace_manager_->is_overview()); |
| 154 } | 155 } |
| 155 | 156 |
| 156 //////////////////////////////////////////////////////////////////////////////// | 157 //////////////////////////////////////////////////////////////////////////////// |
| 157 // Shell, aura::DesktopDelegate implementation: | 158 // Shell, aura::DesktopDelegate implementation: |
| 158 | 159 |
| 159 void Shell::AddChildToDefaultParent(aura::Window* window) { | 160 void Shell::AddChildToDefaultParent(aura::Window* window) { |
| 160 aura::Window* parent = NULL; | 161 aura::Window* parent = NULL; |
| 161 intptr_t type = reinterpret_cast<intptr_t>( | 162 switch (window->type()) { |
| 162 ui::ViewProp::GetValue(window, views::NativeWidgetAura::kWindowTypeKey)); | 163 case aura::WINDOW_TYPE_NORMAL: |
| 163 switch (static_cast<Widget::InitParams::Type>(type)) { | 164 case aura::WINDOW_TYPE_POPUP: |
| 164 case Widget::InitParams::TYPE_WINDOW: | |
| 165 case Widget::InitParams::TYPE_WINDOW_FRAMELESS: | |
| 166 case Widget::InitParams::TYPE_CONTROL: | |
| 167 case Widget::InitParams::TYPE_BUBBLE: | |
| 168 case Widget::InitParams::TYPE_POPUP: | |
| 169 parent = GetContainer(internal::kShellWindowId_DefaultContainer); | 165 parent = GetContainer(internal::kShellWindowId_DefaultContainer); |
| 170 break; | 166 break; |
| 171 case Widget::InitParams::TYPE_MENU: | 167 case aura::WINDOW_TYPE_MENU: |
| 172 case Widget::InitParams::TYPE_TOOLTIP: | 168 case aura::WINDOW_TYPE_TOOLTIP: |
| 173 parent = GetContainer(internal::kShellWindowId_MenusAndTooltipsContainer); | 169 parent = GetContainer(internal::kShellWindowId_MenusAndTooltipsContainer); |
| 174 break; | 170 break; |
| 175 default: | 171 default: |
| 176 // This will crash for controls, since they can't be parented to anything. | 172 NOTREACHED() << "Window " << window->id() |
| 173 << " has unhandled type " << window->type(); |
| 177 break; | 174 break; |
| 178 } | 175 } |
| 179 parent->AddChild(window); | 176 parent->AddChild(window); |
| 180 } | 177 } |
| 181 | 178 |
| 182 aura::Window* Shell::GetTopmostWindowToActivate(aura::Window* ignore) const { | 179 aura::Window* Shell::GetTopmostWindowToActivate(aura::Window* ignore) const { |
| 183 const aura::ToplevelWindowContainer* container = | 180 const aura::ToplevelWindowContainer* container = |
| 184 GetContainer(internal::kShellWindowId_DefaultContainer)-> | 181 GetContainer(internal::kShellWindowId_DefaultContainer)-> |
| 185 AsToplevelWindowContainer(); | 182 AsToplevelWindowContainer(); |
| 186 return container->GetTopmostWindowToActivate(ignore); | 183 return container->GetTopmostWindowToActivate(ignore); |
| 187 } | 184 } |
| 188 | 185 |
| 189 } // namespace aura_shell | 186 } // namespace aura_shell |
| OLD | NEW |