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 24 matching lines...) Expand all Loading... |
35 #include "ash/session_state_delegate.h" | 35 #include "ash/session_state_delegate.h" |
36 #include "ash/shelf/shelf_layout_manager.h" | 36 #include "ash/shelf/shelf_layout_manager.h" |
37 #include "ash/shelf/shelf_widget.h" | 37 #include "ash/shelf/shelf_widget.h" |
38 #include "ash/shell_delegate.h" | 38 #include "ash/shell_delegate.h" |
39 #include "ash/shell_factory.h" | 39 #include "ash/shell_factory.h" |
40 #include "ash/shell_window_ids.h" | 40 #include "ash/shell_window_ids.h" |
41 #include "ash/system/locale/locale_notification_controller.h" | 41 #include "ash/system/locale/locale_notification_controller.h" |
42 #include "ash/system/status_area_widget.h" | 42 #include "ash/system/status_area_widget.h" |
43 #include "ash/system/tray/system_tray_delegate.h" | 43 #include "ash/system/tray/system_tray_delegate.h" |
44 #include "ash/system/tray/system_tray_notifier.h" | 44 #include "ash/system/tray/system_tray_notifier.h" |
45 #include "ash/wm/activation_controller.h" | |
46 #include "ash/wm/app_list_controller.h" | 45 #include "ash/wm/app_list_controller.h" |
47 #include "ash/wm/ash_activation_controller.h" | |
48 #include "ash/wm/ash_focus_rules.h" | 46 #include "ash/wm/ash_focus_rules.h" |
49 #include "ash/wm/ash_native_cursor_manager.h" | 47 #include "ash/wm/ash_native_cursor_manager.h" |
50 #include "ash/wm/base_layout_manager.h" | 48 #include "ash/wm/base_layout_manager.h" |
51 #include "ash/wm/coordinate_conversion.h" | 49 #include "ash/wm/coordinate_conversion.h" |
52 #include "ash/wm/custom_frame_view_ash.h" | 50 #include "ash/wm/custom_frame_view_ash.h" |
53 #include "ash/wm/event_client_impl.h" | 51 #include "ash/wm/event_client_impl.h" |
54 #include "ash/wm/event_rewriter_event_filter.h" | 52 #include "ash/wm/event_rewriter_event_filter.h" |
55 #include "ash/wm/lock_state_controller.h" | 53 #include "ash/wm/lock_state_controller.h" |
56 #include "ash/wm/lock_state_controller_impl2.h" | 54 #include "ash/wm/lock_state_controller_impl2.h" |
57 #include "ash/wm/mru_window_tracker.h" | 55 #include "ash/wm/mru_window_tracker.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 313 |
316 resolution_notification_controller_.reset(); | 314 resolution_notification_controller_.reset(); |
317 | 315 |
318 // This also deletes all RootWindows. Note that we invoke Shutdown() on | 316 // This also deletes all RootWindows. Note that we invoke Shutdown() on |
319 // DisplayController before resetting |display_controller_|, since destruction | 317 // DisplayController before resetting |display_controller_|, since destruction |
320 // of its owned RootWindowControllers relies on the value. | 318 // of its owned RootWindowControllers relies on the value. |
321 display_controller_->Shutdown(); | 319 display_controller_->Shutdown(); |
322 display_controller_.reset(); | 320 display_controller_.reset(); |
323 screen_position_controller_.reset(); | 321 screen_position_controller_.reset(); |
324 | 322 |
325 // Delete the activation controller after other controllers and launcher | |
326 // because they might have registered ActivationChangeObserver. | |
327 activation_controller_.reset(); | |
328 | |
329 #if defined(OS_CHROMEOS) && defined(USE_X11) | 323 #if defined(OS_CHROMEOS) && defined(USE_X11) |
330 if (display_change_observer_) | 324 if (display_change_observer_) |
331 output_configurator_->RemoveObserver(display_change_observer_.get()); | 325 output_configurator_->RemoveObserver(display_change_observer_.get()); |
332 if (output_configurator_animation_) | 326 if (output_configurator_animation_) |
333 output_configurator_->RemoveObserver(output_configurator_animation_.get()); | 327 output_configurator_->RemoveObserver(output_configurator_animation_.get()); |
334 if (display_error_observer_) | 328 if (display_error_observer_) |
335 output_configurator_->RemoveObserver(display_error_observer_.get()); | 329 output_configurator_->RemoveObserver(display_error_observer_.get()); |
336 base::MessagePumpAuraX11::Current()->RemoveDispatcherForRootWindow( | 330 base::MessagePumpAuraX11::Current()->RemoveDispatcherForRootWindow( |
337 output_configurator()); | 331 output_configurator()); |
338 base::MessagePumpAuraX11::Current()->RemoveObserver(output_configurator()); | 332 base::MessagePumpAuraX11::Current()->RemoveObserver(output_configurator()); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 // Launcher, and WallPaper could be created by the factory. | 469 // Launcher, and WallPaper could be created by the factory. |
476 views::FocusManagerFactory::Install(new AshFocusManagerFactory); | 470 views::FocusManagerFactory::Install(new AshFocusManagerFactory); |
477 | 471 |
478 env_filter_.reset(new views::corewm::CompoundEventFilter); | 472 env_filter_.reset(new views::corewm::CompoundEventFilter); |
479 AddPreTargetHandler(env_filter_.get()); | 473 AddPreTargetHandler(env_filter_.get()); |
480 | 474 |
481 // Env creates the compositor. Historically it seems to have been implicitly | 475 // Env creates the compositor. Historically it seems to have been implicitly |
482 // initialized first by the ActivationController, but now that FocusController | 476 // initialized first by the ActivationController, but now that FocusController |
483 // no longer does this we need to do it explicitly. | 477 // no longer does this we need to do it explicitly. |
484 aura::Env::GetInstance(); | 478 aura::Env::GetInstance(); |
485 if (views::corewm::UseFocusController()) { | 479 views::corewm::FocusController* focus_controller = |
486 views::corewm::FocusController* focus_controller = | 480 new views::corewm::FocusController(new wm::AshFocusRules); |
487 new views::corewm::FocusController(new wm::AshFocusRules); | 481 focus_client_.reset(focus_controller); |
488 focus_client_.reset(focus_controller); | 482 activation_client_ = focus_controller; |
489 activation_client_ = focus_controller; | 483 activation_client_->AddObserver(this); |
490 activation_client_->AddObserver(this); | |
491 } else { | |
492 focus_client_.reset(new aura::FocusManager); | |
493 activation_controller_.reset( | |
494 new internal::ActivationController( | |
495 focus_client_.get(), | |
496 new internal::AshActivationController)); | |
497 activation_client_ = activation_controller_.get(); | |
498 AddPreTargetHandler(activation_controller_.get()); | |
499 } | |
500 | |
501 focus_cycler_.reset(new internal::FocusCycler()); | 484 focus_cycler_.reset(new internal::FocusCycler()); |
502 | 485 |
503 screen_position_controller_.reset(new internal::ScreenPositionController); | 486 screen_position_controller_.reset(new internal::ScreenPositionController); |
504 root_window_host_factory_.reset(delegate_->CreateRootWindowHostFactory()); | 487 root_window_host_factory_.reset(delegate_->CreateRootWindowHostFactory()); |
505 | 488 |
506 display_controller_->Start(); | 489 display_controller_->Start(); |
507 display_controller_->InitPrimaryDisplay(); | 490 display_controller_->InitPrimaryDisplay(); |
508 aura::RootWindow* root_window = display_controller_->GetPrimaryRootWindow(); | 491 aura::RootWindow* root_window = display_controller_->GetPrimaryRootWindow(); |
509 target_root_window_ = root_window; | 492 target_root_window_ = root_window; |
510 | 493 |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 | 903 |
921 aura::RootWindow* root_window = controller->root_window(); | 904 aura::RootWindow* root_window = controller->root_window(); |
922 DCHECK(activation_client_); | 905 DCHECK(activation_client_); |
923 DCHECK(visibility_controller_.get()); | 906 DCHECK(visibility_controller_.get()); |
924 DCHECK(drag_drop_controller_.get()); | 907 DCHECK(drag_drop_controller_.get()); |
925 DCHECK(window_cycle_controller_.get()); | 908 DCHECK(window_cycle_controller_.get()); |
926 | 909 |
927 aura::client::SetFocusClient(root_window, focus_client_.get()); | 910 aura::client::SetFocusClient(root_window, focus_client_.get()); |
928 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window); | 911 input_method_filter_->SetInputMethodPropertyInRootWindow(root_window); |
929 aura::client::SetActivationClient(root_window, activation_client_); | 912 aura::client::SetActivationClient(root_window, activation_client_); |
930 if (views::corewm::UseFocusController()) { | 913 views::corewm::FocusController* focus_controller = |
931 views::corewm::FocusController* controller = | 914 static_cast<views::corewm::FocusController*>(activation_client_); |
932 static_cast<views::corewm::FocusController*>(activation_client_); | 915 root_window->AddPreTargetHandler(focus_controller); |
933 root_window->AddPreTargetHandler(controller); | |
934 } | |
935 aura::client::SetVisibilityClient(root_window, visibility_controller_.get()); | 916 aura::client::SetVisibilityClient(root_window, visibility_controller_.get()); |
936 aura::client::SetDragDropClient(root_window, drag_drop_controller_.get()); | 917 aura::client::SetDragDropClient(root_window, drag_drop_controller_.get()); |
937 aura::client::SetScreenPositionClient(root_window, | 918 aura::client::SetScreenPositionClient(root_window, |
938 screen_position_controller_.get()); | 919 screen_position_controller_.get()); |
939 aura::client::SetCursorClient(root_window, &cursor_manager_); | 920 aura::client::SetCursorClient(root_window, &cursor_manager_); |
940 aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); | 921 aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); |
941 aura::client::SetEventClient(root_window, event_client_.get()); | 922 aura::client::SetEventClient(root_window, event_client_.get()); |
942 | 923 |
943 if (nested_dispatcher_controller_) { | 924 if (nested_dispatcher_controller_) { |
944 aura::client::SetDispatcherClient(root_window, | 925 aura::client::SetDispatcherClient(root_window, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 //////////////////////////////////////////////////////////////////////////////// | 965 //////////////////////////////////////////////////////////////////////////////// |
985 // Shell, aura::client::ActivationChangeObserver implementation: | 966 // Shell, aura::client::ActivationChangeObserver implementation: |
986 | 967 |
987 void Shell::OnWindowActivated(aura::Window* gained_active, | 968 void Shell::OnWindowActivated(aura::Window* gained_active, |
988 aura::Window* lost_active) { | 969 aura::Window* lost_active) { |
989 if (gained_active) | 970 if (gained_active) |
990 target_root_window_ = gained_active->GetRootWindow(); | 971 target_root_window_ = gained_active->GetRootWindow(); |
991 } | 972 } |
992 | 973 |
993 } // namespace ash | 974 } // namespace ash |
OLD | NEW |