OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_MOJO_SHELL_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_MOJO_SHELL_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_MOJO_SHELL_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_MOJO_SHELL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
9 #include "mojo/application/public/interfaces/shell.mojom.h" | 10 #include "mojo/application/public/interfaces/shell.mojom.h" |
10 #include "mojo/common/weak_binding_set.h" | 11 #include "mojo/common/weak_binding_set.h" |
11 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" | 12 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 | 15 |
15 class RenderFrameHost; | 16 class RenderFrameHost; |
17 class ServiceRegistryImpl; | |
16 | 18 |
17 // This provides the |mojo::Shell| service interface to each frame's | 19 // This provides the |mojo::Shell| service interface to each frame's |
18 // ServiceRegistry, giving frames the ability to connect to Mojo applications. | 20 // ServiceRegistry, giving frames the ability to connect to Mojo applications. |
19 class FrameMojoShell : public mojo::Shell { | 21 class FrameMojoShell : public mojo::Shell { |
20 public: | 22 public: |
21 explicit FrameMojoShell(RenderFrameHost* frame_host); | 23 explicit FrameMojoShell(RenderFrameHost* frame_host); |
22 ~FrameMojoShell() override; | 24 ~FrameMojoShell() override; |
23 | 25 |
24 void BindRequest(mojo::InterfaceRequest<mojo::Shell> shell_request); | 26 void BindRequest(mojo::InterfaceRequest<mojo::Shell> shell_request); |
25 | 27 |
26 private: | 28 private: |
27 // mojo::Shell: | 29 // mojo::Shell: |
28 void ConnectToApplication( | 30 void ConnectToApplication( |
29 mojo::URLRequestPtr application_url, | 31 mojo::URLRequestPtr application_url, |
30 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 32 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
31 mojo::ServiceProviderPtr exposed_services) override; | 33 mojo::ServiceProviderPtr exposed_services) override; |
32 void QuitApplication() override; | 34 void QuitApplication() override; |
33 | 35 |
36 ServiceRegistryImpl* GetServiceRegistry(); | |
37 | |
34 RenderFrameHost* frame_host_; | 38 RenderFrameHost* frame_host_; |
35 mojo::WeakBindingSet<mojo::Shell> bindings_; | 39 mojo::WeakBindingSet<mojo::Shell> bindings_; |
36 | 40 |
41 // ServiceRegistry providing browser services to connected applications. | |
42 scoped_ptr<ServiceRegistryImpl> service_registry_; | |
xhwang
2015/06/29 20:25:51
I am debating between doing this and using the ser
Ken Rockot(use gerrit already)
2015/07/06 18:58:00
What you're doing here seems right to me. We shoul
xhwang
2015/07/07 19:21:04
Acknowledged.
| |
43 | |
Ken Rockot(use gerrit already)
2015/07/06 18:58:00
Actually I think ServiceRegistry is overkill here
xhwang
2015/07/07 19:21:04
As discussed offline, the current ServiceProviderI
| |
37 DISALLOW_COPY_AND_ASSIGN(FrameMojoShell); | 44 DISALLOW_COPY_AND_ASSIGN(FrameMojoShell); |
38 }; | 45 }; |
39 | 46 |
40 } // namespace content | 47 } // namespace content |
41 | 48 |
42 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_MOJO_SHELL_H_ | 49 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_MOJO_SHELL_H_ |
OLD | NEW |