Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: ash/mus/root_window_controller.h

Issue 2350953009: Centralizes more shared code between ash and mash (Closed)
Patch Set: feedback Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/mus/bridge/wm_window_mus.cc ('k') | ash/mus/root_window_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_MUS_ROOT_WINDOW_CONTROLLER_H_ 5 #ifndef ASH_MUS_ROOT_WINDOW_CONTROLLER_H_
6 #define ASH_MUS_ROOT_WINDOW_CONTROLLER_H_ 6 #define ASH_MUS_ROOT_WINDOW_CONTROLLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "ash/mus/disconnected_app_handler.h" 10 #include "ash/mus/disconnected_app_handler.h"
11 #include "ash/public/interfaces/container.mojom.h" 11 #include "ash/public/interfaces/container.mojom.h"
12 #include "services/ui/public/cpp/window_observer.h" 12 #include "services/ui/public/cpp/window_observer.h"
13 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" 13 #include "services/ui/public/interfaces/window_manager_constants.mojom.h"
14 #include "ui/display/display.h" 14 #include "ui/display/display.h"
15 15
16 namespace shell { 16 namespace shell {
17 class Connector; 17 class Connector;
18 } 18 }
19 19
20 namespace ash { 20 namespace ash {
21 21
22 class AlwaysOnTopController;
23 class WorkspaceLayoutManager; 22 class WorkspaceLayoutManager;
24 23
25 namespace mus { 24 namespace mus {
26 25
27 class LayoutManager; 26 class LayoutManager;
28 class WindowManager; 27 class WindowManager;
29 class WmRootWindowControllerMus; 28 class WmRootWindowControllerMus;
30 class WmShelfMus; 29 class WmShelfMus;
31 class WmTestBase; 30 class WmTestBase;
32 class WmTestHelper; 31 class WmTestHelper;
33 class WmWindowMus; 32 class WmWindowMus;
34 33
35 // RootWindowController manages the windows and state for a single display. 34 // RootWindowController manages the windows and state for a single display.
36 // RootWindowController is tied to the lifetime of the ui::Window it is 35 // RootWindowController takes ownership of the Window that it passed to it.
37 // created with. It is assumed the RootWindowController is deleted once the
38 // associated ui::Window is destroyed.
39 class RootWindowController { 36 class RootWindowController {
40 public: 37 public:
41 RootWindowController(WindowManager* window_manager, 38 RootWindowController(WindowManager* window_manager,
42 ui::Window* root, 39 ui::Window* root,
43 const display::Display& display); 40 const display::Display& display);
44 ~RootWindowController(); 41 ~RootWindowController();
45 42
43 void Shutdown();
44
46 shell::Connector* GetConnector(); 45 shell::Connector* GetConnector();
47 46
48 ui::Window* root() { return root_; } 47 ui::Window* root() { return root_; }
48 WmRootWindowControllerMus* wm_root_window_controller() {
49 return wm_root_window_controller_.get();
50 }
49 51
50 ui::Window* NewTopLevelWindow( 52 ui::Window* NewTopLevelWindow(
51 std::map<std::string, std::vector<uint8_t>>* properties); 53 std::map<std::string, std::vector<uint8_t>>* properties);
52 54
53 ui::Window* GetWindowForContainer(mojom::Container container); 55 ui::Window* GetWindowForContainer(mojom::Container container);
54 56
55 WmWindowMus* GetWindowByShellWindowId(int id); 57 WmWindowMus* GetWindowByShellWindowId(int id);
56 58
57 WindowManager* window_manager() { return window_manager_; } 59 WindowManager* window_manager() { return window_manager_; }
58 60
59 const display::Display& display() const { return display_; } 61 const display::Display& display() const { return display_; }
60 62
61 WorkspaceLayoutManager* workspace_layout_manager() { 63 WorkspaceLayoutManager* workspace_layout_manager() {
62 return workspace_layout_manager_; 64 return workspace_layout_manager_;
63 } 65 }
64 66
65 AlwaysOnTopController* always_on_top_controller() {
66 return always_on_top_controller_.get();
67 }
68
69 WmShelfMus* wm_shelf() { return wm_shelf_.get(); } 67 WmShelfMus* wm_shelf() { return wm_shelf_.get(); }
70 68
71 private: 69 private:
72 friend class WmTestBase; 70 friend class WmTestBase;
73 friend class WmTestHelper; 71 friend class WmTestHelper;
74 72
75 gfx::Rect CalculateDefaultBounds(ui::Window* window) const; 73 gfx::Rect CalculateDefaultBounds(ui::Window* window) const;
76 gfx::Rect GetMaximizedWindowBounds() const; 74 gfx::Rect GetMaximizedWindowBounds() const;
77 75
78 // Creates the necessary set of layout managers in the shell windows. 76 // Creates the necessary set of layout managers in the shell windows.
79 void CreateLayoutManagers(); 77 void CreateLayoutManagers();
80 78
81 WindowManager* window_manager_; 79 WindowManager* window_manager_;
82 ui::Window* root_; 80 ui::Window* root_;
83 int window_count_ = 0; 81 int window_count_ = 0;
84 82
85 display::Display display_; 83 display::Display display_;
86 84
87 std::unique_ptr<WmRootWindowControllerMus> wm_root_window_controller_; 85 std::unique_ptr<WmRootWindowControllerMus> wm_root_window_controller_;
88 std::unique_ptr<WmShelfMus> wm_shelf_; 86 std::unique_ptr<WmShelfMus> wm_shelf_;
89 87
90 // Owned by the corresponding container. 88 // Owned by the corresponding container.
91 WorkspaceLayoutManager* workspace_layout_manager_ = nullptr; 89 WorkspaceLayoutManager* workspace_layout_manager_ = nullptr;
92 std::map<ui::Window*, std::unique_ptr<LayoutManager>> layout_managers_; 90 std::map<ui::Window*, std::unique_ptr<LayoutManager>> layout_managers_;
93 91
94 std::unique_ptr<AlwaysOnTopController> always_on_top_controller_;
95
96 std::unique_ptr<DisconnectedAppHandler> disconnected_app_handler_; 92 std::unique_ptr<DisconnectedAppHandler> disconnected_app_handler_;
97 93
98 DISALLOW_COPY_AND_ASSIGN(RootWindowController); 94 DISALLOW_COPY_AND_ASSIGN(RootWindowController);
99 }; 95 };
100 96
101 } // namespace mus 97 } // namespace mus
102 } // namespace ash 98 } // namespace ash
103 99
104 #endif // ASH_MUS_ROOT_WINDOW_CONTROLLER_H_ 100 #endif // ASH_MUS_ROOT_WINDOW_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/mus/bridge/wm_window_mus.cc ('k') | ash/mus/root_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698