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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 Shell::~Shell() { | 205 Shell::~Shell() { |
206 views::FocusManagerFactory::Install(NULL); | 206 views::FocusManagerFactory::Install(NULL); |
207 | 207 |
208 // Remove the focus from any window. This will prevent overhead and side | 208 // Remove the focus from any window. This will prevent overhead and side |
209 // effects (e.g. crashes) from changing focus during shutdown. | 209 // effects (e.g. crashes) from changing focus during shutdown. |
210 // See bug crbug.com/134502. | 210 // See bug crbug.com/134502. |
211 if (active_root_window_) | 211 if (active_root_window_) |
212 active_root_window_->GetFocusManager()->SetFocusedWindow(NULL, NULL); | 212 active_root_window_->GetFocusManager()->SetFocusedWindow(NULL, NULL); |
213 | 213 |
214 cursor_manager_.set_delegate(NULL); | |
215 | |
216 // Please keep in same order as in Init() because it's easy to miss one. | 214 // Please keep in same order as in Init() because it's easy to miss one. |
217 RemoveEnvEventFilter(user_activity_detector_.get()); | 215 RemoveEnvEventFilter(user_activity_detector_.get()); |
218 RemoveEnvEventFilter(event_rewriter_filter_.get()); | 216 RemoveEnvEventFilter(event_rewriter_filter_.get()); |
219 RemoveEnvEventFilter(overlay_filter_.get()); | 217 RemoveEnvEventFilter(overlay_filter_.get()); |
220 RemoveEnvEventFilter(input_method_filter_.get()); | 218 RemoveEnvEventFilter(input_method_filter_.get()); |
221 RemoveEnvEventFilter(window_modality_controller_.get()); | 219 RemoveEnvEventFilter(window_modality_controller_.get()); |
222 if (mouse_cursor_filter_.get()) | 220 if (mouse_cursor_filter_.get()) |
223 RemoveEnvEventFilter(mouse_cursor_filter_.get()); | 221 RemoveEnvEventFilter(mouse_cursor_filter_.get()); |
224 RemoveEnvEventFilter(system_gesture_filter_.get()); | 222 RemoveEnvEventFilter(system_gesture_filter_.get()); |
225 #if !defined(OS_MACOSX) | 223 #if !defined(OS_MACOSX) |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 } | 354 } |
357 | 355 |
358 void Shell::Init() { | 356 void Shell::Init() { |
359 // Install the custom factory first so that views::FocusManagers for Tray, | 357 // Install the custom factory first so that views::FocusManagers for Tray, |
360 // Launcher, and WallPaper could be created by the factory. | 358 // Launcher, and WallPaper could be created by the factory. |
361 views::FocusManagerFactory::Install(new AshFocusManagerFactory); | 359 views::FocusManagerFactory::Install(new AshFocusManagerFactory); |
362 | 360 |
363 env_filter_.reset(new aura::shared::CompoundEventFilter); | 361 env_filter_.reset(new aura::shared::CompoundEventFilter); |
364 AddEnvEventFilter(env_filter_.get()); | 362 AddEnvEventFilter(env_filter_.get()); |
365 | 363 |
366 cursor_manager_.set_delegate(this); | |
367 | |
368 focus_manager_.reset(new aura::FocusManager); | 364 focus_manager_.reset(new aura::FocusManager); |
369 activation_controller_.reset( | 365 activation_controller_.reset( |
370 new internal::ActivationController(focus_manager_.get())); | 366 new internal::ActivationController(focus_manager_.get())); |
371 | 367 |
372 screen_position_controller_.reset(new internal::ScreenPositionController); | 368 screen_position_controller_.reset(new internal::ScreenPositionController); |
373 display_controller_.reset(new DisplayController); | 369 display_controller_.reset(new DisplayController); |
374 display_controller_->InitPrimaryDisplay(); | 370 display_controller_->InitPrimaryDisplay(); |
375 aura::RootWindow* root_window = display_controller_->GetPrimaryRootWindow(); | 371 aura::RootWindow* root_window = display_controller_->GetPrimaryRootWindow(); |
376 active_root_window_ = root_window; | 372 active_root_window_ = root_window; |
377 | 373 |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 GetPrimaryRootWindow(), | 751 GetPrimaryRootWindow(), |
756 internal::kShellWindowId_PanelContainer); | 752 internal::kShellWindowId_PanelContainer); |
757 panel_layout_manager_ = | 753 panel_layout_manager_ = |
758 new internal::PanelLayoutManager(panel_container); | 754 new internal::PanelLayoutManager(panel_container); |
759 panel_container->SetEventFilter( | 755 panel_container->SetEventFilter( |
760 new internal::PanelWindowEventFilter( | 756 new internal::PanelWindowEventFilter( |
761 panel_container, panel_layout_manager_)); | 757 panel_container, panel_layout_manager_)); |
762 panel_container->SetLayoutManager(panel_layout_manager_); | 758 panel_container->SetLayoutManager(panel_layout_manager_); |
763 } | 759 } |
764 | 760 |
765 void Shell::SetCursor(gfx::NativeCursor cursor) { | |
766 RootWindowList root_windows = GetAllRootWindows(); | |
767 for (RootWindowList::iterator iter = root_windows.begin(); | |
768 iter != root_windows.end(); ++iter) | |
769 (*iter)->SetCursor(cursor); | |
770 } | |
771 | |
772 void Shell::ShowCursor(bool visible) { | |
773 RootWindowList root_windows = GetAllRootWindows(); | |
774 for (RootWindowList::iterator iter = root_windows.begin(); | |
775 iter != root_windows.end(); ++iter) | |
776 (*iter)->ShowCursor(visible); | |
777 } | |
778 | |
779 } // namespace ash | 761 } // namespace ash |
OLD | NEW |