| 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 | 14 |
| 15 namespace gfx { | 15 namespace gfx { |
| 16 class Rect; | 16 class Rect; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace ash { | 19 namespace ash { |
| 20 | 20 |
| 21 class Shell; |
| 22 class MruWindowTracker; |
| 21 class SessionStateDelegate; | 23 class SessionStateDelegate; |
| 22 class WindowResizer; | 24 class WindowResizer; |
| 23 class WmActivationObserver; | 25 class WmActivationObserver; |
| 24 class WmDisplayObserver; | 26 class WmDisplayObserver; |
| 25 class WmOverviewModeObserver; | 27 class WmOverviewModeObserver; |
| 26 class WmWindow; | 28 class WmWindow; |
| 27 | 29 |
| 28 namespace wm { | 30 namespace wm { |
| 29 | 31 |
| 30 class WindowState; | 32 class WindowState; |
| 31 | 33 |
| 32 enum class WmUserMetricsAction; | 34 enum class WmUserMetricsAction; |
| 33 } | 35 } |
| 34 | 36 |
| 35 // Similar to ash::Shell. Eventually the two will be merged. | 37 // Similar to ash::Shell. Eventually the two will be merged. |
| 36 class ASH_EXPORT WmShell { | 38 class ASH_EXPORT WmShell { |
| 37 public: | 39 public: |
| 38 virtual ~WmShell() {} | |
| 39 | |
| 40 // This is necessary for a handful of places that is difficult to plumb | 40 // This is necessary for a handful of places that is difficult to plumb |
| 41 // through context. | 41 // through context. |
| 42 static void Set(WmShell* instance); | 42 static void Set(WmShell* instance); |
| 43 static WmShell* Get(); | 43 static WmShell* Get(); |
| 44 | 44 |
| 45 MruWindowTracker* mru_window_tracker() { return mru_window_tracker_.get(); } |
| 46 |
| 45 // Creates a new window used as a container of other windows. No painting is | 47 // Creates a new window used as a container of other windows. No painting is |
| 46 // done to the created window. | 48 // done to the created window. |
| 47 virtual WmWindow* NewContainerWindow() = 0; | 49 virtual WmWindow* NewContainerWindow() = 0; |
| 48 | 50 |
| 49 virtual WmWindow* GetFocusedWindow() = 0; | 51 virtual WmWindow* GetFocusedWindow() = 0; |
| 50 virtual WmWindow* GetActiveWindow() = 0; | 52 virtual WmWindow* GetActiveWindow() = 0; |
| 51 | 53 |
| 52 virtual WmWindow* GetPrimaryRootWindow() = 0; | 54 virtual WmWindow* GetPrimaryRootWindow() = 0; |
| 53 | 55 |
| 54 // Returns the root window for the specified display. | 56 // Returns the root window for the specified display. |
| 55 virtual WmWindow* GetRootWindowForDisplayId(int64_t display_id) = 0; | 57 virtual WmWindow* GetRootWindowForDisplayId(int64_t display_id) = 0; |
| 56 | 58 |
| 57 // Returns the root window that newly created windows should be added to. | 59 // Returns the root window that newly created windows should be added to. |
| 58 // NOTE: this returns the root, newly created window should be added to the | 60 // NOTE: this returns the root, newly created window should be added to the |
| 59 // appropriate container in the returned window. | 61 // appropriate container in the returned window. |
| 60 virtual WmWindow* GetRootWindowForNewWindows() = 0; | 62 virtual WmWindow* GetRootWindowForNewWindows() = 0; |
| 61 | 63 |
| 62 // Returns the list of most recently used windows. | |
| 63 virtual std::vector<WmWindow*> GetMruWindowList() = 0; | |
| 64 | |
| 65 // Returns the list of most recently used windows excluding modals. | |
| 66 virtual std::vector<WmWindow*> GetMruWindowListIgnoreModals() = 0; | |
| 67 | |
| 68 // Returns true if the first window shown on first run should be | 64 // Returns true if the first window shown on first run should be |
| 69 // unconditionally maximized, overriding the heuristic that normally chooses | 65 // unconditionally maximized, overriding the heuristic that normally chooses |
| 70 // the window size. | 66 // the window size. |
| 71 virtual bool IsForceMaximizeOnFirstRun() = 0; | 67 virtual bool IsForceMaximizeOnFirstRun() = 0; |
| 72 | 68 |
| 73 // Returns true if |window| can be shown for the current user. This is | 69 // Returns true if |window| can be shown for the current user. This is |
| 74 // intended to check if the current user matches the user associated with | 70 // intended to check if the current user matches the user associated with |
| 75 // |window|. | 71 // |window|. |
| 76 virtual bool CanShowWindowForUser(WmWindow* window) = 0; | 72 virtual bool CanShowWindowForUser(WmWindow* window) = 0; |
| 77 | 73 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 99 | 95 |
| 100 virtual void AddActivationObserver(WmActivationObserver* observer) = 0; | 96 virtual void AddActivationObserver(WmActivationObserver* observer) = 0; |
| 101 virtual void RemoveActivationObserver(WmActivationObserver* observer) = 0; | 97 virtual void RemoveActivationObserver(WmActivationObserver* observer) = 0; |
| 102 | 98 |
| 103 virtual void AddDisplayObserver(WmDisplayObserver* observer) = 0; | 99 virtual void AddDisplayObserver(WmDisplayObserver* observer) = 0; |
| 104 virtual void RemoveDisplayObserver(WmDisplayObserver* observer) = 0; | 100 virtual void RemoveDisplayObserver(WmDisplayObserver* observer) = 0; |
| 105 | 101 |
| 106 virtual void AddOverviewModeObserver(WmOverviewModeObserver* observer) = 0; | 102 virtual void AddOverviewModeObserver(WmOverviewModeObserver* observer) = 0; |
| 107 virtual void RemoveOverviewModeObserver(WmOverviewModeObserver* observer) = 0; | 103 virtual void RemoveOverviewModeObserver(WmOverviewModeObserver* observer) = 0; |
| 108 | 104 |
| 105 protected: |
| 106 WmShell(); |
| 107 virtual ~WmShell(); |
| 108 |
| 109 void CreateMruWindowTracker(); |
| 110 void DeleteMruWindowTracker(); |
| 111 |
| 109 private: | 112 private: |
| 113 friend class Shell; |
| 114 |
| 110 static WmShell* instance_; | 115 static WmShell* instance_; |
| 116 |
| 117 std::unique_ptr<MruWindowTracker> mru_window_tracker_; |
| 111 }; | 118 }; |
| 112 | 119 |
| 113 } // namespace ash | 120 } // namespace ash |
| 114 | 121 |
| 115 #endif // ASH_COMMON_WM_SHELL_H_ | 122 #endif // ASH_COMMON_WM_SHELL_H_ |
| OLD | NEW |