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; | 20 class ViewEventDispatcher; |
21 class ViewManagerDelegate; | |
22 | 21 |
23 class ViewManager { | 22 class ViewManager { |
24 public: | 23 public: |
25 // Delegate is owned by the caller. | |
26 static void ConfigureIncomingConnection(ApplicationConnection* connection, | |
27 ViewManagerDelegate* delegate); | |
28 | |
29 // Sets the event dispatcher. Can only be called by the app rendering to the | 24 // Sets the event dispatcher. Can only be called by the app rendering to the |
30 // root Node of the hierarchy. | 25 // root Node of the hierarchy. |
31 virtual void SetEventDispatcher(ViewEventDispatcher* dispatcher) = 0; | 26 virtual void SetEventDispatcher(ViewEventDispatcher* dispatcher) = 0; |
32 | 27 |
33 // Dispatches the supplied event to the specified View. Can be called only | 28 // Dispatches the supplied event to the specified View. Can be called only |
34 // by the application that called SetEventDispatcher(). | 29 // by the application that called SetEventDispatcher(). |
35 virtual void DispatchEvent(View* target, EventPtr event) = 0; | 30 virtual void DispatchEvent(View* target, EventPtr event) = 0; |
36 | 31 |
37 // Returns the URL of the application that embedded this application. | 32 // Returns the URL of the application that embedded this application. |
38 virtual const std::string& GetEmbedderURL() const = 0; | 33 virtual const std::string& GetEmbedderURL() const = 0; |
39 | 34 |
40 // Returns all root nodes known to this connection. | 35 // Returns all root nodes known to this connection. |
41 virtual const std::vector<Node*>& GetRoots() const = 0; | 36 virtual const std::vector<Node*>& GetRoots() const = 0; |
42 | 37 |
43 // Returns a Node or View known to this connection. | 38 // Returns a Node or View known to this connection. |
44 virtual Node* GetNodeById(Id id) = 0; | 39 virtual Node* GetNodeById(Id id) = 0; |
45 virtual View* GetViewById(Id id) = 0; | 40 virtual View* GetViewById(Id id) = 0; |
46 | 41 |
47 protected: | 42 protected: |
48 virtual ~ViewManager() {} | 43 virtual ~ViewManager() {} |
49 | 44 |
50 }; | 45 }; |
51 | 46 |
52 } // namespace view_manager | 47 } // namespace view_manager |
53 } // namespace mojo | 48 } // namespace mojo |
54 | 49 |
55 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ | 50 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ |
OLD | NEW |