Chromium Code Reviews| Index: ash/shell.h |
| diff --git a/ash/shell.h b/ash/shell.h |
| index f17b9a7ff4f43451afc62a32461332619be0d26f..e105ab51ba0cc60cd26e7d9e24bc736c738fd0fb 100644 |
| --- a/ash/shell.h |
| +++ b/ash/shell.h |
| @@ -22,6 +22,7 @@ |
| #include "ui/display/screen.h" |
| #include "ui/events/event_target.h" |
| #include "ui/wm/core/cursor_manager.h" |
| +#include "ui/wm/public/activation_change_observer.h" |
| namespace aura { |
| class RootWindow; |
| @@ -141,7 +142,8 @@ class SmsObserverTest; |
| // Upon creation, the Shell sets itself as the RootWindow's delegate, which |
| // takes ownership of the Shell. |
| class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate, |
| - public ui::EventTarget { |
| + public ui::EventTarget, |
| + public aura::client::ActivationChangeObserver { |
| public: |
| typedef std::vector<RootWindowController*> RootWindowControllerList; |
| @@ -389,6 +391,17 @@ class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate, |
| return is_touch_hud_projection_enabled_; |
| } |
| + // NOTE: Prefer ScopedRootWindowForNewWindows when setting temporarily. |
| + void set_root_window_for_new_windows(WmWindow* root) { |
| + root_window_for_new_windows_ = root; |
| + } |
| + |
| + // Returns the root window that newly created windows should be added to. |
| + // Value can be temporarily overridden using ScopedRootWindowForNewWindows. |
| + // NOTE: this returns the root, newly created window should be added to the |
| + // appropriate container in the returned window. |
| + WmWindow* GetRootWindowForNewWindows(); |
|
James Cook
2017/03/08 03:04:16
Aside: I'm glad you choose this name for the WmWin
|
| + |
| // Creates instance of FirstRunHelper. Caller is responsible for deleting |
| // returned object. |
| ash::FirstRunHelper* CreateFirstRunHelper(); |
| @@ -414,9 +427,10 @@ class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate, |
| FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, MouseEventCursors); |
| FRIEND_TEST_ALL_PREFIXES(WindowManagerTest, TransformActivate); |
| friend class RootWindowController; |
| + friend class ScopedRootWindowForNewWindows; |
| + friend class SmsObserverTest; |
| friend class test::ShellTestApi; |
| friend class shell::WindowWatcher; |
| - friend class SmsObserverTest; |
| explicit Shell(std::unique_ptr<WmShell> wm_shell); |
| ~Shell() override; |
| @@ -441,6 +455,11 @@ class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate, |
| std::unique_ptr<ui::EventTargetIterator> GetChildIterator() const override; |
| ui::EventTargeter* GetEventTargeter() override; |
| + // aura::client::ActivationChangeObserver: |
| + void OnWindowActivated(ActivationReason reason, |
| + aura::Window* gained_active, |
| + aura::Window* lost_active) override; |
| + |
| static Shell* instance_; |
| // Only valid in mash, for classic ash this is null. |
| @@ -564,6 +583,10 @@ class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate, |
| bool is_touch_hud_projection_enabled_; |
| + // See comment for GetRootWindowForNewWindows(). |
| + WmWindow* root_window_for_new_windows_ = nullptr; |
| + WmWindow* scoped_root_window_for_new_windows_ = nullptr; |
| + |
| // Injected content::GPUDataManager support. |
| std::unique_ptr<GPUSupport> gpu_support_; |