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_COMMON_WM_ROOT_WINDOW_CONTROLLER_H_ | 5 #ifndef ASH_COMMON_WM_ROOT_WINDOW_CONTROLLER_H_ |
| 6 #define ASH_COMMON_WM_ROOT_WINDOW_CONTROLLER_H_ | 6 #define ASH_COMMON_WM_ROOT_WINDOW_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/common/wm/workspace/workspace_types.h" | 9 #include "ash/common/wm/workspace/workspace_types.h" |
| 10 #include "base/macros.h" | |
| 11 #include "base/observer_list.h" | |
| 10 #include "ui/views/widget/widget.h" | 12 #include "ui/views/widget/widget.h" |
| 11 | 13 |
| 12 namespace gfx { | 14 namespace gfx { |
| 13 class Point; | 15 class Point; |
| 14 } | 16 } |
| 15 | 17 |
| 16 namespace ash { | 18 namespace ash { |
| 17 | 19 |
| 18 class AlwaysOnTopController; | 20 class AlwaysOnTopController; |
| 19 class WmShelf; | 21 class WmShelf; |
| 20 class WmShell; | 22 class WmShell; |
| 21 class WmRootWindowControllerObserver; | 23 class WmRootWindowControllerObserver; |
| 22 class WmWindow; | 24 class WmWindow; |
| 23 class WorkspaceLayoutManagerBackdropDelegate; | 25 class WorkspaceController; |
| 26 | |
| 27 namespace wm { | |
| 28 class RootWindowLayoutManager; | |
| 29 } | |
| 24 | 30 |
| 25 // Provides state associated with a root of a window hierarchy. | 31 // Provides state associated with a root of a window hierarchy. |
| 26 class ASH_EXPORT WmRootWindowController { | 32 class ASH_EXPORT WmRootWindowController { |
| 27 public: | 33 public: |
| 28 virtual ~WmRootWindowController() {} | 34 explicit WmRootWindowController(WmWindow* window); |
| 35 virtual ~WmRootWindowController(); | |
| 36 | |
| 37 wm::RootWindowLayoutManager* root_window_layout() { | |
|
msw
2016/08/30 21:26:46
nit: root_window_layout_manager? (ditto for member
sky
2016/08/30 22:02:56
Done.
| |
| 38 return root_window_layout_; | |
| 39 } | |
| 40 | |
| 41 WorkspaceController* workspace_controller() { | |
| 42 return workspace_controller_.get(); | |
| 43 } | |
| 44 | |
| 45 wm::WorkspaceWindowState GetWorkspaceWindowState(); | |
| 46 | |
| 47 void AddObserver(WmRootWindowControllerObserver* observer); | |
| 48 void RemoveObserver(WmRootWindowControllerObserver* observer); | |
| 29 | 49 |
| 30 virtual bool HasShelf() = 0; | 50 virtual bool HasShelf() = 0; |
| 31 | 51 |
| 32 virtual WmShell* GetShell() = 0; | 52 virtual WmShell* GetShell() = 0; |
| 33 | 53 |
| 34 virtual wm::WorkspaceWindowState GetWorkspaceWindowState() = 0; | |
| 35 | |
| 36 // TODO: remove when WorkspaceController moved to common: | |
| 37 // http://crbug.com/624173. | |
| 38 virtual void SetMaximizeBackdropDelegate( | |
| 39 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate) = 0; | |
| 40 | |
| 41 virtual AlwaysOnTopController* GetAlwaysOnTopController() = 0; | 54 virtual AlwaysOnTopController* GetAlwaysOnTopController() = 0; |
| 42 | 55 |
| 43 virtual WmShelf* GetShelf() = 0; | 56 virtual WmShelf* GetShelf() = 0; |
| 44 | 57 |
| 45 // Returns the window associated with this WmRootWindowController. | 58 // Returns the window associated with this WmRootWindowController. |
| 46 virtual WmWindow* GetWindow() = 0; | 59 virtual WmWindow* GetWindow() = 0; |
| 47 | 60 |
| 48 // Configures |init_params| prior to initializing |widget|. | 61 // Configures |init_params| prior to initializing |widget|. |
| 49 // |shell_container_id| is the id of the container to parent |widget| to. | 62 // |shell_container_id| is the id of the container to parent |widget| to. |
| 50 virtual void ConfigureWidgetInitParamsForContainer( | 63 virtual void ConfigureWidgetInitParamsForContainer( |
| 51 views::Widget* widget, | 64 views::Widget* widget, |
| 52 int shell_container_id, | 65 int shell_container_id, |
| 53 views::Widget::InitParams* init_params) = 0; | 66 views::Widget::InitParams* init_params) = 0; |
| 54 | 67 |
| 55 // Returns the window events will be targeted at for the specified location | 68 // Returns the window events will be targeted at for the specified location |
| 56 // (in screen coordinates). | 69 // (in screen coordinates). |
| 57 // | 70 // |
| 58 // NOTE: the returned window may not contain the location as resize handles | 71 // NOTE: the returned window may not contain the location as resize handles |
| 59 // may extend outside the bounds of the window. | 72 // may extend outside the bounds of the window. |
| 60 virtual WmWindow* FindEventTarget(const gfx::Point& location_in_screen) = 0; | 73 virtual WmWindow* FindEventTarget(const gfx::Point& location_in_screen) = 0; |
| 61 | 74 |
| 62 // Gets the last location seen in a mouse event in this root window's | 75 // Gets the last location seen in a mouse event in this root window's |
| 63 // coordinates. This may return a point outside the root window's bounds. | 76 // coordinates. This may return a point outside the root window's bounds. |
| 64 virtual gfx::Point GetLastMouseLocationInRoot() = 0; | 77 virtual gfx::Point GetLastMouseLocationInRoot() = 0; |
| 65 | 78 |
| 66 virtual void AddObserver(WmRootWindowControllerObserver* observer) = 0; | 79 protected: |
| 67 virtual void RemoveObserver(WmRootWindowControllerObserver* observer) = 0; | 80 // Creates the containers (WmWindows) used by the shell. |
| 81 void CreateContainers(); | |
| 82 | |
| 83 // Creates the LayoutManagers for the windows created by CreateContainers(). | |
| 84 void CreateLayoutManagers(); | |
| 85 | |
| 86 void DeleteWorkspaceController(); | |
| 87 | |
| 88 base::ObserverList<WmRootWindowControllerObserver>* observers() { | |
| 89 return &observers_; | |
| 90 } | |
| 91 | |
| 92 private: | |
| 93 WmWindow* root_; | |
| 94 | |
| 95 wm::RootWindowLayoutManager* root_window_layout_; | |
| 96 | |
| 97 std::unique_ptr<WorkspaceController> workspace_controller_; | |
| 98 | |
| 99 base::ObserverList<WmRootWindowControllerObserver> observers_; | |
| 100 | |
| 101 DISALLOW_COPY_AND_ASSIGN(WmRootWindowController); | |
| 68 }; | 102 }; |
| 69 | 103 |
| 70 } // namespace ash | 104 } // namespace ash |
| 71 | 105 |
| 72 #endif // ASH_COMMON_WM_ROOT_WINDOW_CONTROLLER_H_ | 106 #endif // ASH_COMMON_WM_ROOT_WINDOW_CONTROLLER_H_ |
| OLD | NEW |