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_DELEGATE_H_ | 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_DELEGATE_H_ |
6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_DELEGATE_H_ | 6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "components/mus/public/interfaces/window_tree.mojom.h" | 10 #include "components/mus/public/interfaces/window_tree.mojom.h" |
11 #include "services/shell/public/interfaces/interface_provider.mojom.h" | 11 #include "services/shell/public/interfaces/interface_provider.mojom.h" |
12 | 12 |
13 namespace ui { | 13 namespace ui { |
14 class Event; | 14 class Event; |
15 } | 15 } |
16 | 16 |
17 namespace mus { | 17 namespace mus { |
18 | 18 |
19 class Window; | 19 class Window; |
20 class WindowTreeConnection; | 20 class WindowTreeClient; |
21 | 21 |
22 // Interface implemented by an application using the window manager. | 22 // Interface implemented by an application using the window manager. |
23 // | 23 // |
24 // WindowTreeConnection is deleted by any of the following: | 24 // WindowTreeClient is deleted by any of the following: |
25 // . If all the roots of the connection are destroyed and the connection is | 25 // . If all the roots of the connection are destroyed and the connection is |
26 // configured to delete when there are no roots (the default). This happens | 26 // configured to delete when there are no roots (the default). This happens |
27 // if the owner of the roots Embed()s another app in all the roots, or all | 27 // if the owner of the roots Embed()s another app in all the roots, or all |
28 // the roots are explicitly deleted. | 28 // the roots are explicitly deleted. |
29 // . The connection to the window manager is lost. | 29 // . The connection to the window manager is lost. |
30 // . Explicitly by way of calling delete. | 30 // . Explicitly by way of calling delete. |
31 // | 31 // |
32 // When the WindowTreeConnection is deleted all windows are deleted (and | 32 // When the WindowTreeClient is deleted all windows are deleted (and observers |
33 // observers notified). This is followed by notifying the delegate by way of | 33 // notified). This is followed by notifying the delegate by way of |
34 // OnConnectionLost(). | 34 // OnClientDestroyed(). |
35 class WindowTreeDelegate { | 35 class WindowTreeClientDelegate { |
36 public: | 36 public: |
37 // Called when the application implementing this interface is embedded at | 37 // Called when the application implementing this interface is embedded at |
38 // |root|. | 38 // |root|. |
39 // NOTE: this is only invoked if the WindowTreeConnection is created with | 39 // NOTE: this is only invoked if the WindowTreeClient is created with an |
40 // an InterfaceRequest. | 40 // InterfaceRequest. |
41 virtual void OnEmbed(Window* root) = 0; | 41 virtual void OnEmbed(Window* root) = 0; |
42 | 42 |
43 // Sent when another app is embedded in |root| (one of the roots of the | 43 // Sent when another app is embedded in |root| (one of the roots of the |
44 // connection). Afer this call |root| is deleted. If |root| is the only root | 44 // connection). Afer this call |root| is deleted. If |root| is the only root |
45 // and the connection is configured to delete when there are no roots (the | 45 // and the connection is configured to delete when there are no roots (the |
46 // default), then after |root| is destroyed the connection is destroyed as | 46 // default), then after |root| is destroyed the connection is destroyed as |
47 // well. | 47 // well. |
48 virtual void OnUnembed(Window* root); | 48 virtual void OnUnembed(Window* root); |
49 | 49 |
50 // Called from the destructor of WindowTreeConnection after all the Windows | 50 // Called from the destructor of WindowTreeClient after all the Windows have |
51 // have been destroyed. |connection| is no longer valid after this call. | 51 // been destroyed. |client| is no longer valid after this call. |
52 virtual void OnConnectionLost(WindowTreeConnection* connection) = 0; | 52 virtual void OnWindowTreeClientDestroyed(WindowTreeClient* client) = 0; |
53 | 53 |
54 // Called when the WindowTreeConnection receives an input event observed via | 54 // Called when the WindowTreeClient receives an input event observed via |
55 // SetEventObserver(). |target| may be null for events that were sent to | 55 // SetEventObserver(). |target| may be null for events that were sent to |
56 // windows owned by other processes. | 56 // windows owned by other processes. |
57 virtual void OnEventObserved(const ui::Event& event, Window* target) = 0; | 57 virtual void OnEventObserved(const ui::Event& event, Window* target) = 0; |
58 | 58 |
59 protected: | 59 protected: |
60 virtual ~WindowTreeDelegate() {} | 60 virtual ~WindowTreeClientDelegate() {} |
61 }; | 61 }; |
62 | 62 |
63 } // namespace mus | 63 } // namespace mus |
64 | 64 |
65 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_DELEGATE_H_ | 65 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_DELEGATE_H_ |
OLD | NEW |