| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/aura/desktop.h" | |
| 6 #include "ui/aura/toplevel_window_container.h" | |
| 7 #include "ui/aura/window.h" | |
| 8 #include "ui/aura_shell/desktop_layout_manager.h" | |
| 9 #include "ui/aura_shell/launcher/launcher_model.h" | |
| 10 #include "ui/aura_shell/shell.h" | |
| 11 #include "ui/aura_shell/shell_factory.h" | |
| 12 #include "ui/aura_shell/shell_window_ids.h" | |
| 13 #include "views/widget/widget.h" | |
| 14 | |
| 15 namespace aura_shell { | |
| 16 | |
| 17 // Creates each of the special window containers that holds windows of various | |
| 18 // types in the shell UI. They are added to |containers| from back to front in | |
| 19 // the z-index. | |
| 20 void CreateSpecialContainers(aura::Window::Windows* containers) { | |
| 21 aura::Window* background_container = new aura::Window(NULL); | |
| 22 background_container->set_id( | |
| 23 internal::kShellWindowId_DesktopBackgroundContainer); | |
| 24 containers->push_back(background_container); | |
| 25 | |
| 26 aura::Window* default_container = new aura::ToplevelWindowContainer; | |
| 27 default_container->set_id(internal::kShellWindowId_DefaultContainer); | |
| 28 containers->push_back(default_container); | |
| 29 | |
| 30 aura::Window* always_on_top_container = new aura::ToplevelWindowContainer; | |
| 31 always_on_top_container->set_id( | |
| 32 internal::kShellWindowId_AlwaysOnTopContainer); | |
| 33 containers->push_back(always_on_top_container); | |
| 34 | |
| 35 aura::Window* launcher_container = new aura::Window(NULL); | |
| 36 launcher_container->set_id(internal::kShellWindowId_LauncherContainer); | |
| 37 containers->push_back(launcher_container); | |
| 38 | |
| 39 aura::Window* lock_container = new aura::Window(NULL); | |
| 40 lock_container->set_stops_event_propagation(true); | |
| 41 lock_container->set_id(internal::kShellWindowId_LockScreenContainer); | |
| 42 containers->push_back(lock_container); | |
| 43 | |
| 44 aura::Window* status_container = new aura::Window(NULL); | |
| 45 status_container->set_id(internal::kShellWindowId_StatusContainer); | |
| 46 containers->push_back(status_container); | |
| 47 } | |
| 48 | |
| 49 void InitDesktopWindow() { | |
| 50 aura::Window::Windows containers; | |
| 51 CreateSpecialContainers(&containers); | |
| 52 aura::Window::Windows::const_iterator i; | |
| 53 for (i = containers.begin(); i != containers.end(); ++i) { | |
| 54 (*i)->Init(); | |
| 55 aura::Desktop::GetInstance()->window()->AddChild(*i); | |
| 56 (*i)->Show(); | |
| 57 } | |
| 58 | |
| 59 aura::Window* root_window = aura::Desktop::GetInstance()->window(); | |
| 60 internal::DesktopLayoutManager* desktop_layout = | |
| 61 new internal::DesktopLayoutManager(root_window); | |
| 62 root_window->SetLayoutManager(desktop_layout); | |
| 63 | |
| 64 Shell* shell = Shell::GetInstance(); | |
| 65 views::Widget* desktop_background = internal::CreateDesktopBackground(); | |
| 66 shell->GetContainer( | |
| 67 internal::kShellWindowId_DesktopBackgroundContainer)->AddChild( | |
| 68 desktop_background->GetNativeView()); | |
| 69 | |
| 70 // TODO: this leaks. | |
| 71 views::Widget* launcher = internal::CreateLauncher(new LauncherModel); | |
| 72 shell->GetContainer(internal::kShellWindowId_LauncherContainer)->AddChild( | |
| 73 launcher->GetNativeView()); | |
| 74 | |
| 75 views::Widget* status_area = internal::CreateStatusArea(); | |
| 76 shell->GetContainer(internal::kShellWindowId_StatusContainer)->AddChild( | |
| 77 status_area->GetNativeView()); | |
| 78 | |
| 79 desktop_layout->set_background_widget(desktop_background); | |
| 80 desktop_layout->set_launcher_widget(launcher); | |
| 81 desktop_layout->set_status_area_widget(status_area); | |
| 82 } | |
| 83 | |
| 84 } // namespace aura_shell | |
| 85 | |
| OLD | NEW |