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 class Node; | 16 class View; |
17 class ViewManagerDelegate; | 17 class ViewManagerDelegate; |
18 class WindowManagerDelegate; | 18 class WindowManagerDelegate; |
19 | 19 |
20 // Encapsulates a connection to the view manager service. | 20 // Encapsulates a connection to the view manager service. |
21 // A unique connection is made for every unique embed path for an app. e.g. for | 21 // A unique connection is made for every unique embed path for an app. e.g. for |
22 // app B embed by the following paths: A->B, A->C->B - there are two connections | 22 // app B embed by the following paths: A->B, A->C->B - there are two connections |
23 // and thus two instances of this class. | 23 // and thus two instances of this class. |
24 class ViewManager { | 24 class ViewManager { |
25 public: | 25 public: |
26 // Sets the window manager delegate. Can only be called by the app embedded at | 26 // Sets the window manager delegate. Can only be called by the app embedded at |
27 // the service root node. | 27 // the service root view. |
28 virtual void SetWindowManagerDelegate( | 28 virtual void SetWindowManagerDelegate( |
29 WindowManagerDelegate* window_manager_delegate) = 0; | 29 WindowManagerDelegate* window_manager_delegate) = 0; |
30 | 30 |
31 // Dispatches the supplied event to the specified Node. Can be called only | 31 // Dispatches the supplied event to the specified View. Can be called only |
32 // by the application that called SetWindowManagerDelegate(). | 32 // by the application that called SetWindowManagerDelegate(). |
33 virtual void DispatchEvent(Node* target, EventPtr event) = 0; | 33 virtual void DispatchEvent(View* target, EventPtr event) = 0; |
34 | 34 |
35 // Returns the URL of the application that embedded this application. | 35 // Returns the URL of the application that embedded this application. |
36 virtual const std::string& GetEmbedderURL() const = 0; | 36 virtual const std::string& GetEmbedderURL() const = 0; |
37 | 37 |
38 // Returns all root nodes known to this connection. | 38 // Returns all root views known to this connection. |
39 virtual const std::vector<Node*>& GetRoots() const = 0; | 39 virtual const std::vector<View*>& GetRoots() const = 0; |
40 | 40 |
41 // Returns a Node known to this connection. | 41 // Returns a View known to this connection. |
42 virtual Node* GetNodeById(Id id) = 0; | 42 virtual View* GetViewById(Id id) = 0; |
43 | 43 |
44 protected: | 44 protected: |
45 virtual ~ViewManager() {} | 45 virtual ~ViewManager() {} |
46 | 46 |
47 }; | 47 }; |
48 | 48 |
49 } // namespace mojo | 49 } // namespace mojo |
50 | 50 |
51 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ | 51 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ |
OLD | NEW |