Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: content/child/mojo/mojo_application.h

Issue 285333003: Support exposing Mojo services between render frames, render threads, and their respective hosts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix gn Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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_CHILD_MOJO_MOJO_APPLICATION_H_ 5 #ifndef CONTENT_CHILD_MOJO_MOJO_APPLICATION_H_
6 #define CONTENT_CHILD_MOJO_MOJO_APPLICATION_H_ 6 #define CONTENT_CHILD_MOJO_MOJO_APPLICATION_H_
7 7
8 #include "content/common/mojo/service_registry_impl.h"
8 #include "ipc/ipc_platform_file.h" 9 #include "ipc/ipc_platform_file.h"
9 #include "mojo/common/channel_init.h" 10 #include "mojo/common/channel_init.h"
10 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h"
11 11
12 namespace IPC { 12 namespace IPC {
13 class Message; 13 class Message;
14 } 14 }
15 15
16 namespace content { 16 namespace content {
17 17
18 // MojoApplication represents the code needed to setup a child process as a 18 // MojoApplication represents the code needed to setup a child process as a
19 // Mojo application via Chrome IPC. Instantiate MojoApplication and call its 19 // Mojo application via Chrome IPC. Instantiate MojoApplication and call its
20 // OnMessageReceived method to give it a shot at handling Chrome IPC messages. 20 // OnMessageReceived method to give it a shot at handling Chrome IPC messages.
21 // It makes the mojo::Shell interface available and calls methods on the given 21 // It makes the mojo::Shell interface available and calls methods on the given
22 // mojo::ShellClient interface as calls come in. 22 // mojo::ShellClient interface as calls come in.
23 class MojoApplication { 23 class MojoApplication {
24 public: 24 public:
25 // The ShellClient pointer must remain valid for the lifetime of the 25 MojoApplication();
26 // MojoApplication instance. 26 virtual ~MojoApplication();
27 explicit MojoApplication(mojo::ServiceProvider* service_provider);
28 ~MojoApplication();
29 27
30 bool OnMessageReceived(const IPC::Message& msg); 28 bool OnMessageReceived(const IPC::Message& msg);
31 29
32 mojo::ServiceProvider* host_service_provider() { 30 ServiceRegistry* service_registry() { return &service_registry_; }
33 return host_service_provider_.get();
34 }
35 31
36 private: 32 private:
37 void OnActivate(const IPC::PlatformFileForTransit& file); 33 void OnActivate(const IPC::PlatformFileForTransit& file);
38 34
39 mojo::common::ChannelInit channel_init_; 35 mojo::common::ChannelInit channel_init_;
40 mojo::ServiceProviderPtr host_service_provider_; 36
41 mojo::ServiceProvider* service_provider_; 37 ServiceRegistryImpl service_registry_;
42 38
43 DISALLOW_COPY_AND_ASSIGN(MojoApplication); 39 DISALLOW_COPY_AND_ASSIGN(MojoApplication);
44 }; 40 };
45 41
46 } // namespace content 42 } // namespace content
47 43
48 #endif // CONTENT_CHILD_MOJO_MOJO_APPLICATION_H_ 44 #endif // CONTENT_CHILD_MOJO_MOJO_APPLICATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698