// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_MUS_MUS_APP_H_ #define COMPONENTS_MUS_MUS_APP_H_ #include #include #include #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "components/mus/public/interfaces/display.mojom.h" #include "components/mus/public/interfaces/gpu.mojom.h" #include "components/mus/public/interfaces/window_manager_factory.mojom.h" #include "components/mus/public/interfaces/window_tree.mojom.h" #include "components/mus/public/interfaces/window_tree_host.mojom.h" #include "components/mus/ws/connection_manager_delegate.h" #include "mojo/public/cpp/bindings/binding_set.h" #include "mojo/services/tracing/public/cpp/tracing_impl.h" #include "mojo/shell/public/cpp/interface_factory.h" #include "mojo/shell/public/cpp/shell_client.h" namespace mojo { class Connector; } namespace ui { class PlatformEventSource; } namespace mus { class GpuState; class SurfacesState; namespace ws { class ConnectionManager; class ForwardingWindowManager; class WindowTreeFactory; } class MandolineUIServicesApp : public mojo::ShellClient, public ws::ConnectionManagerDelegate, public mojo::InterfaceFactory, public mojo::InterfaceFactory, public mojo::InterfaceFactory, public mojo::InterfaceFactory, public mojo::InterfaceFactory, public mojom::WindowTreeHostFactory { public: MandolineUIServicesApp(); ~MandolineUIServicesApp() override; private: // Holds InterfaceRequests received before the first WindowTreeHost Display // has been established. struct PendingRequest; void InitializeResources(mojo::Connector* connector); // mojo::ShellClient: void Initialize(mojo::Connector* connector, const std::string& url, uint32_t id, uint32_t user_id) override; bool AcceptConnection(mojo::Connection* connection) override; // ConnectionManagerDelegate: void OnFirstDisplayReady() override; void OnNoMoreRootConnections() override; scoped_ptr CreateWindowTreeBindingForEmbedAtWindow( ws::ConnectionManager* connection_manager, ws::WindowTree* tree, mojom::WindowTreeRequest tree_request, mojom::WindowTreeClientPtr client) override; void CreateDefaultDisplays() override; // mojo::InterfaceFactory implementation. void Create(mojo::Connection* connection, mojom::DisplayManagerRequest request) override; // mojo::InterfaceFactory implementation. void Create(mojo::Connection* connection, mojom::WindowManagerFactoryServiceRequest request) override; // mojo::InterfaceFactory: void Create(mojo::Connection* connection, mojom::WindowTreeFactoryRequest request) override; // mojo::InterfaceFactory: void Create(mojo::Connection* connection, mojom::WindowTreeHostFactoryRequest request) override; // mojo::InterfaceFactory implementation. void Create(mojo::Connection* connection, mojom::GpuRequest request) override; // mojom::WindowTreeHostFactory implementation. void CreateWindowTreeHost(mojom::WindowTreeHostRequest host, mojom::WindowTreeClientPtr tree_client) override; mojo::BindingSet factory_bindings_; mojo::Connector* connector_; scoped_ptr connection_manager_; scoped_refptr gpu_state_; scoped_ptr event_source_; mojo::TracingImpl tracing_; using PendingRequests = std::vector>; PendingRequests pending_requests_; scoped_ptr window_tree_factory_; // Surfaces scoped_refptr surfaces_state_; DISALLOW_COPY_AND_ASSIGN(MandolineUIServicesApp); }; } // namespace mus #endif // COMPONENTS_MUS_MUS_APP_H_