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