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 MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_SERVICE_CONTEXT_H_
6 #define MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_SERVICE_CONTEXT_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "mojo/public/cpp/bindings/callback.h"
10 #include "mojo/public/cpp/bindings/interface_request.h"
11 #include "mojo/public/interfaces/application/service_provider.mojom.h"
12 #include "mojo/services/view_manager/view_manager_export.h"
15 class ApplicationConnection;
19 class ConnectionManager;
20 class ViewManagerInitServiceImpl;
22 // State shared between all ViewManagerInitService impls.
23 class MOJO_VIEW_MANAGER_EXPORT ViewManagerInitServiceContext {
25 ViewManagerInitServiceContext();
26 virtual ~ViewManagerInitServiceContext();
28 void AddConnection(ViewManagerInitServiceImpl* connection);
29 void RemoveConnection(ViewManagerInitServiceImpl* connection);
31 void ConfigureIncomingConnection(ApplicationConnection* connection);
33 void Embed(const String& url,
34 ServiceProviderPtr service_provider,
35 const Callback<void(bool)>& callback);
37 ConnectionManager* connection_manager() { return connection_manager_.get(); }
40 typedef std::vector<ViewManagerInitServiceImpl*> Connections;
42 struct ConnectParams {
47 InterfaceRequest<ServiceProvider> service_provider;
48 Callback<void(bool)> callback;
51 void OnNativeViewportDeleted();
53 scoped_ptr<ConnectionManager> connection_manager_;
54 Connections connections_;
56 bool deleting_connection_;
58 DISALLOW_COPY_AND_ASSIGN(ViewManagerInitServiceContext);
61 } // namespace service
64 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_INIT_SERVICE_CONTEXT_H_