Chromium Code Reviews| 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_AURA_WM_SHELL_AURA_H_ | 5 #ifndef ASH_AURA_WM_SHELL_AURA_H_ |
| 6 #define ASH_AURA_WM_SHELL_AURA_H_ | 6 #define ASH_AURA_WM_SHELL_AURA_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/aura/wm_lookup_aura.h" | 9 #include "ash/aura/wm_lookup_aura.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| 11 #include "ash/display/window_tree_host_manager.h" | 11 #include "ash/display/window_tree_host_manager.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "ui/wm/public/activation_change_observer.h" | 14 #include "ui/wm/public/activation_change_observer.h" |
| 15 | 15 |
| 16 namespace ash { | 16 namespace ash { |
| 17 | 17 |
| 18 class WmShellCommon; | 18 class Shell; |
| 19 | 19 |
| 20 class ASH_EXPORT WmShellAura : public WmShell, | 20 class ASH_EXPORT WmShellAura : public WmShell, |
| 21 public aura::client::ActivationChangeObserver, | 21 public aura::client::ActivationChangeObserver, |
| 22 public WindowTreeHostManager::Observer { | 22 public WindowTreeHostManager::Observer { |
| 23 public: | 23 public: |
| 24 // |shell_common| is not owned by this class and must outlive this class. | 24 WmShellAura(); |
| 25 explicit WmShellAura(WmShellCommon* wm_shell_common); | |
| 26 ~WmShellAura() override; | 25 ~WmShellAura() override; |
| 27 | 26 |
| 28 static WmShellAura* Get(); | 27 static WmShellAura* Get(); |
| 29 | 28 |
| 30 // Called early in shutdown sequence. | 29 // Called early in shutdown sequence. |
| 31 void PrepareForShutdown(); | 30 void PrepareForShutdown(); |
| 32 | 31 |
| 33 // WmShell: | 32 // WmShell: |
| 34 MruWindowTracker* GetMruWindowTracker() override; | |
| 35 WmWindow* NewContainerWindow() override; | 33 WmWindow* NewContainerWindow() override; |
| 36 WmWindow* GetFocusedWindow() override; | 34 WmWindow* GetFocusedWindow() override; |
| 37 WmWindow* GetActiveWindow() override; | 35 WmWindow* GetActiveWindow() override; |
| 38 WmWindow* GetPrimaryRootWindow() override; | 36 WmWindow* GetPrimaryRootWindow() override; |
| 39 WmWindow* GetRootWindowForDisplayId(int64_t display_id) override; | 37 WmWindow* GetRootWindowForDisplayId(int64_t display_id) override; |
| 40 WmWindow* GetRootWindowForNewWindows() override; | 38 WmWindow* GetRootWindowForNewWindows() override; |
| 41 const DisplayInfo& GetDisplayInfo(int64_t display_id) const override; | 39 const DisplayInfo& GetDisplayInfo(int64_t display_id) const override; |
| 42 bool IsForceMaximizeOnFirstRun() override; | 40 bool IsForceMaximizeOnFirstRun() override; |
| 43 bool IsPinned() override; | 41 bool IsPinned() override; |
| 44 void SetPinnedWindow(WmWindow* window) override; | 42 void SetPinnedWindow(WmWindow* window) override; |
| 45 bool CanShowWindowForUser(WmWindow* window) override; | 43 bool CanShowWindowForUser(WmWindow* window) override; |
| 46 void LockCursor() override; | 44 void LockCursor() override; |
| 47 void UnlockCursor() override; | 45 void UnlockCursor() override; |
| 48 std::vector<WmWindow*> GetAllRootWindows() override; | 46 std::vector<WmWindow*> GetAllRootWindows() override; |
| 49 void RecordUserMetricsAction(UserMetricsAction action) override; | 47 void RecordUserMetricsAction(UserMetricsAction action) override; |
| 50 std::unique_ptr<WindowResizer> CreateDragWindowResizer( | 48 std::unique_ptr<WindowResizer> CreateDragWindowResizer( |
| 51 std::unique_ptr<WindowResizer> next_window_resizer, | 49 std::unique_ptr<WindowResizer> next_window_resizer, |
| 52 wm::WindowState* window_state) override; | 50 wm::WindowState* window_state) override; |
| 53 std::unique_ptr<wm::MaximizeModeEventHandler> CreateMaximizeModeEventHandler() | 51 std::unique_ptr<wm::MaximizeModeEventHandler> CreateMaximizeModeEventHandler() |
| 54 override; | 52 override; |
| 55 void OnOverviewModeStarting() override; | 53 void OnOverviewModeStarting() override; |
| 56 void OnOverviewModeEnded() override; | 54 void OnOverviewModeEnded() override; |
| 57 AccessibilityDelegate* GetAccessibilityDelegate() override; | 55 AccessibilityDelegate* GetAccessibilityDelegate() override; |
| 58 SessionStateDelegate* GetSessionStateDelegate() override; | 56 SessionStateDelegate* GetSessionStateDelegate() override; |
| 59 void AddActivationObserver(WmActivationObserver* observer) override; | 57 void AddActivationObserver(WmActivationObserver* observer) override; |
| 60 void RemoveActivationObserver(WmActivationObserver* observer) override; | 58 void RemoveActivationObserver(WmActivationObserver* observer) override; |
| 61 void AddDisplayObserver(WmDisplayObserver* observer) override; | 59 void AddDisplayObserver(WmDisplayObserver* observer) override; |
| 62 void RemoveDisplayObserver(WmDisplayObserver* observer) override; | 60 void RemoveDisplayObserver(WmDisplayObserver* observer) override; |
| 63 void AddShellObserver(ShellObserver* observer) override; | |
| 64 void RemoveShellObserver(ShellObserver* observer) override; | |
| 65 void AddPointerWatcher(views::PointerWatcher* watcher) override; | 61 void AddPointerWatcher(views::PointerWatcher* watcher) override; |
| 66 void RemovePointerWatcher(views::PointerWatcher* watcher) override; | 62 void RemovePointerWatcher(views::PointerWatcher* watcher) override; |
| 67 #if defined(OS_CHROMEOS) | 63 #if defined(OS_CHROMEOS) |
| 68 void ToggleIgnoreExternalKeyboard() override; | 64 void ToggleIgnoreExternalKeyboard() override; |
| 69 #endif | 65 #endif |
| 70 | 66 |
| 71 private: | 67 private: |
| 68 friend class Shell; | |
|
James Cook
2016/06/30 21:29:20
Does it need to be a friend? It looks like you jus
sky
2016/06/30 21:49:41
It's called from Shell, which is why I made this c
| |
| 69 | |
| 72 // aura::client::ActivationChangeObserver: | 70 // aura::client::ActivationChangeObserver: |
| 73 void OnWindowActivated(ActivationReason reason, | 71 void OnWindowActivated(ActivationReason reason, |
| 74 aura::Window* gained_active, | 72 aura::Window* gained_active, |
| 75 aura::Window* lost_active) override; | 73 aura::Window* lost_active) override; |
| 76 void OnAttemptToReactivateWindow(aura::Window* request_active, | 74 void OnAttemptToReactivateWindow(aura::Window* request_active, |
| 77 aura::Window* actual_active) override; | 75 aura::Window* actual_active) override; |
| 78 | 76 |
| 79 // WindowTreeHostManager::Observer: | 77 // WindowTreeHostManager::Observer: |
| 80 void OnDisplayConfigurationChanging() override; | 78 void OnDisplayConfigurationChanging() override; |
| 81 void OnDisplayConfigurationChanged() override; | 79 void OnDisplayConfigurationChanged() override; |
| 82 | 80 |
| 83 // Owned by Shell. | |
| 84 WmShellCommon* wm_shell_common_; | |
| 85 | |
| 86 WmLookupAura wm_lookup_; | 81 WmLookupAura wm_lookup_; |
| 87 bool added_activation_observer_ = false; | 82 bool added_activation_observer_ = false; |
| 88 base::ObserverList<WmActivationObserver> activation_observers_; | 83 base::ObserverList<WmActivationObserver> activation_observers_; |
| 89 | 84 |
| 90 bool added_display_observer_ = false; | 85 bool added_display_observer_ = false; |
| 91 base::ObserverList<WmDisplayObserver> display_observers_; | 86 base::ObserverList<WmDisplayObserver> display_observers_; |
| 92 | 87 |
| 93 DISALLOW_COPY_AND_ASSIGN(WmShellAura); | 88 DISALLOW_COPY_AND_ASSIGN(WmShellAura); |
| 94 }; | 89 }; |
| 95 | 90 |
| 96 } // namespace ash | 91 } // namespace ash |
| 97 | 92 |
| 98 #endif // ASH_AURA_WM_SHELL_AURA_H_ | 93 #endif // ASH_AURA_WM_SHELL_AURA_H_ |
| OLD | NEW |