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 MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ | 5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ |
6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ | 6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "mojo/services/public/cpp/view_manager/types.h" | 11 #include "mojo/services/public/cpp/view_manager/types.h" |
12 #include "mojo/services/public/interfaces/input_events/input_events.mojom.h" | 12 #include "mojo/services/public/interfaces/input_events/input_events.mojom.h" |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
15 class ApplicationConnection; | 15 class ApplicationConnection; |
16 namespace view_manager { | 16 namespace view_manager { |
17 | 17 |
18 class Node; | 18 class Node; |
19 class View; | 19 class View; |
20 class ViewEventDispatcher; | |
21 class ViewManagerDelegate; | 20 class ViewManagerDelegate; |
| 21 class WindowManagerDelegate; |
22 | 22 |
23 class ViewManager { | 23 class ViewManager { |
24 public: | 24 public: |
25 // Delegate is owned by the caller. | 25 // Delegate is owned by the caller. |
26 static void ConfigureIncomingConnection(ApplicationConnection* connection, | 26 static void ConfigureIncomingConnection(ApplicationConnection* connection, |
27 ViewManagerDelegate* delegate); | 27 ViewManagerDelegate* delegate); |
28 | 28 |
29 // Sets the event dispatcher. Can only be called by the app rendering to the | 29 // Sets the window manager delegate. Can only be called by the app embedded at |
30 // root Node of the hierarchy. | 30 // the service root node. |
31 virtual void SetEventDispatcher(ViewEventDispatcher* dispatcher) = 0; | 31 virtual void SetWindowManagerDelegate( |
| 32 WindowManagerDelegate* window_manager_delegate) = 0; |
32 | 33 |
33 // Dispatches the supplied event to the specified View. Can be called only | 34 // Dispatches the supplied event to the specified View. Can be called only |
34 // by the application that called SetEventDispatcher(). | 35 // by the application that called SetWindowManagerDelegate(). |
35 virtual void DispatchEvent(View* target, EventPtr event) = 0; | 36 virtual void DispatchEvent(View* target, EventPtr event) = 0; |
36 | 37 |
37 // Returns the URL of the application that embedded this application. | 38 // Returns the URL of the application that embedded this application. |
38 virtual const std::string& GetEmbedderURL() const = 0; | 39 virtual const std::string& GetEmbedderURL() const = 0; |
39 | 40 |
40 // Returns all root nodes known to this connection. | 41 // Returns all root nodes known to this connection. |
41 virtual const std::vector<Node*>& GetRoots() const = 0; | 42 virtual const std::vector<Node*>& GetRoots() const = 0; |
42 | 43 |
43 // Returns a Node or View known to this connection. | 44 // Returns a Node or View known to this connection. |
44 virtual Node* GetNodeById(Id id) = 0; | 45 virtual Node* GetNodeById(Id id) = 0; |
45 virtual View* GetViewById(Id id) = 0; | 46 virtual View* GetViewById(Id id) = 0; |
46 | 47 |
47 protected: | 48 protected: |
48 virtual ~ViewManager() {} | 49 virtual ~ViewManager() {} |
49 | 50 |
50 }; | 51 }; |
51 | 52 |
52 } // namespace view_manager | 53 } // namespace view_manager |
53 } // namespace mojo | 54 } // namespace mojo |
54 | 55 |
55 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ | 56 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ |
OLD | NEW |