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 10 matching lines...) Expand all Loading... |
21 #include "ash/drag_drop/drag_drop_controller.h" | 21 #include "ash/drag_drop/drag_drop_controller.h" |
22 #include "ash/focus_cycler.h" | 22 #include "ash/focus_cycler.h" |
23 #include "ash/high_contrast/high_contrast_controller.h" | 23 #include "ash/high_contrast/high_contrast_controller.h" |
24 #include "ash/host/root_window_host_factory.h" | 24 #include "ash/host/root_window_host_factory.h" |
25 #include "ash/launcher/launcher_delegate.h" | 25 #include "ash/launcher/launcher_delegate.h" |
26 #include "ash/launcher/launcher_model.h" | 26 #include "ash/launcher/launcher_model.h" |
27 #include "ash/magnifier/magnification_controller.h" | 27 #include "ash/magnifier/magnification_controller.h" |
28 #include "ash/magnifier/partial_magnification_controller.h" | 28 #include "ash/magnifier/partial_magnification_controller.h" |
29 #include "ash/root_window_controller.h" | 29 #include "ash/root_window_controller.h" |
30 #include "ash/screen_ash.h" | 30 #include "ash/screen_ash.h" |
31 #include "ash/session_state_delegate.h" | |
32 #include "ash/shelf/shelf_layout_manager.h" | 31 #include "ash/shelf/shelf_layout_manager.h" |
33 #include "ash/shelf/shelf_widget.h" | 32 #include "ash/shelf/shelf_widget.h" |
34 #include "ash/shell_delegate.h" | 33 #include "ash/shell_delegate.h" |
35 #include "ash/shell_factory.h" | 34 #include "ash/shell_factory.h" |
36 #include "ash/shell_window_ids.h" | 35 #include "ash/shell_window_ids.h" |
37 #include "ash/system/status_area_widget.h" | 36 #include "ash/system/status_area_widget.h" |
38 #include "ash/system/tray/system_tray_delegate.h" | 37 #include "ash/system/tray/system_tray_delegate.h" |
39 #include "ash/system/tray/system_tray_notifier.h" | 38 #include "ash/system/tray/system_tray_notifier.h" |
40 #include "ash/wm/activation_controller.h" | 39 #include "ash/wm/activation_controller.h" |
41 #include "ash/wm/always_on_top_controller.h" | 40 #include "ash/wm/always_on_top_controller.h" |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 | 552 |
554 // This controller needs to be set before SetupManagedWindowMode. | 553 // This controller needs to be set before SetupManagedWindowMode. |
555 desktop_background_controller_.reset(new DesktopBackgroundController()); | 554 desktop_background_controller_.reset(new DesktopBackgroundController()); |
556 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); | 555 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); |
557 if (!user_wallpaper_delegate_.get()) | 556 if (!user_wallpaper_delegate_.get()) |
558 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); | 557 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); |
559 | 558 |
560 // StatusAreaWidget uses Shell's CapsLockDelegate. | 559 // StatusAreaWidget uses Shell's CapsLockDelegate. |
561 caps_lock_delegate_.reset(delegate_->CreateCapsLockDelegate()); | 560 caps_lock_delegate_.reset(delegate_->CreateCapsLockDelegate()); |
562 | 561 |
563 session_state_delegate_.reset(delegate_->CreateSessionStateDelegate()); | |
564 | |
565 if (!command_line->HasSwitch(views::corewm::switches::kNoDropShadows)) { | 562 if (!command_line->HasSwitch(views::corewm::switches::kNoDropShadows)) { |
566 resize_shadow_controller_.reset(new internal::ResizeShadowController()); | 563 resize_shadow_controller_.reset(new internal::ResizeShadowController()); |
567 shadow_controller_.reset( | 564 shadow_controller_.reset( |
568 new views::corewm::ShadowController(activation_client_)); | 565 new views::corewm::ShadowController(activation_client_)); |
569 } | 566 } |
570 | 567 |
571 // Create system_tray_notifier_ before the delegate. | 568 // Create system_tray_notifier_ before the delegate. |
572 system_tray_notifier_.reset(new ash::SystemTrayNotifier()); | 569 system_tray_notifier_.reset(new ash::SystemTrayNotifier()); |
573 | 570 |
574 // Initialize system_tray_delegate_ before initializing StatusAreaWidget. | 571 // Initialize system_tray_delegate_ before initializing StatusAreaWidget. |
(...skipping 23 matching lines...) Expand all Loading... |
598 cursor_manager_.SetCursor(ui::kCursorPointer); | 595 cursor_manager_.SetCursor(ui::kCursorPointer); |
599 | 596 |
600 if (!cursor_manager_.IsCursorVisible()) { | 597 if (!cursor_manager_.IsCursorVisible()) { |
601 // Cursor might have been hidden by something other than chrome. | 598 // Cursor might have been hidden by something other than chrome. |
602 // Let the first mouse event show the cursor. | 599 // Let the first mouse event show the cursor. |
603 env_filter_->set_cursor_hidden_by_filter(true); | 600 env_filter_->set_cursor_hidden_by_filter(true); |
604 } | 601 } |
605 } | 602 } |
606 | 603 |
607 void Shell::ShowContextMenu(const gfx::Point& location_in_screen) { | 604 void Shell::ShowContextMenu(const gfx::Point& location_in_screen) { |
608 // No context menus if there is no session with an active user. | 605 // No context menus if user have not logged in. |
609 if (!session_state_delegate_->HasActiveUser()) | 606 if (!delegate_->IsUserLoggedIn()) |
610 return; | 607 return; |
611 // No context menus when screen is locked. | 608 // No context menus when screen is locked. |
612 if (session_state_delegate_->IsScreenLocked()) | 609 if (IsScreenLocked()) |
613 return; | 610 return; |
614 | 611 |
615 aura::RootWindow* root = | 612 aura::RootWindow* root = |
616 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size())); | 613 wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size())); |
617 // TODO(oshima): The root and root window controller shouldn't be | 614 // TODO(oshima): The root and root window controller shouldn't be |
618 // NULL even for the out-of-bounds |location_in_screen| (It should | 615 // NULL even for the out-of-bounds |location_in_screen| (It should |
619 // return the primary root). Investigate why/how this is | 616 // return the primary root). Investigate why/how this is |
620 // happening. crbug.com/165214. | 617 // happening. crbug.com/165214. |
621 internal::RootWindowController* rwc = GetRootWindowController(root); | 618 internal::RootWindowController* rwc = GetRootWindowController(root); |
622 CHECK(rwc) << "root=" << root | 619 CHECK(rwc) << "root=" << root |
(...skipping 13 matching lines...) Expand all Loading... |
636 | 633 |
637 bool Shell::GetAppListTargetVisibility() const { | 634 bool Shell::GetAppListTargetVisibility() const { |
638 return app_list_controller_.get() && | 635 return app_list_controller_.get() && |
639 app_list_controller_->GetTargetVisibility(); | 636 app_list_controller_->GetTargetVisibility(); |
640 } | 637 } |
641 | 638 |
642 aura::Window* Shell::GetAppListWindow() { | 639 aura::Window* Shell::GetAppListWindow() { |
643 return app_list_controller_.get() ? app_list_controller_->GetWindow() : NULL; | 640 return app_list_controller_.get() ? app_list_controller_->GetWindow() : NULL; |
644 } | 641 } |
645 | 642 |
| 643 bool Shell::CanLockScreen() { |
| 644 return delegate_->CanLockScreen(); |
| 645 } |
| 646 |
| 647 bool Shell::IsScreenLocked() const { |
| 648 return delegate_->IsScreenLocked(); |
| 649 } |
| 650 |
646 bool Shell::IsSystemModalWindowOpen() const { | 651 bool Shell::IsSystemModalWindowOpen() const { |
647 if (simulate_modal_window_open_for_testing_) | 652 if (simulate_modal_window_open_for_testing_) |
648 return true; | 653 return true; |
649 const std::vector<aura::Window*> containers = GetContainersFromAllRootWindows( | 654 const std::vector<aura::Window*> containers = GetContainersFromAllRootWindows( |
650 internal::kShellWindowId_SystemModalContainer, NULL); | 655 internal::kShellWindowId_SystemModalContainer, NULL); |
651 for (std::vector<aura::Window*>::const_iterator cit = containers.begin(); | 656 for (std::vector<aura::Window*>::const_iterator cit = containers.begin(); |
652 cit != containers.end(); ++cit) { | 657 cit != containers.end(); ++cit) { |
653 for (aura::Window::Windows::const_iterator wit = (*cit)->children().begin(); | 658 for (aura::Window::Windows::const_iterator wit = (*cit)->children().begin(); |
654 wit != (*cit)->children().end(); ++wit) { | 659 wit != (*cit)->children().end(); ++wit) { |
655 if ((*wit)->GetProperty(aura::client::kModalKey) == | 660 if ((*wit)->GetProperty(aura::client::kModalKey) == |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 //////////////////////////////////////////////////////////////////////////////// | 944 //////////////////////////////////////////////////////////////////////////////// |
940 // Shell, aura::client::ActivationChangeObserver implementation: | 945 // Shell, aura::client::ActivationChangeObserver implementation: |
941 | 946 |
942 void Shell::OnWindowActivated(aura::Window* gained_active, | 947 void Shell::OnWindowActivated(aura::Window* gained_active, |
943 aura::Window* lost_active) { | 948 aura::Window* lost_active) { |
944 if (gained_active) | 949 if (gained_active) |
945 active_root_window_ = gained_active->GetRootWindow(); | 950 active_root_window_ = gained_active->GetRootWindow(); |
946 } | 951 } |
947 | 952 |
948 } // namespace ash | 953 } // namespace ash |
OLD | NEW |