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