OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CONNECTION_H_ | 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CONNECTION_H_ |
6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CONNECTION_H_ | 6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CONNECTION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "components/mus/common/types.h" | 14 #include "components/mus/common/types.h" |
15 #include "components/mus/public/interfaces/window_tree.mojom.h" | 15 #include "components/mus/public/interfaces/window_tree.mojom.h" |
16 #include "mojo/public/cpp/bindings/interface_request.h" | 16 #include "mojo/public/cpp/bindings/interface_request.h" |
17 | 17 |
18 namespace mojo { | 18 namespace mojo { |
19 class ApplicationImpl; | 19 class Shell; |
20 } | 20 } |
21 | 21 |
22 namespace mus { | 22 namespace mus { |
23 | 23 |
24 class Window; | 24 class Window; |
25 class WindowManagerDelegate; | 25 class WindowManagerDelegate; |
26 class WindowTreeConnectionObserver; | 26 class WindowTreeConnectionObserver; |
27 class WindowTreeDelegate; | 27 class WindowTreeDelegate; |
28 | 28 |
29 // Encapsulates a connection to a window tree. A unique connection is made | 29 // Encapsulates a connection to a window tree. A unique connection is made |
30 // every time an app is embedded. | 30 // every time an app is embedded. |
31 class WindowTreeConnection { | 31 class WindowTreeConnection { |
32 public: | 32 public: |
33 enum class CreateType { | 33 enum class CreateType { |
34 // Indicates Create() should wait for OnEmbed(). If true, the | 34 // Indicates Create() should wait for OnEmbed(). If true, the |
35 // WindowTreeConnection returned from Create() will have its root, otherwise | 35 // WindowTreeConnection returned from Create() will have its root, otherwise |
36 // the WindowTreeConnection will get the root at a later time. | 36 // the WindowTreeConnection will get the root at a later time. |
37 WAIT_FOR_EMBED, | 37 WAIT_FOR_EMBED, |
38 DONT_WAIT_FOR_EMBED | 38 DONT_WAIT_FOR_EMBED |
39 }; | 39 }; |
40 | 40 |
41 virtual ~WindowTreeConnection() {} | 41 virtual ~WindowTreeConnection() {} |
42 | 42 |
43 // Creates a WindowTreeConnection with no roots. Use this to establish a | 43 // Creates a WindowTreeConnection with no roots. Use this to establish a |
44 // connection directly to mus and create top level windows. | 44 // connection directly to mus and create top level windows. |
45 static WindowTreeConnection* Create(WindowTreeDelegate* delegate, | 45 static WindowTreeConnection* Create(WindowTreeDelegate* delegate, |
46 mojo::ApplicationImpl* app); | 46 mojo::Shell* shell); |
47 | 47 |
48 // Creates a WindowTreeConnection to service the specified request for | 48 // Creates a WindowTreeConnection to service the specified request for |
49 // a WindowTreeClient. Use this to be embedded in another app. | 49 // a WindowTreeClient. Use this to be embedded in another app. |
50 static WindowTreeConnection* Create( | 50 static WindowTreeConnection* Create( |
51 WindowTreeDelegate* delegate, | 51 WindowTreeDelegate* delegate, |
52 mojo::InterfaceRequest<mojom::WindowTreeClient> request, | 52 mojo::InterfaceRequest<mojom::WindowTreeClient> request, |
53 CreateType create_type); | 53 CreateType create_type); |
54 | 54 |
55 // Create a WindowTreeConnection that is going to serve as the WindowManager. | 55 // Create a WindowTreeConnection that is going to serve as the WindowManager. |
56 static WindowTreeConnection* CreateForWindowManager( | 56 static WindowTreeConnection* CreateForWindowManager( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // TODO(sky): remove this. It is not necessarily correct anymore. | 88 // TODO(sky): remove this. It is not necessarily correct anymore. |
89 virtual ConnectionSpecificId GetConnectionId() = 0; | 89 virtual ConnectionSpecificId GetConnectionId() = 0; |
90 | 90 |
91 virtual void AddObserver(WindowTreeConnectionObserver* observer) = 0; | 91 virtual void AddObserver(WindowTreeConnectionObserver* observer) = 0; |
92 virtual void RemoveObserver(WindowTreeConnectionObserver* observer) = 0; | 92 virtual void RemoveObserver(WindowTreeConnectionObserver* observer) = 0; |
93 }; | 93 }; |
94 | 94 |
95 } // namespace mus | 95 } // namespace mus |
96 | 96 |
97 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CONNECTION_H_ | 97 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CONNECTION_H_ |
OLD | NEW |