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_
8 #include "base/memory/scoped_ptr.h"
9 #include "components/view_manager/connection_manager_delegate.h"
10 #include "components/view_manager/gles2/gpu_impl.h"
11 #include "components/view_manager/public/interfaces/view_manager.mojom.h"
12 #include "components/view_manager/public/interfaces/view_manager_root.mojom.h"
13 #include "mojo/application/public/cpp/app_lifetime_helper.h"
14 #include "mojo/application/public/cpp/application_delegate.h"
15 #include "mojo/application/public/cpp/interface_factory.h"
16 #include "mojo/common/tracing_impl.h"
19 class ApplicationImpl
;
23 class PlatformEventSource
;
26 namespace view_manager
{
28 class ConnectionManager
;
30 class ViewManagerApp
: public mojo::ApplicationDelegate
,
31 public ConnectionManagerDelegate
,
32 public mojo::InterfaceFactory
<mojo::ViewManagerRoot
>,
33 public mojo::InterfaceFactory
<mojo::Gpu
> {
36 ~ViewManagerApp() override
;
39 // ApplicationDelegate:
40 void Initialize(mojo::ApplicationImpl
* app
) override
;
41 bool ConfigureIncomingConnection(
42 mojo::ApplicationConnection
* connection
) override
;
44 // ConnectionManagerDelegate:
45 void OnNoMoreRootConnections() override
;
46 ClientConnection
* CreateClientConnectionForEmbedAtView(
47 ConnectionManager
* connection_manager
,
48 mojo::InterfaceRequest
<mojo::ViewManagerService
> service_request
,
49 mojo::ConnectionSpecificId creator_id
,
50 mojo::URLRequestPtr request
,
51 const ViewId
& root_id
) override
;
52 ClientConnection
* CreateClientConnectionForEmbedAtView(
53 ConnectionManager
* connection_manager
,
54 mojo::InterfaceRequest
<mojo::ViewManagerService
> service_request
,
55 mojo::ConnectionSpecificId creator_id
,
56 const ViewId
& root_id
,
57 mojo::ViewManagerClientPtr view_manager_client
) override
;
59 // mojo::InterfaceFactory<mojo::ViewManagerRoot>:
60 void Create(mojo::ApplicationConnection
* connection
,
61 mojo::InterfaceRequest
<mojo::ViewManagerRoot
> request
) override
;
63 // mojo::InterfaceFactory<mojo::Gpu> implementation.
64 void Create(mojo::ApplicationConnection
* connection
,
65 mojo::InterfaceRequest
<mojo::Gpu
> request
) override
;
67 mojo::ApplicationImpl
* app_impl_
;
68 scoped_ptr
<ConnectionManager
> connection_manager_
;
69 mojo::TracingImpl tracing_
;
70 scoped_refptr
<gles2::GpuState
> gpu_state_
;
71 scoped_ptr
<ui::PlatformEventSource
> event_source_
;
74 DISALLOW_COPY_AND_ASSIGN(ViewManagerApp
);
77 } // namespace view_manager
79 #endif // COMPONENTS_VIEW_MANAGER_VIEW_MANAGER_APP_H_