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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 bool visible) OVERRIDE { | 161 bool visible) OVERRIDE { |
162 return AnimateOnChildWindowVisibilityChanged(window, visible); | 162 return AnimateOnChildWindowVisibilityChanged(window, visible); |
163 } | 163 } |
164 | 164 |
165 DISALLOW_COPY_AND_ASSIGN(AshVisibilityController); | 165 DISALLOW_COPY_AND_ASSIGN(AshVisibilityController); |
166 }; | 166 }; |
167 | 167 |
168 AshWindowTreeHostInitParams ShellInitParamsToAshWindowTreeHostInitParams( | 168 AshWindowTreeHostInitParams ShellInitParamsToAshWindowTreeHostInitParams( |
169 const ShellInitParams& shell_init_params) { | 169 const ShellInitParams& shell_init_params) { |
170 AshWindowTreeHostInitParams ash_init_params; | 170 AshWindowTreeHostInitParams ash_init_params; |
| 171 ash_init_params.context_factory = shell_init_params.context_factory; |
171 #if defined(OS_WIN) | 172 #if defined(OS_WIN) |
172 ash_init_params.remote_hwnd = shell_init_params.remote_hwnd; | 173 ash_init_params.remote_hwnd = shell_init_params.remote_hwnd; |
173 #endif | 174 #endif |
174 return ash_init_params; | 175 return ash_init_params; |
175 } | 176 } |
176 | 177 |
177 } // namespace | 178 } // namespace |
178 | 179 |
179 // static | 180 // static |
180 Shell* Shell::instance_ = NULL; | 181 Shell* Shell::instance_ = NULL; |
181 // static | 182 // static |
182 bool Shell::initially_hide_cursor_ = false; | 183 bool Shell::initially_hide_cursor_ = false; |
183 | 184 |
184 //////////////////////////////////////////////////////////////////////////////// | 185 //////////////////////////////////////////////////////////////////////////////// |
185 // Shell, public: | 186 // Shell, public: |
186 | 187 |
187 // static | 188 // static |
188 Shell* Shell::CreateInstance(const ShellInitParams& init_params) { | 189 Shell* Shell::CreateInstance(const ShellInitParams& init_params) { |
189 CHECK(!instance_); | 190 CHECK(!instance_); |
190 instance_ = new Shell(init_params.delegate); | 191 instance_ = new Shell(init_params.delegate, init_params.context_factory); |
191 instance_->Init(init_params); | 192 instance_->Init(init_params); |
192 return instance_; | 193 return instance_; |
193 } | 194 } |
194 | 195 |
195 // static | 196 // static |
196 Shell* Shell::GetInstance() { | 197 Shell* Shell::GetInstance() { |
197 DCHECK(instance_); | 198 DCHECK(instance_); |
198 return instance_; | 199 return instance_; |
199 } | 200 } |
200 | 201 |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 #endif // defined(OS_CHROMEOS) | 611 #endif // defined(OS_CHROMEOS) |
611 | 612 |
612 void Shell::DoInitialWorkspaceAnimation() { | 613 void Shell::DoInitialWorkspaceAnimation() { |
613 return GetPrimaryRootWindowController()->workspace_controller()-> | 614 return GetPrimaryRootWindowController()->workspace_controller()-> |
614 DoInitialAnimation(); | 615 DoInitialAnimation(); |
615 } | 616 } |
616 | 617 |
617 //////////////////////////////////////////////////////////////////////////////// | 618 //////////////////////////////////////////////////////////////////////////////// |
618 // Shell, private: | 619 // Shell, private: |
619 | 620 |
620 Shell::Shell(ShellDelegate* delegate) | 621 Shell::Shell(ShellDelegate* delegate, ui::ContextFactory* context_factory) |
621 : target_root_window_(NULL), | 622 : target_root_window_(NULL), |
622 scoped_target_root_window_(NULL), | 623 scoped_target_root_window_(NULL), |
623 delegate_(delegate), | 624 delegate_(delegate), |
624 window_positioner_(new WindowPositioner), | 625 window_positioner_(new WindowPositioner), |
625 activation_client_(NULL), | 626 activation_client_(NULL), |
626 accelerometer_controller_(new AccelerometerController()), | 627 accelerometer_controller_(new AccelerometerController()), |
627 #if defined(OS_CHROMEOS) | 628 #if defined(OS_CHROMEOS) |
628 display_configurator_(new ui::DisplayConfigurator()), | 629 display_configurator_(new ui::DisplayConfigurator()), |
629 #endif // defined(OS_CHROMEOS) | 630 #endif // defined(OS_CHROMEOS) |
630 native_cursor_manager_(new AshNativeCursorManager), | 631 native_cursor_manager_(new AshNativeCursorManager), |
631 cursor_manager_( | 632 cursor_manager_( |
632 scoped_ptr< ::wm::NativeCursorManager>(native_cursor_manager_)), | 633 scoped_ptr< ::wm::NativeCursorManager>(native_cursor_manager_)), |
633 simulate_modal_window_open_for_testing_(false), | 634 simulate_modal_window_open_for_testing_(false), |
634 is_touch_hud_projection_enabled_(false) { | 635 is_touch_hud_projection_enabled_(false) { |
635 DCHECK(delegate_.get()); | 636 DCHECK(delegate_.get()); |
636 gpu_support_.reset(delegate_->CreateGPUSupport()); | 637 gpu_support_.reset(delegate_->CreateGPUSupport()); |
637 display_manager_.reset(new DisplayManager); | 638 display_manager_.reset(new DisplayManager); |
638 display_controller_.reset(new DisplayController); | 639 display_controller_.reset(new DisplayController(context_factory)); |
639 #if defined(OS_CHROMEOS) && defined(USE_X11) | 640 #if defined(OS_CHROMEOS) && defined(USE_X11) |
640 user_metrics_recorder_.reset(new UserMetricsRecorder); | 641 user_metrics_recorder_.reset(new UserMetricsRecorder); |
641 #endif // defined(OS_CHROMEOS) | 642 #endif // defined(OS_CHROMEOS) |
642 | 643 |
643 #if defined(OS_CHROMEOS) | 644 #if defined(OS_CHROMEOS) |
644 PowerStatus::Initialize(); | 645 PowerStatus::Initialize(); |
645 #endif | 646 #endif |
646 } | 647 } |
647 | 648 |
648 Shell::~Shell() { | 649 Shell::~Shell() { |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 //////////////////////////////////////////////////////////////////////////////// | 1144 //////////////////////////////////////////////////////////////////////////////// |
1144 // Shell, aura::client::ActivationChangeObserver implementation: | 1145 // Shell, aura::client::ActivationChangeObserver implementation: |
1145 | 1146 |
1146 void Shell::OnWindowActivated(aura::Window* gained_active, | 1147 void Shell::OnWindowActivated(aura::Window* gained_active, |
1147 aura::Window* lost_active) { | 1148 aura::Window* lost_active) { |
1148 if (gained_active) | 1149 if (gained_active) |
1149 target_root_window_ = gained_active->GetRootWindow(); | 1150 target_root_window_ = gained_active->GetRootWindow(); |
1150 } | 1151 } |
1151 | 1152 |
1152 } // namespace ash | 1153 } // namespace ash |
OLD | NEW |