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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_VIEW_MANAGER_VIEW_MANAGER_APP_H_
6 #define COMPONENTS_VIEW_MANAGER_VIEW_MANAGER_APP_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "cc/surfaces/surface_manager.h"
12 #include "components/view_manager/connection_manager_delegate.h"
13 #include "components/view_manager/public/interfaces/gpu.mojom.h"
14 #include "components/view_manager/public/interfaces/view_tree.mojom.h"
15 #include "components/view_manager/public/interfaces/view_tree_host.mojom.h"
16 #include "mojo/application/public/cpp/app_lifetime_helper.h"
17 #include "mojo/application/public/cpp/application_delegate.h"
18 #include "mojo/application/public/cpp/interface_factory.h"
19 #include "mojo/common/tracing_impl.h"
20 #include "mojo/common/weak_binding_set.h"
27 class ApplicationImpl
;
31 class SurfacesScheduler
;
36 class PlatformEventSource
;
39 namespace view_manager
{
41 class ConnectionManager
;
43 class ViewManagerApp
: public mojo::ApplicationDelegate
,
44 public ConnectionManagerDelegate
,
45 public mojo::InterfaceFactory
<mojo::ViewTreeHostFactory
>,
46 public mojo::InterfaceFactory
<mojo::Gpu
>,
47 public mojo::ViewTreeHostFactory
{
50 ~ViewManagerApp() override
;
53 // ApplicationDelegate:
54 void Initialize(mojo::ApplicationImpl
* app
) override
;
55 bool ConfigureIncomingConnection(
56 mojo::ApplicationConnection
* connection
) override
;
58 // ConnectionManagerDelegate:
59 void OnNoMoreRootConnections() override
;
60 ClientConnection
* CreateClientConnectionForEmbedAtView(
61 ConnectionManager
* connection_manager
,
62 mojo::InterfaceRequest
<mojo::ViewTree
> tree_request
,
63 mojo::ConnectionSpecificId creator_id
,
64 mojo::URLRequestPtr request
,
65 const ViewId
& root_id
) override
;
66 ClientConnection
* CreateClientConnectionForEmbedAtView(
67 ConnectionManager
* connection_manager
,
68 mojo::InterfaceRequest
<mojo::ViewTree
> tree_request
,
69 mojo::ConnectionSpecificId creator_id
,
70 const ViewId
& root_id
,
71 mojo::ViewTreeClientPtr client
) override
;
73 // mojo::InterfaceFactory<mojo::ViewTreeHostFactory>:
75 mojo::ApplicationConnection
* connection
,
76 mojo::InterfaceRequest
<mojo::ViewTreeHostFactory
> request
) override
;
78 // mojo::InterfaceFactory<mojo::Gpu> implementation.
79 void Create(mojo::ApplicationConnection
* connection
,
80 mojo::InterfaceRequest
<mojo::Gpu
> request
) override
;
82 // mojo::ViewTreeHostFactory implementation.
83 void CreateViewTreeHost(mojo::InterfaceRequest
<mojo::ViewTreeHost
> host
,
84 mojo::ViewTreeHostClientPtr host_client
,
85 mojo::ViewTreeClientPtr tree_client
) override
;
87 mojo::WeakBindingSet
<mojo::ViewTreeHostFactory
> factory_bindings_
;
88 mojo::ApplicationImpl
* app_impl_
;
89 scoped_ptr
<ConnectionManager
> connection_manager_
;
90 mojo::TracingImpl tracing_
;
91 scoped_refptr
<gles2::GpuState
> gpu_state_
;
92 scoped_ptr
<ui::PlatformEventSource
> event_source_
;
96 scoped_refptr
<surfaces::SurfacesState
> surfaces_state_
;
98 DISALLOW_COPY_AND_ASSIGN(ViewManagerApp
);
101 } // namespace view_manager
103 #endif // COMPONENTS_VIEW_MANAGER_VIEW_MANAGER_APP_H_