| OLD | NEW |
| 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/accelerator_controller.h" | 10 #include "ash/accelerators/accelerator_controller.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // Overridden from views::corewm::VisibilityController: | 151 // Overridden from views::corewm::VisibilityController: |
| 152 virtual bool CallAnimateOnChildWindowVisibilityChanged( | 152 virtual bool CallAnimateOnChildWindowVisibilityChanged( |
| 153 aura::Window* window, | 153 aura::Window* window, |
| 154 bool visible) OVERRIDE { | 154 bool visible) OVERRIDE { |
| 155 return AnimateOnChildWindowVisibilityChanged(window, visible); | 155 return AnimateOnChildWindowVisibilityChanged(window, visible); |
| 156 } | 156 } |
| 157 | 157 |
| 158 DISALLOW_COPY_AND_ASSIGN(AshVisibilityController); | 158 DISALLOW_COPY_AND_ASSIGN(AshVisibilityController); |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 class DefaultGPUSupportImpl : public GPUSupport { | |
| 162 public: | |
| 163 DefaultGPUSupportImpl() {} | |
| 164 virtual ~DefaultGPUSupportImpl() {} | |
| 165 | |
| 166 private: | |
| 167 // Overridden from GPUSupport: | |
| 168 virtual bool IsPanelFittingDisabled() const OVERRIDE { | |
| 169 return false; | |
| 170 } | |
| 171 virtual void DisableGpuWatchdog() OVERRIDE {} | |
| 172 virtual void GetGpuProcessHandles( | |
| 173 const GetGpuProcessHandlesCallback& callback) const OVERRIDE {} | |
| 174 | |
| 175 DISALLOW_COPY_AND_ASSIGN(DefaultGPUSupportImpl); | |
| 176 }; | |
| 177 | |
| 178 } // namespace | 161 } // namespace |
| 179 | 162 |
| 180 // static | 163 // static |
| 181 Shell* Shell::instance_ = NULL; | 164 Shell* Shell::instance_ = NULL; |
| 182 // static | 165 // static |
| 183 bool Shell::initially_hide_cursor_ = false; | 166 bool Shell::initially_hide_cursor_ = false; |
| 184 | 167 |
| 185 //////////////////////////////////////////////////////////////////////////////// | 168 //////////////////////////////////////////////////////////////////////////////// |
| 186 // Shell, public: | 169 // Shell, public: |
| 187 | 170 |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 ash::FirstRunHelper* Shell::CreateFirstRunHelper() { | 553 ash::FirstRunHelper* Shell::CreateFirstRunHelper() { |
| 571 return new ash::FirstRunHelperImpl; | 554 return new ash::FirstRunHelperImpl; |
| 572 } | 555 } |
| 573 #endif // defined(OS_CHROMEOS) | 556 #endif // defined(OS_CHROMEOS) |
| 574 | 557 |
| 575 void Shell::DoInitialWorkspaceAnimation() { | 558 void Shell::DoInitialWorkspaceAnimation() { |
| 576 return GetPrimaryRootWindowController()->workspace_controller()-> | 559 return GetPrimaryRootWindowController()->workspace_controller()-> |
| 577 DoInitialAnimation(); | 560 DoInitialAnimation(); |
| 578 } | 561 } |
| 579 | 562 |
| 580 void Shell::SetGPUSupport(scoped_ptr<GPUSupport> gpu_support) { | |
| 581 gpu_support_ = gpu_support.Pass(); | |
| 582 } | |
| 583 | |
| 584 //////////////////////////////////////////////////////////////////////////////// | 563 //////////////////////////////////////////////////////////////////////////////// |
| 585 // Shell, private: | 564 // Shell, private: |
| 586 | 565 |
| 587 Shell::Shell(ShellDelegate* delegate) | 566 Shell::Shell(ShellDelegate* delegate) |
| 588 : target_root_window_(NULL), | 567 : target_root_window_(NULL), |
| 589 scoped_target_root_window_(NULL), | 568 scoped_target_root_window_(NULL), |
| 590 delegate_(delegate), | 569 delegate_(delegate), |
| 591 window_positioner_(new WindowPositioner), | 570 window_positioner_(new WindowPositioner), |
| 592 activation_client_(NULL), | 571 activation_client_(NULL), |
| 593 #if defined(OS_CHROMEOS) && defined(USE_X11) | 572 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 594 output_configurator_(new chromeos::OutputConfigurator()), | 573 output_configurator_(new chromeos::OutputConfigurator()), |
| 595 #endif // defined(OS_CHROMEOS) && defined(USE_X11) | 574 #endif // defined(OS_CHROMEOS) && defined(USE_X11) |
| 596 native_cursor_manager_(new AshNativeCursorManager), | 575 native_cursor_manager_(new AshNativeCursorManager), |
| 597 cursor_manager_(scoped_ptr<views::corewm::NativeCursorManager>( | 576 cursor_manager_(scoped_ptr<views::corewm::NativeCursorManager>( |
| 598 native_cursor_manager_)), | 577 native_cursor_manager_)), |
| 599 simulate_modal_window_open_for_testing_(false), | 578 simulate_modal_window_open_for_testing_(false), |
| 600 is_touch_hud_projection_enabled_(false), | 579 is_touch_hud_projection_enabled_(false) { |
| 601 gpu_support_(new DefaultGPUSupportImpl) { | |
| 602 DCHECK(delegate_.get()); | 580 DCHECK(delegate_.get()); |
| 581 gpu_support_.reset(delegate_->CreateGPUSupport()); |
| 603 display_manager_.reset(new internal::DisplayManager); | 582 display_manager_.reset(new internal::DisplayManager); |
| 604 display_controller_.reset(new DisplayController); | 583 display_controller_.reset(new DisplayController); |
| 605 #if defined(OS_CHROMEOS) && defined(USE_X11) | 584 #if defined(OS_CHROMEOS) && defined(USE_X11) |
| 585 // TODO: Move this initialization into Shell::Init(). |
| 606 output_configurator_->Init(!gpu_support_->IsPanelFittingDisabled()); | 586 output_configurator_->Init(!gpu_support_->IsPanelFittingDisabled()); |
| 607 user_metrics_recorder_.reset(new UserMetricsRecorder); | 587 user_metrics_recorder_.reset(new UserMetricsRecorder); |
| 608 | 588 |
| 609 base::MessagePumpX11::Current()->AddDispatcherForRootWindow( | 589 base::MessagePumpX11::Current()->AddDispatcherForRootWindow( |
| 610 output_configurator()); | 590 output_configurator()); |
| 611 // We can't do this with a root window listener because XI_HierarchyChanged | 591 // We can't do this with a root window listener because XI_HierarchyChanged |
| 612 // messages don't have a target window. | 592 // messages don't have a target window. |
| 613 base::MessagePumpX11::Current()->AddObserver(output_configurator()); | 593 base::MessagePumpX11::Current()->AddObserver(output_configurator()); |
| 614 #endif // defined(OS_CHROMEOS) | 594 #endif // defined(OS_CHROMEOS) |
| 615 | 595 |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 //////////////////////////////////////////////////////////////////////////////// | 1054 //////////////////////////////////////////////////////////////////////////////// |
| 1075 // Shell, aura::client::ActivationChangeObserver implementation: | 1055 // Shell, aura::client::ActivationChangeObserver implementation: |
| 1076 | 1056 |
| 1077 void Shell::OnWindowActivated(aura::Window* gained_active, | 1057 void Shell::OnWindowActivated(aura::Window* gained_active, |
| 1078 aura::Window* lost_active) { | 1058 aura::Window* lost_active) { |
| 1079 if (gained_active) | 1059 if (gained_active) |
| 1080 target_root_window_ = gained_active->GetRootWindow(); | 1060 target_root_window_ = gained_active->GetRootWindow(); |
| 1081 } | 1061 } |
| 1082 | 1062 |
| 1083 } // namespace ash | 1063 } // namespace ash |
| OLD | NEW |