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

Side by Side Diff: ash/shell.cc

Issue 11363124: Move DisplayManager and DisplayChangeObserverX11 from aura to ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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) 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/caps_lock_delegate.h" 12 #include "ash/caps_lock_delegate.h"
13 #include "ash/desktop_background/desktop_background_controller.h" 13 #include "ash/desktop_background/desktop_background_controller.h"
14 #include "ash/desktop_background/desktop_background_resources.h" 14 #include "ash/desktop_background/desktop_background_resources.h"
15 #include "ash/desktop_background/desktop_background_view.h" 15 #include "ash/desktop_background/desktop_background_view.h"
16 #include "ash/display/display_controller.h" 16 #include "ash/display/display_controller.h"
17 #include "ash/display/mouse_cursor_event_filter.h" 17 #include "ash/display/mouse_cursor_event_filter.h"
18 #include "ash/display/multi_display_manager.h" 18 #include "ash/display/display_manager.h"
19 #include "ash/display/screen_position_controller.h" 19 #include "ash/display/screen_position_controller.h"
20 #include "ash/drag_drop/drag_drop_controller.h" 20 #include "ash/drag_drop/drag_drop_controller.h"
21 #include "ash/focus_cycler.h" 21 #include "ash/focus_cycler.h"
22 #include "ash/high_contrast/high_contrast_controller.h" 22 #include "ash/high_contrast/high_contrast_controller.h"
23 #include "ash/magnifier/magnification_controller.h" 23 #include "ash/magnifier/magnification_controller.h"
24 #include "ash/root_window_controller.h" 24 #include "ash/root_window_controller.h"
25 #include "ash/screen_ash.h" 25 #include "ash/screen_ash.h"
26 #include "ash/shell_delegate.h" 26 #include "ash/shell_delegate.h"
27 #include "ash/shell_factory.h" 27 #include "ash/shell_factory.h"
28 #include "ash/shell_window_ids.h" 28 #include "ash/shell_window_ids.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include "ash/wm/window_cycle_controller.h" 60 #include "ash/wm/window_cycle_controller.h"
61 #include "ash/wm/window_modality_controller.h" 61 #include "ash/wm/window_modality_controller.h"
62 #include "ash/wm/window_properties.h" 62 #include "ash/wm/window_properties.h"
63 #include "ash/wm/window_util.h" 63 #include "ash/wm/window_util.h"
64 #include "ash/wm/workspace_controller.h" 64 #include "ash/wm/workspace_controller.h"
65 #include "base/bind.h" 65 #include "base/bind.h"
66 #include "base/command_line.h" 66 #include "base/command_line.h"
67 #include "base/debug/leak_annotations.h" 67 #include "base/debug/leak_annotations.h"
68 #include "ui/aura/client/aura_constants.h" 68 #include "ui/aura/client/aura_constants.h"
69 #include "ui/aura/client/user_action_client.h" 69 #include "ui/aura/client/user_action_client.h"
70 #include "ui/aura/display_manager.h"
71 #include "ui/aura/env.h" 70 #include "ui/aura/env.h"
72 #include "ui/aura/focus_manager.h" 71 #include "ui/aura/focus_manager.h"
73 #include "ui/aura/layout_manager.h" 72 #include "ui/aura/layout_manager.h"
74 #include "ui/aura/root_window.h" 73 #include "ui/aura/root_window.h"
75 #include "ui/aura/shared/compound_event_filter.h" 74 #include "ui/aura/shared/compound_event_filter.h"
76 #include "ui/aura/shared/input_method_event_filter.h" 75 #include "ui/aura/shared/input_method_event_filter.h"
77 #include "ui/aura/ui_controls_aura.h" 76 #include "ui/aura/ui_controls_aura.h"
78 #include "ui/aura/window.h" 77 #include "ui/aura/window.h"
79 #include "ui/compositor/layer.h" 78 #include "ui/compositor/layer.h"
80 #include "ui/compositor/layer_animator.h" 79 #include "ui/compositor/layer_animator.h"
81 #include "ui/gfx/display.h" 80 #include "ui/gfx/display.h"
82 #include "ui/gfx/image/image_skia.h" 81 #include "ui/gfx/image/image_skia.h"
83 #include "ui/gfx/screen.h" 82 #include "ui/gfx/screen.h"
84 #include "ui/gfx/size.h" 83 #include "ui/gfx/size.h"
85 #include "ui/ui_controls/ui_controls.h" 84 #include "ui/ui_controls/ui_controls.h"
86 #include "ui/views/focus/focus_manager_factory.h" 85 #include "ui/views/focus/focus_manager_factory.h"
87 #include "ui/views/widget/native_widget_aura.h" 86 #include "ui/views/widget/native_widget_aura.h"
88 #include "ui/views/widget/widget.h" 87 #include "ui/views/widget/widget.h"
89 88
90 #if !defined(OS_MACOSX) 89 #if !defined(OS_MACOSX)
91 #include "ash/accelerators/accelerator_controller.h" 90 #include "ash/accelerators/accelerator_controller.h"
92 #include "ash/accelerators/accelerator_filter.h" 91 #include "ash/accelerators/accelerator_filter.h"
93 #include "ash/accelerators/nested_dispatcher_controller.h" 92 #include "ash/accelerators/nested_dispatcher_controller.h"
94 #endif 93 #endif
95 94
96 #if defined(OS_CHROMEOS) 95 #if defined(OS_CHROMEOS)
96 #include "ash/display/display_change_observer_x11.h"
97 #include "ash/display/output_configurator_animation.h" 97 #include "ash/display/output_configurator_animation.h"
98 #include "base/chromeos/chromeos_version.h"
98 #include "base/message_pump_aurax11.h" 99 #include "base/message_pump_aurax11.h"
99 #include "chromeos/display/output_configurator.h" 100 #include "chromeos/display/output_configurator.h"
100 #include "content/public/browser/gpu_data_manager.h" 101 #include "content/public/browser/gpu_data_manager.h"
101 #include "content/public/common/gpu_feature_type.h" 102 #include "content/public/common/gpu_feature_type.h"
102 #endif // defined(OS_CHROMEOS) 103 #endif // defined(OS_CHROMEOS)
103 104
104 namespace ash { 105 namespace ash {
105 106
106 namespace { 107 namespace {
107 108
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 active_root_window_(NULL), 189 active_root_window_(NULL),
189 delegate_(delegate), 190 delegate_(delegate),
190 #if defined(OS_CHROMEOS) 191 #if defined(OS_CHROMEOS)
191 output_configurator_(new chromeos::OutputConfigurator()), 192 output_configurator_(new chromeos::OutputConfigurator()),
192 output_configurator_animation_( 193 output_configurator_animation_(
193 new internal::OutputConfiguratorAnimation()), 194 new internal::OutputConfiguratorAnimation()),
194 #endif // defined(OS_CHROMEOS) 195 #endif // defined(OS_CHROMEOS)
195 browser_context_(NULL), 196 browser_context_(NULL),
196 simulate_modal_window_open_for_testing_(false) { 197 simulate_modal_window_open_for_testing_(false) {
197 DCHECK(delegate_.get()); 198 DCHECK(delegate_.get());
199 display_manager_.reset(new internal::DisplayManager);
198 ANNOTATE_LEAKING_OBJECT_PTR(screen_); // see crbug.com/156466 200 ANNOTATE_LEAKING_OBJECT_PTR(screen_); // see crbug.com/156466
199 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, screen_); 201 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_ALTERNATE, screen_);
200 if (!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE)) 202 if (!gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE))
201 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_); 203 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, screen_);
202 ui_controls::InstallUIControlsAura(internal::CreateUIControls()); 204 ui_controls::InstallUIControlsAura(internal::CreateUIControls());
203 #if defined(OS_CHROMEOS) 205 #if defined(OS_CHROMEOS)
204 content::GpuFeatureType blacklisted_features = 206 content::GpuFeatureType blacklisted_features =
205 content::GpuDataManager::GetInstance()->GetBlacklistedFeatures(); 207 content::GpuDataManager::GetInstance()->GetBlacklistedFeatures();
206 bool is_panel_fitting_disabled = 208 bool is_panel_fitting_disabled =
207 (blacklisted_features & content::GPU_FEATURE_TYPE_PANEL_FITTING) || 209 (blacklisted_features & content::GPU_FEATURE_TYPE_PANEL_FITTING) ||
208 CommandLine::ForCurrentProcess()->HasSwitch( 210 CommandLine::ForCurrentProcess()->HasSwitch(
209 switches::kAshDisablePanelFitting); 211 switches::kAshDisablePanelFitting);
210 output_configurator_->Init(!is_panel_fitting_disabled); 212 output_configurator_->Init(!is_panel_fitting_disabled);
211 213
212 output_configurator_->AddObserver(output_configurator_animation_.get()); 214 output_configurator_->AddObserver(output_configurator_animation_.get());
213 base::MessagePumpAuraX11::Current()->AddDispatcherForRootWindow( 215 base::MessagePumpAuraX11::Current()->AddDispatcherForRootWindow(
214 output_configurator()); 216 output_configurator());
217 if (base::chromeos::IsRunningOnChromeOS()) {
218 display_change_observer_.reset(new internal::DisplayChangeObserverX11);
219 display_change_observer_->NotifyDisplayChange();
220 }
215 #endif // defined(OS_CHROMEOS) 221 #endif // defined(OS_CHROMEOS)
216 } 222 }
217 223
218 Shell::~Shell() { 224 Shell::~Shell() {
219 views::FocusManagerFactory::Install(NULL); 225 views::FocusManagerFactory::Install(NULL);
220 226
221 // Remove the focus from any window. This will prevent overhead and side 227 // Remove the focus from any window. This will prevent overhead and side
222 // effects (e.g. crashes) from changing focus during shutdown. 228 // effects (e.g. crashes) from changing focus during shutdown.
223 // See bug crbug.com/134502. 229 // See bug crbug.com/134502.
224 if (active_root_window_) 230 if (active_root_window_)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 #if defined(OS_CHROMEOS) 291 #if defined(OS_CHROMEOS)
286 output_configurator_->RemoveObserver(output_configurator_animation_.get()); 292 output_configurator_->RemoveObserver(output_configurator_animation_.get());
287 base::MessagePumpAuraX11::Current()->RemoveDispatcherForRootWindow( 293 base::MessagePumpAuraX11::Current()->RemoveDispatcherForRootWindow(
288 output_configurator()); 294 output_configurator());
289 #endif // defined(OS_CHROMEOS) 295 #endif // defined(OS_CHROMEOS)
290 } 296 }
291 297
292 // static 298 // static
293 Shell* Shell::CreateInstance(ShellDelegate* delegate) { 299 Shell* Shell::CreateInstance(ShellDelegate* delegate) {
294 CHECK(!instance_); 300 CHECK(!instance_);
295 aura::Env::GetInstance()->SetDisplayManager(
296 new internal::MultiDisplayManager());
297 instance_ = new Shell(delegate); 301 instance_ = new Shell(delegate);
298 instance_->Init(); 302 instance_->Init();
299 return instance_; 303 return instance_;
300 } 304 }
301 305
302 // static 306 // static
303 Shell* Shell::GetInstance() { 307 Shell* Shell::GetInstance() {
304 DCHECK(instance_); 308 DCHECK(instance_);
305 return instance_; 309 return instance_;
306 } 310 }
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 } 600 }
597 601
598 void Shell::RotateFocus(Direction direction) { 602 void Shell::RotateFocus(Direction direction) {
599 focus_cycler_->RotateFocus( 603 focus_cycler_->RotateFocus(
600 direction == FORWARD ? internal::FocusCycler::FORWARD : 604 direction == FORWARD ? internal::FocusCycler::FORWARD :
601 internal::FocusCycler::BACKWARD); 605 internal::FocusCycler::BACKWARD);
602 } 606 }
603 607
604 void Shell::SetDisplayWorkAreaInsets(Window* contains, 608 void Shell::SetDisplayWorkAreaInsets(Window* contains,
605 const gfx::Insets& insets) { 609 const gfx::Insets& insets) {
606 internal::MultiDisplayManager* display_manager = 610 if (!display_manager_->UpdateWorkAreaOfDisplayNearestWindow(contains, insets))
607 static_cast<internal::MultiDisplayManager*>(
608 aura::Env::GetInstance()->display_manager());
609 if (!display_manager->UpdateWorkAreaOfDisplayNearestWindow(contains, insets))
610 return; 611 return;
611 FOR_EACH_OBSERVER(ShellObserver, observers_, 612 FOR_EACH_OBSERVER(ShellObserver, observers_,
612 OnDisplayWorkAreaInsetsChanged()); 613 OnDisplayWorkAreaInsetsChanged());
613 } 614 }
614 615
615 void Shell::OnLoginStateChanged(user::LoginStatus status) { 616 void Shell::OnLoginStateChanged(user::LoginStatus status) {
616 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLoginStateChanged(status)); 617 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLoginStateChanged(status));
617 RootWindowControllerList controllers = GetAllRootWindowControllers(); 618 RootWindowControllerList controllers = GetAllRootWindowControllers();
618 for (RootWindowControllerList::iterator iter = controllers.begin(); 619 for (RootWindowControllerList::iterator iter = controllers.begin();
619 iter != controllers.end(); ++iter) 620 iter != controllers.end(); ++iter)
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 828
828 bool Shell::CanAcceptEvents() { 829 bool Shell::CanAcceptEvents() {
829 return true; 830 return true;
830 } 831 }
831 832
832 ui::EventTarget* Shell::GetParentTarget() { 833 ui::EventTarget* Shell::GetParentTarget() {
833 return NULL; 834 return NULL;
834 } 835 }
835 836
836 } // namespace ash 837 } // namespace ash
OLDNEW
« ash/shell.h ('K') | « ash/shell.h ('k') | ash/system/chromeos/tray_display.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698