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

Side by Side Diff: ash/shell.cc

Issue 10789018: aura: Add X11 host window management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Keep ash switches alphabetized. Created 8 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/shell.h" 5 #include "ash/shell.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "ash/accelerators/focus_manager_factory.h" 10 #include "ash/accelerators/focus_manager_factory.h"
11 #include "ash/ash_switches.h" 11 #include "ash/ash_switches.h"
12 #include "ash/desktop_background/desktop_background_controller.h" 12 #include "ash/desktop_background/desktop_background_controller.h"
13 #include "ash/desktop_background/desktop_background_resources.h" 13 #include "ash/desktop_background/desktop_background_resources.h"
14 #include "ash/desktop_background/desktop_background_view.h" 14 #include "ash/desktop_background/desktop_background_view.h"
15 #include "ash/drag_drop/drag_drop_controller.h" 15 #include "ash/drag_drop/drag_drop_controller.h"
16 #include "ash/focus_cycler.h" 16 #include "ash/focus_cycler.h"
17 #include "ash/high_contrast/high_contrast_controller.h" 17 #include "ash/high_contrast/high_contrast_controller.h"
18 #include "ash/hostwm/host_window_manager.h"
18 #include "ash/launcher/launcher.h" 19 #include "ash/launcher/launcher.h"
19 #include "ash/magnifier/magnification_controller.h" 20 #include "ash/magnifier/magnification_controller.h"
20 #include "ash/display/display_controller.h" 21 #include "ash/display/display_controller.h"
21 #include "ash/display/mouse_cursor_event_filter.h" 22 #include "ash/display/mouse_cursor_event_filter.h"
22 #include "ash/display/multi_display_manager.h" 23 #include "ash/display/multi_display_manager.h"
23 #include "ash/display/secondary_display_view.h" 24 #include "ash/display/secondary_display_view.h"
24 #include "ash/root_window_controller.h" 25 #include "ash/root_window_controller.h"
25 #include "ash/screen_ash.h" 26 #include "ash/screen_ash.h"
26 #include "ash/shell_context_menu.h" 27 #include "ash/shell_context_menu.h"
27 #include "ash/shell_delegate.h" 28 #include "ash/shell_delegate.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 #include "ash/accelerators/accelerator_controller.h" 95 #include "ash/accelerators/accelerator_controller.h"
95 #include "ash/accelerators/accelerator_filter.h" 96 #include "ash/accelerators/accelerator_filter.h"
96 #include "ash/accelerators/nested_dispatcher_controller.h" 97 #include "ash/accelerators/nested_dispatcher_controller.h"
97 #endif 98 #endif
98 99
99 #if defined(OS_CHROMEOS) 100 #if defined(OS_CHROMEOS)
100 #include "chromeos/display/output_configurator.h" 101 #include "chromeos/display/output_configurator.h"
101 #include "ui/aura/dispatcher_linux.h" 102 #include "ui/aura/dispatcher_linux.h"
102 #endif // defined(OS_CHROMEOS) 103 #endif // defined(OS_CHROMEOS)
103 104
105 #if defined(USE_X11)
106 #include "ui/aura/hostwm/host_window_manager_x11.h"
107 #endif
108
104 namespace ash { 109 namespace ash {
105 110
106 namespace { 111 namespace {
107 112
108 using aura::Window; 113 using aura::Window;
109 using views::Widget; 114 using views::Widget;
110 115
111 // This dummy class is used for shell unit tests. We dont have chrome delegate 116 // This dummy class is used for shell unit tests. We dont have chrome delegate
112 // in these tests. 117 // in these tests.
113 class DummyUserWallpaperDelegate : public UserWallpaperDelegate { 118 class DummyUserWallpaperDelegate : public UserWallpaperDelegate {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 ui_controls::InstallUIControlsAura(internal::CreateUIControls()); 189 ui_controls::InstallUIControlsAura(internal::CreateUIControls());
185 #if defined(OS_CHROMEOS) 190 #if defined(OS_CHROMEOS)
186 // OutputConfigurator needs to get events regarding added/removed outputs. 191 // OutputConfigurator needs to get events regarding added/removed outputs.
187 static_cast<aura::DispatcherLinux*>( 192 static_cast<aura::DispatcherLinux*>(
188 aura::Env::GetInstance()->GetDispatcher())->AddDispatcherForRootWindow( 193 aura::Env::GetInstance()->GetDispatcher())->AddDispatcherForRootWindow(
189 output_configurator()); 194 output_configurator());
190 #endif // defined(OS_CHROMEOS) 195 #endif // defined(OS_CHROMEOS)
191 } 196 }
192 197
193 Shell::~Shell() { 198 Shell::~Shell() {
199 #if defined(USE_X11)
200 x11_host_window_manager_.reset();
201 #endif
202
203 // This holds a pointer to the host_window_manager_ that we own.
204 host_window_manager_.reset();
205
194 views::FocusManagerFactory::Install(NULL); 206 views::FocusManagerFactory::Install(NULL);
195 207
196 // Remove the focus from any window. This will prevent overhead and side 208 // Remove the focus from any window. This will prevent overhead and side
197 // effects (e.g. crashes) from changing focus during shutdown. 209 // effects (e.g. crashes) from changing focus during shutdown.
198 // See bug crbug.com/134502. 210 // See bug crbug.com/134502.
199 if (active_root_window_) 211 if (active_root_window_)
200 active_root_window_->GetFocusManager()->SetFocusedWindow(NULL, NULL); 212 active_root_window_->GetFocusManager()->SetFocusedWindow(NULL, NULL);
201 213
202 aura::Env::GetInstance()->cursor_manager()->set_delegate(NULL); 214 aura::Env::GetInstance()->cursor_manager()->set_delegate(NULL);
203 215
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 std::vector<aura::Window*> Shell::GetAllContainers(int container_id) { 362 std::vector<aura::Window*> Shell::GetAllContainers(int container_id) {
351 // TODO(oshima): Support multiple root windows. 363 // TODO(oshima): Support multiple root windows.
352 std::vector<aura::Window*> containers; 364 std::vector<aura::Window*> containers;
353 aura::Window* container = GetPrimaryRootWindow()->GetChildById(container_id); 365 aura::Window* container = GetPrimaryRootWindow()->GetChildById(container_id);
354 if (container) 366 if (container)
355 containers.push_back(container); 367 containers.push_back(container);
356 return containers; 368 return containers;
357 } 369 }
358 370
359 void Shell::Init() { 371 void Shell::Init() {
372 if (CommandLine::ForCurrentProcess()->HasSwitch(
373 switches::kAuraEnableHostWindowManagement)) {
374 host_window_manager_.reset(new internal::HostWindowManager);
375 #if defined(USE_X11)
376 x11_host_window_manager_.reset(new aura::HostWindowManagerX11(
377 host_window_manager_.get()));
378 #endif
379 }
380
360 // Install the custom factory first so that views::FocusManagers for Tray, 381 // Install the custom factory first so that views::FocusManagers for Tray,
361 // Launcher, and WallPaper could be created by the factory. 382 // Launcher, and WallPaper could be created by the factory.
362 views::FocusManagerFactory::Install(new AshFocusManagerFactory); 383 views::FocusManagerFactory::Install(new AshFocusManagerFactory);
363 384
364 env_filter_ = new aura::shared::CompoundEventFilter; 385 env_filter_ = new aura::shared::CompoundEventFilter;
365 // Pass ownership of the filter to the Env. 386 // Pass ownership of the filter to the Env.
366 aura::Env::GetInstance()->SetEventFilter(env_filter_); 387 aura::Env::GetInstance()->SetEventFilter(env_filter_);
367 388
368 aura::Env::GetInstance()->cursor_manager()->set_delegate(this); 389 aura::Env::GetInstance()->cursor_manager()->set_delegate(this);
369 390
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 // widget will not paint when restoring after a browser crash. 511 // widget will not paint when restoring after a browser crash.
491 user_wallpaper_delegate_->InitializeWallpaper(); 512 user_wallpaper_delegate_->InitializeWallpaper();
492 513
493 power_button_controller_.reset(new PowerButtonController); 514 power_button_controller_.reset(new PowerButtonController);
494 AddShellObserver(power_button_controller_.get()); 515 AddShellObserver(power_button_controller_.get());
495 516
496 display_controller_->InitSecondaryDisplays(); 517 display_controller_->InitSecondaryDisplays();
497 518
498 if (initially_hide_cursor_) 519 if (initially_hide_cursor_)
499 aura::Env::GetInstance()->cursor_manager()->ShowCursor(false); 520 aura::Env::GetInstance()->cursor_manager()->ShowCursor(false);
521
522 #if defined(USE_X11)
523 if (x11_host_window_manager_.get())
524 x11_host_window_manager_->Init();
525 #endif
500 } 526 }
501 527
502 void Shell::AddEnvEventFilter(aura::EventFilter* filter) { 528 void Shell::AddEnvEventFilter(aura::EventFilter* filter) {
503 env_filter_->AddFilter(filter); 529 env_filter_->AddFilter(filter);
504 } 530 }
505 531
506 void Shell::RemoveEnvEventFilter(aura::EventFilter* filter) { 532 void Shell::RemoveEnvEventFilter(aura::EventFilter* filter) {
507 env_filter_->RemoveFilter(filter); 533 env_filter_->RemoveFilter(filter);
508 } 534 }
509 535
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 } 785 }
760 786
761 void Shell::ShowCursor(bool visible) { 787 void Shell::ShowCursor(bool visible) {
762 RootWindowList root_windows = GetAllRootWindows(); 788 RootWindowList root_windows = GetAllRootWindows();
763 for (RootWindowList::iterator iter = root_windows.begin(); 789 for (RootWindowList::iterator iter = root_windows.begin();
764 iter != root_windows.end(); ++iter) 790 iter != root_windows.end(); ++iter)
765 (*iter)->ShowCursor(visible); 791 (*iter)->ShowCursor(visible);
766 } 792 }
767 793
768 } // namespace ash 794 } // namespace ash
OLDNEW
« ash/hostwm/host_window_container.h ('K') | « ash/shell.h ('k') | ui/aura/aura.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698