1 // Copyright 2015 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 CONTENT_BROWSER_FRAME_HOST_FRAME_MOJO_SHELL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_MOJO_SHELL_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "mojo/application/public/interfaces/shell.mojom.h"
11 #include "mojo/common/weak_binding_set.h"
12 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
16 class RenderFrameHost
;
17 class ServiceRegistryImpl
;
19 // This provides the |mojo::Shell| service interface to each frame's
20 // ServiceRegistry, giving frames the ability to connect to Mojo applications.
21 class FrameMojoShell
: public mojo::Shell
{
23 explicit FrameMojoShell(RenderFrameHost
* frame_host
);
24 ~FrameMojoShell() override
;
26 void BindRequest(mojo::InterfaceRequest
<mojo::Shell
> shell_request
);
30 void ConnectToApplication(
31 mojo::URLRequestPtr application_url
,
32 mojo::InterfaceRequest
<mojo::ServiceProvider
> services
,
33 mojo::ServiceProviderPtr exposed_services
,
34 mojo::CapabilityFilterPtr filter
,
35 const ConnectToApplicationCallback
& callback
) override
;
36 void QuitApplication() override
;
38 ServiceRegistryImpl
* GetServiceRegistry();
40 RenderFrameHost
* frame_host_
;
41 mojo::WeakBindingSet
<mojo::Shell
> bindings_
;
43 // ServiceRegistry providing browser services to connected applications.
44 scoped_ptr
<ServiceRegistryImpl
> service_registry_
;
45 mojo::WeakBindingSet
<mojo::ServiceProvider
> service_provider_bindings_
;
47 DISALLOW_COPY_AND_ASSIGN(FrameMojoShell
);
50 } // namespace content
52 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_MOJO_SHELL_H_