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 COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_H_ | 5 #ifndef COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_H_ |
6 #define COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_H_ | 6 #define COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "components/view_manager/public/cpp/types.h" | 10 #include "components/view_manager/public/cpp/types.h" |
11 #include "components/view_manager/public/interfaces/view_manager.mojom.h" | 11 #include "components/view_manager/public/interfaces/view_tree.mojom.h" |
12 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" | 12 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
15 class View; | 15 class View; |
16 class ViewManagerDelegate; | 16 class ViewManagerDelegate; |
17 | 17 |
18 // Encapsulates a connection to the view manager service. A unique connection | 18 // Encapsulates a connection to the view manager service. A unique connection |
19 // is made every time an app is embedded. | 19 // is made every time an app is embedded. |
20 class ViewManager { | 20 class ViewManager { |
21 public: | 21 public: |
22 virtual ~ViewManager() {} | 22 virtual ~ViewManager() {} |
23 | 23 |
24 // The returned ViewManager instance owns itself, and is deleted when the | 24 // The returned ViewManager instance owns itself, and is deleted when the |
25 // last root is destroyed or the connection to the service is broken. | 25 // last root is destroyed or the connection to the service is broken. |
26 static ViewManager* Create( | 26 static ViewManager* Create( |
27 ViewManagerDelegate* delegate, | 27 ViewManagerDelegate* delegate, |
28 InterfaceRequest<ViewManagerClient> request); | 28 InterfaceRequest<ViewTreeClient> request); |
29 | 29 |
30 // Returns the root of this connection. | 30 // Returns the root of this connection. |
31 virtual View* GetRoot() = 0; | 31 virtual View* GetRoot() = 0; |
32 | 32 |
33 // Returns a View known to this connection. | 33 // Returns a View known to this connection. |
34 virtual View* GetViewById(Id id) = 0; | 34 virtual View* GetViewById(Id id) = 0; |
35 | 35 |
36 // Returns the focused view; null if focus is not yet known or another app is | 36 // Returns the focused view; null if focus is not yet known or another app is |
37 // focused. | 37 // focused. |
38 virtual View* GetFocusedView() = 0; | 38 virtual View* GetFocusedView() = 0; |
39 | 39 |
40 // Creates and returns a new View (which is owned by the ViewManager). Views | 40 // Creates and returns a new View (which is owned by the ViewManager). Views |
41 // are initially hidden, use SetVisible(true) to show. | 41 // are initially hidden, use SetVisible(true) to show. |
42 virtual View* CreateView() = 0; | 42 virtual View* CreateView() = 0; |
43 | 43 |
44 // Set view_manager.mojom for details. | 44 // Set view_tree.mojom for details. |
45 virtual void SetEmbedRoot() = 0; | 45 virtual void SetEmbedRoot() = 0; |
46 }; | 46 }; |
47 | 47 |
48 } // namespace mojo | 48 } // namespace mojo |
49 | 49 |
50 #endif // COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_H_ | 50 #endif // COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_H_ |
OLD | NEW |