Roll src/third_party/WebKit 48de1d8:ada7a3d (svn 202597:202598)
[chromium-blink-merge.git] / components / mus / mus_app.h
blobdb528e1b7cfe94bbdbf29edf6c729791c978d051
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_MUS_VIEW_MANAGER_APP_H_
6 #define COMPONENTS_MUS_VIEW_MANAGER_APP_H_
8 #include <set>
10 #include "base/memory/scoped_ptr.h"
11 #include "cc/surfaces/surface_manager.h"
12 #include "components/mus/connection_manager_delegate.h"
13 #include "components/mus/public/interfaces/gpu.mojom.h"
14 #include "components/mus/public/interfaces/view_tree.mojom.h"
15 #include "components/mus/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"
22 namespace mojo {
23 class ApplicationImpl;
26 namespace ui {
27 class PlatformEventSource;
30 namespace mus {
32 class ConnectionManager;
33 class GpuState;
34 class SurfacesScheduler;
35 class SurfacesState;
37 class MandolineUIServicesApp
38 : public mojo::ApplicationDelegate,
39 public ConnectionManagerDelegate,
40 public mojo::InterfaceFactory<mojo::ViewTreeHostFactory>,
41 public mojo::InterfaceFactory<mojo::Gpu>,
42 public mojo::ViewTreeHostFactory {
43 public:
44 MandolineUIServicesApp();
45 ~MandolineUIServicesApp() override;
47 private:
48 // ApplicationDelegate:
49 void Initialize(mojo::ApplicationImpl* app) override;
50 bool ConfigureIncomingConnection(
51 mojo::ApplicationConnection* connection) override;
53 // ConnectionManagerDelegate:
54 void OnNoMoreRootConnections() override;
55 ClientConnection* CreateClientConnectionForEmbedAtView(
56 ConnectionManager* connection_manager,
57 mojo::InterfaceRequest<mojo::ViewTree> tree_request,
58 ConnectionSpecificId creator_id,
59 mojo::URLRequestPtr request,
60 const ViewId& root_id,
61 uint32_t policy_bitmask) override;
62 ClientConnection* CreateClientConnectionForEmbedAtView(
63 ConnectionManager* connection_manager,
64 mojo::InterfaceRequest<mojo::ViewTree> tree_request,
65 ConnectionSpecificId creator_id,
66 const ViewId& root_id,
67 uint32_t policy_bitmask,
68 mojo::ViewTreeClientPtr client) override;
70 // mojo::InterfaceFactory<mojo::ViewTreeHostFactory>:
71 void Create(
72 mojo::ApplicationConnection* connection,
73 mojo::InterfaceRequest<mojo::ViewTreeHostFactory> request) override;
75 // mojo::InterfaceFactory<mojo::Gpu> implementation.
76 void Create(mojo::ApplicationConnection* connection,
77 mojo::InterfaceRequest<mojo::Gpu> request) override;
79 // mojo::ViewTreeHostFactory implementation.
80 void CreateViewTreeHost(mojo::InterfaceRequest<mojo::ViewTreeHost> host,
81 mojo::ViewTreeHostClientPtr host_client,
82 mojo::ViewTreeClientPtr tree_client) override;
84 mojo::WeakBindingSet<mojo::ViewTreeHostFactory> factory_bindings_;
85 mojo::ApplicationImpl* app_impl_;
86 scoped_ptr<ConnectionManager> connection_manager_;
87 mojo::TracingImpl tracing_;
88 scoped_refptr<GpuState> gpu_state_;
89 scoped_ptr<ui::PlatformEventSource> event_source_;
90 bool is_headless_;
92 // Surfaces
93 scoped_refptr<SurfacesState> surfaces_state_;
95 DISALLOW_COPY_AND_ASSIGN(MandolineUIServicesApp);
98 } // namespace mus
100 #endif // COMPONENTS_MUS_VIEW_MANAGER_APP_H_