| 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 #ifndef ASH_SHELL_H_ | 5 #ifndef ASH_SHELL_H_ |
| 6 #define ASH_SHELL_H_ | 6 #define ASH_SHELL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "ash/ash_export.h" | 12 #include "ash/ash_export.h" |
| 13 #include "ash/common/session/session_state_observer.h" |
| 13 #include "ash/metrics/user_metrics_recorder.h" | 14 #include "ash/metrics/user_metrics_recorder.h" |
| 14 #include "ash/public/cpp/shelf_types.h" | 15 #include "ash/public/cpp/shelf_types.h" |
| 15 #include "ash/wm/cursor_manager_chromeos.h" | 16 #include "ash/wm/cursor_manager_chromeos.h" |
| 16 #include "ash/wm/system_modal_container_event_filter_delegate.h" | 17 #include "ash/wm/system_modal_container_event_filter_delegate.h" |
| 17 #include "base/gtest_prod_util.h" | 18 #include "base/gtest_prod_util.h" |
| 18 #include "base/macros.h" | 19 #include "base/macros.h" |
| 19 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| 20 #include "base/observer_list.h" | 21 #include "base/observer_list.h" |
| 21 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
| 22 #include "ui/display/screen.h" | 23 #include "ui/display/screen.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 class ProjectingObserver; | 132 class ProjectingObserver; |
| 132 class ResizeShadowController; | 133 class ResizeShadowController; |
| 133 class ResolutionNotificationController; | 134 class ResolutionNotificationController; |
| 134 class RootWindowController; | 135 class RootWindowController; |
| 135 class ScopedOverviewAnimationSettingsFactoryAura; | 136 class ScopedOverviewAnimationSettingsFactoryAura; |
| 136 class ScreenLayoutObserver; | 137 class ScreenLayoutObserver; |
| 137 class ScreenOrientationController; | 138 class ScreenOrientationController; |
| 138 class ScreenshotController; | 139 class ScreenshotController; |
| 139 class ScreenPinningController; | 140 class ScreenPinningController; |
| 140 class ScreenPositionController; | 141 class ScreenPositionController; |
| 142 class SessionController; |
| 141 class SessionStateDelegate; | 143 class SessionStateDelegate; |
| 144 class ShelfController; |
| 145 class ShelfDelegate; |
| 146 class ShelfModel; |
| 147 class ShelfWindowWatcher; |
| 142 class ShellDelegate; | 148 class ShellDelegate; |
| 143 struct ShellInitParams; | 149 struct ShellInitParams; |
| 144 class ShellObserver; | 150 class ShellObserver; |
| 145 class ShutdownObserver; | 151 class ShutdownObserver; |
| 146 class SmsObserver; | 152 class SmsObserver; |
| 147 class StickyKeysController; | 153 class StickyKeysController; |
| 148 class SystemGestureEventFilter; | 154 class SystemGestureEventFilter; |
| 149 class SystemModalContainerEventFilter; | 155 class SystemModalContainerEventFilter; |
| 150 class SystemTray; | 156 class SystemTray; |
| 151 class SystemTrayController; | 157 class SystemTrayController; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 171 namespace test { | 177 namespace test { |
| 172 class ShellTestApi; | 178 class ShellTestApi; |
| 173 class SmsObserverTest; | 179 class SmsObserverTest; |
| 174 } | 180 } |
| 175 | 181 |
| 176 // Shell is a singleton object that presents the Shell API and implements the | 182 // Shell is a singleton object that presents the Shell API and implements the |
| 177 // RootWindow's delegate interface. | 183 // RootWindow's delegate interface. |
| 178 // | 184 // |
| 179 // Upon creation, the Shell sets itself as the RootWindow's delegate, which | 185 // Upon creation, the Shell sets itself as the RootWindow's delegate, which |
| 180 // takes ownership of the Shell. | 186 // takes ownership of the Shell. |
| 181 class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate, | 187 class ASH_EXPORT Shell : public SessionStateObserver, |
| 188 public SystemModalContainerEventFilterDelegate, |
| 182 public ui::EventTarget, | 189 public ui::EventTarget, |
| 183 public aura::client::ActivationChangeObserver { | 190 public aura::client::ActivationChangeObserver { |
| 184 public: | 191 public: |
| 185 typedef std::vector<RootWindowController*> RootWindowControllerList; | 192 typedef std::vector<RootWindowController*> RootWindowControllerList; |
| 186 | 193 |
| 187 // A shell must be explicitly created so that it can call |Init()| with the | 194 // A shell must be explicitly created so that it can call |Init()| with the |
| 188 // delegate set. |delegate| can be NULL (if not required for initialization). | 195 // delegate set. |delegate| can be NULL (if not required for initialization). |
| 189 // Takes ownership of |delegate|. | 196 // Takes ownership of |delegate|. |
| 190 static Shell* CreateInstance(const ShellInitParams& init_params); | 197 static Shell* CreateInstance(const ShellInitParams& init_params); |
| 191 | 198 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 return logout_confirmation_controller_.get(); | 326 return logout_confirmation_controller_.get(); |
| 320 } | 327 } |
| 321 MaximizeModeController* maximize_mode_controller() { | 328 MaximizeModeController* maximize_mode_controller() { |
| 322 return maximize_mode_controller_.get(); | 329 return maximize_mode_controller_.get(); |
| 323 } | 330 } |
| 324 MediaController* media_controller() { return media_controller_.get(); } | 331 MediaController* media_controller() { return media_controller_.get(); } |
| 325 MruWindowTracker* mru_window_tracker() { return mru_window_tracker_.get(); } | 332 MruWindowTracker* mru_window_tracker() { return mru_window_tracker_.get(); } |
| 326 NewWindowController* new_window_controller() { | 333 NewWindowController* new_window_controller() { |
| 327 return new_window_controller_.get(); | 334 return new_window_controller_.get(); |
| 328 } | 335 } |
| 336 SessionController* session_controller() { return session_controller_.get(); } |
| 337 ShelfController* shelf_controller() { return shelf_controller_.get(); } |
| 338 ShelfDelegate* shelf_delegate() { return shelf_delegate_.get(); } |
| 339 ShelfModel* shelf_model(); |
| 329 SystemTrayController* system_tray_controller() { | 340 SystemTrayController* system_tray_controller() { |
| 330 return system_tray_controller_.get(); | 341 return system_tray_controller_.get(); |
| 331 } | 342 } |
| 332 SystemTrayDelegate* system_tray_delegate() { | 343 SystemTrayDelegate* system_tray_delegate() { |
| 333 return system_tray_delegate_.get(); | 344 return system_tray_delegate_.get(); |
| 334 } | 345 } |
| 335 views::corewm::TooltipController* tooltip_controller() { | 346 views::corewm::TooltipController* tooltip_controller() { |
| 336 return tooltip_controller_.get(); | 347 return tooltip_controller_.get(); |
| 337 } | 348 } |
| 338 OverlayEventFilter* overlay_filter() { return overlay_filter_.get(); } | 349 OverlayEventFilter* overlay_filter() { return overlay_filter_.get(); } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 | 487 |
| 477 // NOTE: Prefer ScopedRootWindowForNewWindows when setting temporarily. | 488 // NOTE: Prefer ScopedRootWindowForNewWindows when setting temporarily. |
| 478 void set_root_window_for_new_windows(WmWindow* root) { | 489 void set_root_window_for_new_windows(WmWindow* root) { |
| 479 root_window_for_new_windows_ = root; | 490 root_window_for_new_windows_ = root; |
| 480 } | 491 } |
| 481 | 492 |
| 482 // Creates instance of FirstRunHelper. Caller is responsible for deleting | 493 // Creates instance of FirstRunHelper. Caller is responsible for deleting |
| 483 // returned object. | 494 // returned object. |
| 484 ash::FirstRunHelper* CreateFirstRunHelper(); | 495 ash::FirstRunHelper* CreateFirstRunHelper(); |
| 485 | 496 |
| 497 // Creates the ShelfView for each display and populates it with items. |
| 498 // Called after the user session is active and profile is available. |
| 499 void CreateShelfView(); |
| 500 |
| 486 void SetLargeCursorSizeInDip(int large_cursor_size_in_dip); | 501 void SetLargeCursorSizeInDip(int large_cursor_size_in_dip); |
| 487 | 502 |
| 488 // Toggles cursor compositing on/off. Native cursor is disabled when cursor | 503 // Toggles cursor compositing on/off. Native cursor is disabled when cursor |
| 489 // compositing is enabled, and vice versa. | 504 // compositing is enabled, and vice versa. |
| 490 void SetCursorCompositingEnabled(bool enabled); | 505 void SetCursorCompositingEnabled(bool enabled); |
| 491 | 506 |
| 492 StickyKeysController* sticky_keys_controller() { | 507 StickyKeysController* sticky_keys_controller() { |
| 493 return sticky_keys_controller_.get(); | 508 return sticky_keys_controller_.get(); |
| 494 } | 509 } |
| 495 | 510 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 511 // Shows the app list if it's not visible. Dismisses it otherwise. | 526 // Shows the app list if it's not visible. Dismisses it otherwise. |
| 512 void ToggleAppList(); | 527 void ToggleAppList(); |
| 513 | 528 |
| 514 // Returns app list actual visibility. This might differ from | 529 // Returns app list actual visibility. This might differ from |
| 515 // GetAppListTargetVisibility() when hiding animation is still in flight. | 530 // GetAppListTargetVisibility() when hiding animation is still in flight. |
| 516 bool IsAppListVisible() const; | 531 bool IsAppListVisible() const; |
| 517 | 532 |
| 518 // Returns app list target visibility. | 533 // Returns app list target visibility. |
| 519 bool GetAppListTargetVisibility() const; | 534 bool GetAppListTargetVisibility() const; |
| 520 | 535 |
| 536 // Called when the login status changes. |
| 537 // TODO(oshima): Investigate if we can merge this and |OnLoginStateChanged|. |
| 538 void UpdateAfterLoginStatusChange(LoginStatus status); |
| 539 |
| 521 // Notifies observers that maximize mode has started, windows might still | 540 // Notifies observers that maximize mode has started, windows might still |
| 522 // animate. | 541 // animate. |
| 523 void NotifyMaximizeModeStarted(); | 542 void NotifyMaximizeModeStarted(); |
| 524 | 543 |
| 525 // Notifies observers that maximize mode is about to end. | 544 // Notifies observers that maximize mode is about to end. |
| 526 void NotifyMaximizeModeEnding(); | 545 void NotifyMaximizeModeEnding(); |
| 527 | 546 |
| 528 // Notifies observers that maximize mode has ended, windows might still be | 547 // Notifies observers that maximize mode has ended, windows might still be |
| 529 // returning to their original position. | 548 // returning to their original position. |
| 530 void NotifyMaximizeModeEnded(); | 549 void NotifyMaximizeModeEnded(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 | 596 |
| 578 // Initializes virtual keyboard controller. | 597 // Initializes virtual keyboard controller. |
| 579 void InitKeyboard(); | 598 void InitKeyboard(); |
| 580 | 599 |
| 581 // Initializes the root window so that it can host browser windows. | 600 // Initializes the root window so that it can host browser windows. |
| 582 void InitRootWindow(aura::Window* root_window); | 601 void InitRootWindow(aura::Window* root_window); |
| 583 | 602 |
| 584 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate); | 603 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate); |
| 585 void DeleteSystemTrayDelegate(); | 604 void DeleteSystemTrayDelegate(); |
| 586 | 605 |
| 606 void CreateShelfDelegate(); |
| 607 |
| 587 // Destroys all child windows including widgets across all roots. | 608 // Destroys all child windows including widgets across all roots. |
| 588 void CloseAllRootWindowChildWindows(); | 609 void CloseAllRootWindowChildWindows(); |
| 589 | 610 |
| 590 // SystemModalContainerEventFilterDelegate: | 611 // SystemModalContainerEventFilterDelegate: |
| 591 bool CanWindowReceiveEvents(aura::Window* window) override; | 612 bool CanWindowReceiveEvents(aura::Window* window) override; |
| 592 | 613 |
| 593 // Overridden from ui::EventTarget: | 614 // Overridden from ui::EventTarget: |
| 594 bool CanAcceptEvent(const ui::Event& event) override; | 615 bool CanAcceptEvent(const ui::Event& event) override; |
| 595 EventTarget* GetParentTarget() override; | 616 EventTarget* GetParentTarget() override; |
| 596 std::unique_ptr<ui::EventTargetIterator> GetChildIterator() const override; | 617 std::unique_ptr<ui::EventTargetIterator> GetChildIterator() const override; |
| 597 ui::EventTargeter* GetEventTargeter() override; | 618 ui::EventTargeter* GetEventTargeter() override; |
| 598 | 619 |
| 599 // aura::client::ActivationChangeObserver: | 620 // aura::client::ActivationChangeObserver: |
| 600 void OnWindowActivated(ActivationReason reason, | 621 void OnWindowActivated(ActivationReason reason, |
| 601 aura::Window* gained_active, | 622 aura::Window* gained_active, |
| 602 aura::Window* lost_active) override; | 623 aura::Window* lost_active) override; |
| 603 | 624 |
| 625 // SessionStateObserver: |
| 626 void SessionStateChanged(session_manager::SessionState state) override; |
| 627 |
| 604 static Shell* instance_; | 628 static Shell* instance_; |
| 605 | 629 |
| 606 // Only valid in mash, for classic ash this is null. | 630 // Only valid in mash, for classic ash this is null. |
| 607 static aura::WindowTreeClient* window_tree_client_; | 631 static aura::WindowTreeClient* window_tree_client_; |
| 608 static aura::WindowManagerClient* window_manager_client_; | 632 static aura::WindowManagerClient* window_manager_client_; |
| 609 | 633 |
| 610 // If set before the Shell is initialized, the mouse cursor will be hidden | 634 // If set before the Shell is initialized, the mouse cursor will be hidden |
| 611 // when the screen is initially created. | 635 // when the screen is initially created. |
| 612 static bool initially_hide_cursor_; | 636 static bool initially_hide_cursor_; |
| 613 | 637 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 633 keyboard_brightness_control_delegate_; | 657 keyboard_brightness_control_delegate_; |
| 634 std::unique_ptr<KeyboardUI> keyboard_ui_; | 658 std::unique_ptr<KeyboardUI> keyboard_ui_; |
| 635 std::unique_ptr<LocaleNotificationController> locale_notification_controller_; | 659 std::unique_ptr<LocaleNotificationController> locale_notification_controller_; |
| 636 std::unique_ptr<LogoutConfirmationController> logout_confirmation_controller_; | 660 std::unique_ptr<LogoutConfirmationController> logout_confirmation_controller_; |
| 637 std::unique_ptr<MaximizeModeController> maximize_mode_controller_; | 661 std::unique_ptr<MaximizeModeController> maximize_mode_controller_; |
| 638 std::unique_ptr<MediaController> media_controller_; | 662 std::unique_ptr<MediaController> media_controller_; |
| 639 std::unique_ptr<MruWindowTracker> mru_window_tracker_; | 663 std::unique_ptr<MruWindowTracker> mru_window_tracker_; |
| 640 std::unique_ptr<NewWindowController> new_window_controller_; | 664 std::unique_ptr<NewWindowController> new_window_controller_; |
| 641 std::unique_ptr<PaletteDelegate> palette_delegate_; | 665 std::unique_ptr<PaletteDelegate> palette_delegate_; |
| 642 std::unique_ptr<ResizeShadowController> resize_shadow_controller_; | 666 std::unique_ptr<ResizeShadowController> resize_shadow_controller_; |
| 667 std::unique_ptr<SessionController> session_controller_; |
| 668 std::unique_ptr<ShelfController> shelf_controller_; |
| 669 std::unique_ptr<ShelfDelegate> shelf_delegate_; |
| 670 std::unique_ptr<ShelfWindowWatcher> shelf_window_watcher_; |
| 643 std::unique_ptr<ShellDelegate> shell_delegate_; | 671 std::unique_ptr<ShellDelegate> shell_delegate_; |
| 644 std::unique_ptr<SystemTrayController> system_tray_controller_; | 672 std::unique_ptr<SystemTrayController> system_tray_controller_; |
| 645 std::unique_ptr<SystemTrayDelegate> system_tray_delegate_; | 673 std::unique_ptr<SystemTrayDelegate> system_tray_delegate_; |
| 646 std::unique_ptr<ToastManager> toast_manager_; | 674 std::unique_ptr<ToastManager> toast_manager_; |
| 647 std::unique_ptr<WallpaperController> wallpaper_controller_; | 675 std::unique_ptr<WallpaperController> wallpaper_controller_; |
| 648 std::unique_ptr<WallpaperDelegate> wallpaper_delegate_; | 676 std::unique_ptr<WallpaperDelegate> wallpaper_delegate_; |
| 649 std::unique_ptr<::wm::ShadowController> shadow_controller_; | 677 std::unique_ptr<::wm::ShadowController> shadow_controller_; |
| 650 std::unique_ptr<::wm::VisibilityController> visibility_controller_; | 678 std::unique_ptr<::wm::VisibilityController> visibility_controller_; |
| 651 std::unique_ptr<::wm::WindowModalityController> window_modality_controller_; | 679 std::unique_ptr<::wm::WindowModalityController> window_modality_controller_; |
| 652 std::unique_ptr<app_list::AppList> app_list_; | 680 std::unique_ptr<app_list::AppList> app_list_; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 base::ObserverList<ShellObserver> shell_observers_; | 788 base::ObserverList<ShellObserver> shell_observers_; |
| 761 | 789 |
| 762 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; | 790 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; |
| 763 | 791 |
| 764 DISALLOW_COPY_AND_ASSIGN(Shell); | 792 DISALLOW_COPY_AND_ASSIGN(Shell); |
| 765 }; | 793 }; |
| 766 | 794 |
| 767 } // namespace ash | 795 } // namespace ash |
| 768 | 796 |
| 769 #endif // ASH_SHELL_H_ | 797 #endif // ASH_SHELL_H_ |
| OLD | NEW |