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