OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 MASH_WM_WINDOW_MANAGER_APPLICATION_H_ | 5 #ifndef MASH_WM_WINDOW_MANAGER_APPLICATION_H_ |
6 #define MASH_WM_WINDOW_MANAGER_APPLICATION_H_ | 6 #define MASH_WM_WINDOW_MANAGER_APPLICATION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 class WindowManagerApplication | 44 class WindowManagerApplication |
45 : public mojo::ShellClient, | 45 : public mojo::ShellClient, |
46 public mus::mojom::WindowManagerFactory, | 46 public mus::mojom::WindowManagerFactory, |
47 public mojo::InterfaceFactory<mash::wm::mojom::UserWindowController>, | 47 public mojo::InterfaceFactory<mash::wm::mojom::UserWindowController>, |
48 public mojo::InterfaceFactory<mus::mojom::AcceleratorRegistrar> { | 48 public mojo::InterfaceFactory<mus::mojom::AcceleratorRegistrar> { |
49 public: | 49 public: |
50 WindowManagerApplication(); | 50 WindowManagerApplication(); |
51 ~WindowManagerApplication() override; | 51 ~WindowManagerApplication() override; |
52 | 52 |
53 mojo::Shell* shell() { return shell_; } | 53 mojo::Connector* connector() { return connector_; } |
54 | 54 |
55 // Returns the RootWindowControllers that have valid roots. | 55 // Returns the RootWindowControllers that have valid roots. |
56 // | 56 // |
57 // NOTE: this does not return |controllers_| as most clients want a | 57 // NOTE: this does not return |controllers_| as most clients want a |
58 // RootWindowController that has a valid root window. | 58 // RootWindowController that has a valid root window. |
59 std::set<RootWindowController*> GetRootControllers(); | 59 std::set<RootWindowController*> GetRootControllers(); |
60 | 60 |
61 // Called when the root window of |root_controller| is obtained. | 61 // Called when the root window of |root_controller| is obtained. |
62 void OnRootWindowControllerGotRoot(RootWindowController* root_controller); | 62 void OnRootWindowControllerGotRoot(RootWindowController* root_controller); |
63 | 63 |
64 // Called after RootWindowController creates the necessary resources. | 64 // Called after RootWindowController creates the necessary resources. |
65 void OnRootWindowControllerDoneInit(RootWindowController* root_controller); | 65 void OnRootWindowControllerDoneInit(RootWindowController* root_controller); |
66 | 66 |
67 // Called when the root mus::Window of RootWindowController is destroyed. | 67 // Called when the root mus::Window of RootWindowController is destroyed. |
68 // |root_controller| is destroyed after this call. | 68 // |root_controller| is destroyed after this call. |
69 void OnRootWindowDestroyed(RootWindowController* root_controller); | 69 void OnRootWindowDestroyed(RootWindowController* root_controller); |
70 | 70 |
71 // TODO(sky): figure out right place for this code. | 71 // TODO(sky): figure out right place for this code. |
72 void OnAccelerator(uint32_t id, mus::mojom::EventPtr event); | 72 void OnAccelerator(uint32_t id, mus::mojom::EventPtr event); |
73 | 73 |
74 void AddRootWindowsObserver(RootWindowsObserver* observer); | 74 void AddRootWindowsObserver(RootWindowsObserver* observer); |
75 void RemoveRootWindowsObserver(RootWindowsObserver* observer); | 75 void RemoveRootWindowsObserver(RootWindowsObserver* observer); |
76 | 76 |
77 private: | 77 private: |
78 void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar); | 78 void OnAcceleratorRegistrarDestroyed(AcceleratorRegistrarImpl* registrar); |
79 | 79 |
80 // mojo::ShellClient: | 80 // mojo::ShellClient: |
81 void Initialize(mojo::Shell* shell, const std::string& url, | 81 void Initialize(mojo::Connector* connector, const std::string& url, |
82 uint32_t id, uint32_t user_id) override; | 82 uint32_t id, uint32_t user_id) override; |
83 bool AcceptConnection(mojo::Connection* connection) override; | 83 bool AcceptConnection(mojo::Connection* connection) override; |
84 | 84 |
85 // InterfaceFactory<mash::wm::mojom::UserWindowController>: | 85 // InterfaceFactory<mash::wm::mojom::UserWindowController>: |
86 void Create(mojo::Connection* connection, | 86 void Create(mojo::Connection* connection, |
87 mojo::InterfaceRequest<mash::wm::mojom::UserWindowController> | 87 mojo::InterfaceRequest<mash::wm::mojom::UserWindowController> |
88 request) override; | 88 request) override; |
89 | 89 |
90 // InterfaceFactory<mus::mojom::AcceleratorRegistrar>: | 90 // InterfaceFactory<mus::mojom::AcceleratorRegistrar>: |
91 void Create(mojo::Connection* connection, | 91 void Create(mojo::Connection* connection, |
92 mojo::InterfaceRequest<mus::mojom::AcceleratorRegistrar> request) | 92 mojo::InterfaceRequest<mus::mojom::AcceleratorRegistrar> request) |
93 override; | 93 override; |
94 | 94 |
95 // mus::mojom::WindowManagerFactory: | 95 // mus::mojom::WindowManagerFactory: |
96 void CreateWindowManager(mus::mojom::DisplayPtr display, | 96 void CreateWindowManager(mus::mojom::DisplayPtr display, |
97 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> | 97 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> |
98 client_request) override; | 98 client_request) override; |
99 | 99 |
100 mojo::Shell* shell_; | 100 mojo::Connector* connector_; |
101 | 101 |
102 mojo::TracingImpl tracing_; | 102 mojo::TracingImpl tracing_; |
103 | 103 |
104 scoped_ptr<ui::mojo::UIInit> ui_init_; | 104 scoped_ptr<ui::mojo::UIInit> ui_init_; |
105 scoped_ptr<views::AuraInit> aura_init_; | 105 scoped_ptr<views::AuraInit> aura_init_; |
106 | 106 |
107 // |user_window_controller_| is created once OnEmbed() is called. Until that | 107 // |user_window_controller_| is created once OnEmbed() is called. Until that |
108 // time |user_window_controller_requests_| stores pending interface requests. | 108 // time |user_window_controller_requests_| stores pending interface requests. |
109 scoped_ptr<UserWindowControllerImpl> user_window_controller_; | 109 scoped_ptr<UserWindowControllerImpl> user_window_controller_; |
110 mojo::BindingSet<mash::wm::mojom::UserWindowController> | 110 mojo::BindingSet<mash::wm::mojom::UserWindowController> |
(...skipping 10 matching lines...) Expand all Loading... |
121 | 121 |
122 base::ObserverList<RootWindowsObserver> root_windows_observers_; | 122 base::ObserverList<RootWindowsObserver> root_windows_observers_; |
123 | 123 |
124 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); | 124 DISALLOW_COPY_AND_ASSIGN(WindowManagerApplication); |
125 }; | 125 }; |
126 | 126 |
127 } // namespace wm | 127 } // namespace wm |
128 } // namespace mash | 128 } // namespace mash |
129 | 129 |
130 #endif // MASH_WM_WINDOW_MANAGER_APPLICATION_H_ | 130 #endif // MASH_WM_WINDOW_MANAGER_APPLICATION_H_ |
OLD | NEW |