| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_COMMON_WM_SHELL_H_ | 5 #ifndef ASH_COMMON_WM_SHELL_H_ |
| 6 #define ASH_COMMON_WM_SHELL_H_ | 6 #define ASH_COMMON_WM_SHELL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "ash/ash_export.h" | 13 #include "ash/ash_export.h" |
| 14 #include "ash/common/metrics/gesture_action_type.h" | 14 #include "ash/common/metrics/gesture_action_type.h" |
| 15 #include "ash/common/metrics/user_metrics_action.h" | 15 #include "ash/common/metrics/user_metrics_action.h" |
| 16 #include "ash/common/session/session_state_observer.h" | 16 #include "ash/common/session/session_state_observer.h" |
| 17 #include "ash/common/wm/lock_state_observer.h" | 17 #include "ash/common/wm/lock_state_observer.h" |
| 18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| 19 #include "components/ui_devtools/devtools_server.h" | 19 #include "components/ui_devtools/devtools_server.h" |
| 20 #include "ui/base/ui_base_types.h" | 20 #include "ui/base/ui_base_types.h" |
| 21 #include "ui/compositor/layer_type.h" | 21 #include "ui/compositor/layer_type.h" |
| 22 #include "ui/wm/public/activation_change_observer.h" | |
| 23 #include "ui/wm/public/window_types.h" | 22 #include "ui/wm/public/window_types.h" |
| 24 | 23 |
| 25 namespace app_list { | 24 namespace app_list { |
| 26 class AppList; | 25 class AppList; |
| 27 } | 26 } |
| 28 | 27 |
| 29 namespace base { | 28 namespace base { |
| 30 class SequencedWorkerPool; | 29 class SequencedWorkerPool; |
| 31 } | 30 } |
| 32 | 31 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 95 |
| 97 enum class LoginStatus; | 96 enum class LoginStatus; |
| 98 enum class TaskSwitchSource; | 97 enum class TaskSwitchSource; |
| 99 | 98 |
| 100 namespace wm { | 99 namespace wm { |
| 101 class MaximizeModeEventHandler; | 100 class MaximizeModeEventHandler; |
| 102 class WindowState; | 101 class WindowState; |
| 103 } | 102 } |
| 104 | 103 |
| 105 // Similar to ash::Shell. Eventually the two will be merged. | 104 // Similar to ash::Shell. Eventually the two will be merged. |
| 106 class ASH_EXPORT WmShell : public SessionStateObserver, | 105 class ASH_EXPORT WmShell : public SessionStateObserver { |
| 107 public aura::client::ActivationChangeObserver { | |
| 108 public: | 106 public: |
| 109 ~WmShell() override; | 107 ~WmShell() override; |
| 110 | 108 |
| 111 // This is necessary for a handful of places that is difficult to plumb | 109 // This is necessary for a handful of places that is difficult to plumb |
| 112 // through context. | 110 // through context. |
| 113 static void Set(WmShell* instance); | 111 static void Set(WmShell* instance); |
| 114 static WmShell* Get(); | 112 static WmShell* Get(); |
| 115 static bool HasInstance() { return instance_ != nullptr; } | 113 static bool HasInstance() { return instance_ != nullptr; } |
| 116 | 114 |
| 117 virtual void Initialize(const scoped_refptr<base::SequencedWorkerPool>& pool); | 115 virtual void Initialize(const scoped_refptr<base::SequencedWorkerPool>& pool); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 154 } |
| 157 | 155 |
| 158 MruWindowTracker* mru_window_tracker() { return mru_window_tracker_.get(); } | 156 MruWindowTracker* mru_window_tracker() { return mru_window_tracker_.get(); } |
| 159 | 157 |
| 160 MediaController* media_controller() { return media_controller_.get(); } | 158 MediaController* media_controller() { return media_controller_.get(); } |
| 161 | 159 |
| 162 NewWindowController* new_window_controller() { | 160 NewWindowController* new_window_controller() { |
| 163 return new_window_controller_.get(); | 161 return new_window_controller_.get(); |
| 164 } | 162 } |
| 165 | 163 |
| 166 // NOTE: Prefer ScopedRootWindowForNewWindows when setting temporarily. | |
| 167 void set_root_window_for_new_windows(WmWindow* root) { | |
| 168 root_window_for_new_windows_ = root; | |
| 169 } | |
| 170 | |
| 171 PaletteDelegate* palette_delegate() { return palette_delegate_.get(); } | 164 PaletteDelegate* palette_delegate() { return palette_delegate_.get(); } |
| 172 | 165 |
| 173 preferences::PrefClientStore* pref_store() { return pref_store_.get(); } | 166 preferences::PrefClientStore* pref_store() { return pref_store_.get(); } |
| 174 | 167 |
| 175 SessionController* session_controller() { return session_controller_.get(); } | 168 SessionController* session_controller() { return session_controller_.get(); } |
| 176 | 169 |
| 177 ShelfController* shelf_controller() { return shelf_controller_.get(); } | 170 ShelfController* shelf_controller() { return shelf_controller_.get(); } |
| 178 | 171 |
| 179 ShelfDelegate* shelf_delegate() { return shelf_delegate_.get(); } | 172 ShelfDelegate* shelf_delegate() { return shelf_delegate_.get(); } |
| 180 | 173 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 virtual WmWindow* GetCaptureWindow() = 0; | 223 virtual WmWindow* GetCaptureWindow() = 0; |
| 231 | 224 |
| 232 // Convenience for GetPrimaryRootWindow()->GetRootWindowController(). | 225 // Convenience for GetPrimaryRootWindow()->GetRootWindowController(). |
| 233 RootWindowController* GetPrimaryRootWindowController(); | 226 RootWindowController* GetPrimaryRootWindowController(); |
| 234 | 227 |
| 235 virtual WmWindow* GetPrimaryRootWindow() = 0; | 228 virtual WmWindow* GetPrimaryRootWindow() = 0; |
| 236 | 229 |
| 237 // Returns the root window for the specified display. | 230 // Returns the root window for the specified display. |
| 238 virtual WmWindow* GetRootWindowForDisplayId(int64_t display_id) = 0; | 231 virtual WmWindow* GetRootWindowForDisplayId(int64_t display_id) = 0; |
| 239 | 232 |
| 240 // Returns the root window that newly created windows should be added to. | |
| 241 // Value can be temporarily overridden using ScopedRootWindowForNewWindows. | |
| 242 // NOTE: this returns the root, newly created window should be added to the | |
| 243 // appropriate container in the returned window. | |
| 244 WmWindow* GetRootWindowForNewWindows(); | |
| 245 | |
| 246 // Retuns the display info associated with |display_id|. | 233 // Retuns the display info associated with |display_id|. |
| 247 // TODO(mash): Remove when DisplayManager has been moved. crbug.com/622480 | 234 // TODO(mash): Remove when DisplayManager has been moved. crbug.com/622480 |
| 248 virtual const display::ManagedDisplayInfo& GetDisplayInfo( | 235 virtual const display::ManagedDisplayInfo& GetDisplayInfo( |
| 249 int64_t display_id) const = 0; | 236 int64_t display_id) const = 0; |
| 250 | 237 |
| 251 // Matches that of DisplayManager::IsActiveDisplayId(). | 238 // Matches that of DisplayManager::IsActiveDisplayId(). |
| 252 // TODO(mash): Remove when DisplayManager has been moved. crbug.com/622480 | 239 // TODO(mash): Remove when DisplayManager has been moved. crbug.com/622480 |
| 253 virtual bool IsActiveDisplayId(int64_t display_id) const = 0; | 240 virtual bool IsActiveDisplayId(int64_t display_id) const = 0; |
| 254 | 241 |
| 255 // Returns true if the desktop is in unified mode and there are no mirroring | 242 // Returns true if the desktop is in unified mode and there are no mirroring |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 void DeleteToastManager(); | 466 void DeleteToastManager(); |
| 480 | 467 |
| 481 void SetAcceleratorController( | 468 void SetAcceleratorController( |
| 482 std::unique_ptr<AcceleratorController> accelerator_controller); | 469 std::unique_ptr<AcceleratorController> accelerator_controller); |
| 483 | 470 |
| 484 // SessionStateObserver: | 471 // SessionStateObserver: |
| 485 void SessionStateChanged(session_manager::SessionState state) override; | 472 void SessionStateChanged(session_manager::SessionState state) override; |
| 486 | 473 |
| 487 private: | 474 private: |
| 488 friend class AcceleratorControllerTest; | 475 friend class AcceleratorControllerTest; |
| 489 friend class ScopedRootWindowForNewWindows; | |
| 490 friend class Shell; | 476 friend class Shell; |
| 491 friend class WmShellTestApi; | 477 friend class WmShellTestApi; |
| 492 | 478 |
| 493 // aura::client::ActivationChangeObserver: | |
| 494 void OnWindowActivated(ActivationReason reason, | |
| 495 aura::Window* gained_active, | |
| 496 aura::Window* lost_active) override; | |
| 497 | |
| 498 static WmShell* instance_; | 479 static WmShell* instance_; |
| 499 | 480 |
| 500 base::ObserverList<ShellObserver> shell_observers_; | 481 base::ObserverList<ShellObserver> shell_observers_; |
| 501 std::unique_ptr<ShellDelegate> delegate_; | 482 std::unique_ptr<ShellDelegate> delegate_; |
| 502 | 483 |
| 503 scoped_refptr<preferences::PrefClientStore> pref_store_; | 484 scoped_refptr<preferences::PrefClientStore> pref_store_; |
| 504 | 485 |
| 505 std::unique_ptr<AcceleratorController> accelerator_controller_; | 486 std::unique_ptr<AcceleratorController> accelerator_controller_; |
| 506 std::unique_ptr<AccessibilityDelegate> accessibility_delegate_; | 487 std::unique_ptr<AccessibilityDelegate> accessibility_delegate_; |
| 507 std::unique_ptr<app_list::AppList> app_list_; | 488 std::unique_ptr<app_list::AppList> app_list_; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 530 std::unique_ptr<ToastManager> toast_manager_; | 511 std::unique_ptr<ToastManager> toast_manager_; |
| 531 std::unique_ptr<VpnList> vpn_list_; | 512 std::unique_ptr<VpnList> vpn_list_; |
| 532 std::unique_ptr<WallpaperController> wallpaper_controller_; | 513 std::unique_ptr<WallpaperController> wallpaper_controller_; |
| 533 std::unique_ptr<WallpaperDelegate> wallpaper_delegate_; | 514 std::unique_ptr<WallpaperDelegate> wallpaper_delegate_; |
| 534 std::unique_ptr<WindowCycleController> window_cycle_controller_; | 515 std::unique_ptr<WindowCycleController> window_cycle_controller_; |
| 535 std::unique_ptr<WindowSelectorController> window_selector_controller_; | 516 std::unique_ptr<WindowSelectorController> window_selector_controller_; |
| 536 std::unique_ptr<ui::devtools::UiDevToolsServer> devtools_server_; | 517 std::unique_ptr<ui::devtools::UiDevToolsServer> devtools_server_; |
| 537 | 518 |
| 538 base::ObserverList<LockStateObserver> lock_state_observers_; | 519 base::ObserverList<LockStateObserver> lock_state_observers_; |
| 539 | 520 |
| 540 // See comment for GetRootWindowForNewWindows(). | |
| 541 WmWindow* root_window_for_new_windows_ = nullptr; | |
| 542 WmWindow* scoped_root_window_for_new_windows_ = nullptr; | |
| 543 | |
| 544 bool simulate_modal_window_open_for_testing_ = false; | 521 bool simulate_modal_window_open_for_testing_ = false; |
| 545 | 522 |
| 546 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; | 523 scoped_refptr<base::SequencedWorkerPool> blocking_pool_; |
| 547 }; | 524 }; |
| 548 | 525 |
| 549 } // namespace ash | 526 } // namespace ash |
| 550 | 527 |
| 551 #endif // ASH_COMMON_WM_SHELL_H_ | 528 #endif // ASH_COMMON_WM_SHELL_H_ |
| OLD | NEW |