Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / components / view_manager / view_manager_app.h
blob3866903b19ac1315b709b764fc00e0a77f247819
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 <set>
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/surfaces.mojom.h"
15 #include "components/view_manager/public/interfaces/view_manager.mojom.h"
16 #include "components/view_manager/public/interfaces/view_manager_root.mojom.h"
17 #include "components/view_manager/surfaces/surfaces_delegate.h"
18 #include "mojo/application/public/cpp/app_lifetime_helper.h"
19 #include "mojo/application/public/cpp/application_delegate.h"
20 #include "mojo/application/public/cpp/interface_factory.h"
21 #include "mojo/common/tracing_impl.h"
23 namespace gles2 {
24 class GpuState;
27 namespace mojo {
28 class ApplicationImpl;
31 namespace surfaces {
32 class DisplayImpl;
33 class SurfacesImpl;
34 class SurfacesScheduler;
35 class SurfacesState;
38 namespace ui {
39 class PlatformEventSource;
42 namespace view_manager {
44 class ConnectionManager;
46 class ViewManagerApp : public mojo::ApplicationDelegate,
47 public ConnectionManagerDelegate,
48 public mojo::InterfaceFactory<mojo::Surface>,
49 public mojo::InterfaceFactory<mojo::ViewManagerRoot>,
50 public mojo::InterfaceFactory<mojo::Gpu>,
51 public surfaces::SurfacesDelegate {
52 public:
53 ViewManagerApp();
54 ~ViewManagerApp() override;
56 private:
57 // ApplicationDelegate:
58 void Initialize(mojo::ApplicationImpl* app) override;
59 bool ConfigureIncomingConnection(
60 mojo::ApplicationConnection* connection) override;
62 // ConnectionManagerDelegate:
63 void OnNoMoreRootConnections() override;
64 ClientConnection* CreateClientConnectionForEmbedAtView(
65 ConnectionManager* connection_manager,
66 mojo::InterfaceRequest<mojo::ViewManagerService> service_request,
67 mojo::ConnectionSpecificId creator_id,
68 mojo::URLRequestPtr request,
69 const ViewId& root_id) override;
70 ClientConnection* CreateClientConnectionForEmbedAtView(
71 ConnectionManager* connection_manager,
72 mojo::InterfaceRequest<mojo::ViewManagerService> service_request,
73 mojo::ConnectionSpecificId creator_id,
74 const ViewId& root_id,
75 mojo::ViewManagerClientPtr view_manager_client) override;
77 // mojo::InterfaceFactory<mojo::ViewManagerRoot>:
78 void Create(mojo::ApplicationConnection* connection,
79 mojo::InterfaceRequest<mojo::ViewManagerRoot> request) override;
81 // mojo::InterfaceFactory<mojo::Gpu> implementation.
82 void Create(mojo::ApplicationConnection* connection,
83 mojo::InterfaceRequest<mojo::Gpu> request) override;
85 // InterfaceFactory<Surface> implementation.
86 void Create(mojo::ApplicationConnection* connection,
87 mojo::InterfaceRequest<mojo::Surface> request) override;
89 // SurfacesDelegat implementation.
90 void OnSurfaceConnectionClosed(surfaces::SurfacesImpl* surface) override;
92 // ViewManager
93 mojo::ApplicationImpl* app_impl_;
94 scoped_ptr<ConnectionManager> connection_manager_;
95 mojo::TracingImpl tracing_;
96 scoped_refptr<gles2::GpuState> gpu_state_;
97 scoped_ptr<ui::PlatformEventSource> event_source_;
98 bool is_headless_;
100 // Surfaces
101 std::set<surfaces::SurfacesImpl*> surfaces_;
102 scoped_refptr<surfaces::SurfacesState> surfaces_state_;
104 DISALLOW_COPY_AND_ASSIGN(ViewManagerApp);
107 } // namespace view_manager
109 #endif // COMPONENTS_VIEW_MANAGER_VIEW_MANAGER_APP_H_