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