| 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/focus_manager_factory.h" | 10 #include "ash/accelerators/focus_manager_factory.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 //////////////////////////////////////////////////////////////////////////////// | 178 //////////////////////////////////////////////////////////////////////////////// |
| 179 // Shell, public: | 179 // Shell, public: |
| 180 | 180 |
| 181 Shell::Shell(ShellDelegate* delegate) | 181 Shell::Shell(ShellDelegate* delegate) |
| 182 : screen_(new ScreenAsh), | 182 : screen_(new ScreenAsh), |
| 183 active_root_window_(NULL), | 183 active_root_window_(NULL), |
| 184 env_filter_(NULL), | 184 env_filter_(NULL), |
| 185 delegate_(delegate), | 185 delegate_(delegate), |
| 186 #if defined(OS_CHROMEOS) | 186 #if defined(OS_CHROMEOS) |
| 187 output_configurator_(new chromeos::OutputConfigurator( | 187 output_configurator_(new chromeos::OutputConfigurator( |
| 188 internal::DisplayController::IsExtendedDesktopEnabled())), | 188 DisplayController::IsExtendedDesktopEnabled())), |
| 189 output_configurator_animation_( | 189 output_configurator_animation_( |
| 190 new internal::OutputConfiguratorAnimation()), | 190 new internal::OutputConfiguratorAnimation()), |
| 191 #endif // defined(OS_CHROMEOS) | 191 #endif // defined(OS_CHROMEOS) |
| 192 shelf_(NULL), | 192 shelf_(NULL), |
| 193 panel_layout_manager_(NULL), | 193 panel_layout_manager_(NULL), |
| 194 status_area_widget_(NULL), | 194 status_area_widget_(NULL), |
| 195 browser_context_(NULL) { | 195 browser_context_(NULL) { |
| 196 gfx::Screen::SetInstance(screen_); | 196 gfx::Screen::SetInstance(screen_); |
| 197 ui_controls::InstallUIControlsAura(internal::CreateUIControls()); | 197 ui_controls::InstallUIControlsAura(internal::CreateUIControls()); |
| 198 #if defined(OS_CHROMEOS) | 198 #if defined(OS_CHROMEOS) |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 // Pass ownership of the filter to the Env. | 365 // Pass ownership of the filter to the Env. |
| 366 aura::Env::GetInstance()->SetEventFilter(env_filter_); | 366 aura::Env::GetInstance()->SetEventFilter(env_filter_); |
| 367 | 367 |
| 368 cursor_manager_.set_delegate(this); | 368 cursor_manager_.set_delegate(this); |
| 369 | 369 |
| 370 focus_manager_.reset(new aura::FocusManager); | 370 focus_manager_.reset(new aura::FocusManager); |
| 371 activation_controller_.reset( | 371 activation_controller_.reset( |
| 372 new internal::ActivationController(focus_manager_.get())); | 372 new internal::ActivationController(focus_manager_.get())); |
| 373 | 373 |
| 374 screen_position_controller_.reset(new internal::ScreenPositionController); | 374 screen_position_controller_.reset(new internal::ScreenPositionController); |
| 375 display_controller_.reset(new internal::DisplayController); | 375 display_controller_.reset(new DisplayController); |
| 376 display_controller_->InitPrimaryDisplay(); | 376 display_controller_->InitPrimaryDisplay(); |
| 377 aura::RootWindow* root_window = display_controller_->GetPrimaryRootWindow(); | 377 aura::RootWindow* root_window = display_controller_->GetPrimaryRootWindow(); |
| 378 active_root_window_ = root_window; | 378 active_root_window_ = root_window; |
| 379 | 379 |
| 380 #if !defined(OS_MACOSX) | 380 #if !defined(OS_MACOSX) |
| 381 nested_dispatcher_controller_.reset(new NestedDispatcherController); | 381 nested_dispatcher_controller_.reset(new NestedDispatcherController); |
| 382 accelerator_controller_.reset(new AcceleratorController); | 382 accelerator_controller_.reset(new AcceleratorController); |
| 383 #endif | 383 #endif |
| 384 shell_context_menu_.reset(new internal::ShellContextMenu); | 384 shell_context_menu_.reset(new internal::ShellContextMenu); |
| 385 | 385 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 415 new internal::RootWindowController(root_window); | 415 new internal::RootWindowController(root_window); |
| 416 root_window_controller->CreateContainers(); | 416 root_window_controller->CreateContainers(); |
| 417 | 417 |
| 418 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 418 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 419 | 419 |
| 420 if (command_line->HasSwitch(switches::kAshTouchHud)) { | 420 if (command_line->HasSwitch(switches::kAshTouchHud)) { |
| 421 touch_observer_hud_.reset(new internal::TouchObserverHUD); | 421 touch_observer_hud_.reset(new internal::TouchObserverHUD); |
| 422 AddEnvEventFilter(touch_observer_hud_.get()); | 422 AddEnvEventFilter(touch_observer_hud_.get()); |
| 423 } | 423 } |
| 424 | 424 |
| 425 if (internal::DisplayController::IsExtendedDesktopEnabled()) { | 425 if (DisplayController::IsExtendedDesktopEnabled()) { |
| 426 mouse_cursor_filter_.reset( | 426 mouse_cursor_filter_.reset( |
| 427 new internal::MouseCursorEventFilter(display_controller_.get())); | 427 new internal::MouseCursorEventFilter(display_controller_.get())); |
| 428 AddEnvEventFilter(mouse_cursor_filter_.get()); | 428 AddEnvEventFilter(mouse_cursor_filter_.get()); |
| 429 } | 429 } |
| 430 | 430 |
| 431 // Create Controllers that may need root window. | 431 // Create Controllers that may need root window. |
| 432 // TODO(oshima): Move as many controllers before creating | 432 // TODO(oshima): Move as many controllers before creating |
| 433 // RootWindowController as possible. | 433 // RootWindowController as possible. |
| 434 stacking_controller_.reset(new internal::StackingController); | 434 stacking_controller_.reset(new internal::StackingController); |
| 435 visibility_controller_.reset(new internal::VisibilityController); | 435 visibility_controller_.reset(new internal::VisibilityController); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 return status_area_widget_->system_tray(); | 662 return status_area_widget_->system_tray(); |
| 663 } | 663 } |
| 664 | 664 |
| 665 int Shell::GetGridSize() const { | 665 int Shell::GetGridSize() const { |
| 666 return | 666 return |
| 667 GetPrimaryRootWindowController()->workspace_controller()->GetGridSize(); | 667 GetPrimaryRootWindowController()->workspace_controller()->GetGridSize(); |
| 668 } | 668 } |
| 669 | 669 |
| 670 void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) { | 670 void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) { |
| 671 root->set_focus_manager(focus_manager_.get()); | 671 root->set_focus_manager(focus_manager_.get()); |
| 672 if (internal::DisplayController::IsExtendedDesktopEnabled()) { | 672 if (DisplayController::IsExtendedDesktopEnabled()) { |
| 673 internal::RootWindowController* controller = | 673 internal::RootWindowController* controller = |
| 674 new internal::RootWindowController(root); | 674 new internal::RootWindowController(root); |
| 675 controller->CreateContainers(); | 675 controller->CreateContainers(); |
| 676 InitRootWindowController(controller); | 676 InitRootWindowController(controller); |
| 677 controller->root_window_layout()->OnWindowResized(); | 677 controller->root_window_layout()->OnWindowResized(); |
| 678 desktop_background_controller_->OnRootWindowAdded(root); | 678 desktop_background_controller_->OnRootWindowAdded(root); |
| 679 root->ShowRootWindow(); | 679 root->ShowRootWindow(); |
| 680 // Activate new root for testing. | 680 // Activate new root for testing. |
| 681 active_root_window_ = root; | 681 active_root_window_ = root; |
| 682 } else { | 682 } else { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 } | 792 } |
| 793 | 793 |
| 794 void Shell::ShowCursor(bool visible) { | 794 void Shell::ShowCursor(bool visible) { |
| 795 RootWindowList root_windows = GetAllRootWindows(); | 795 RootWindowList root_windows = GetAllRootWindows(); |
| 796 for (RootWindowList::iterator iter = root_windows.begin(); | 796 for (RootWindowList::iterator iter = root_windows.begin(); |
| 797 iter != root_windows.end(); ++iter) | 797 iter != root_windows.end(); ++iter) |
| 798 (*iter)->ShowCursor(visible); | 798 (*iter)->ShowCursor(visible); |
| 799 } | 799 } |
| 800 | 800 |
| 801 } // namespace ash | 801 } // namespace ash |
| OLD | NEW |