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

Side by Side Diff: content/browser/mojo/mojo_application_host.h

Issue 298003008: Shell / ShellClient -> ServiceProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/mojo/mojo_application_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ 5 #ifndef CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_
6 #define CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ 6 #define CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_
7 7
8 #include "base/process/process_handle.h" 8 #include "base/process/process_handle.h"
9 #include "mojo/common/channel_init.h" 9 #include "mojo/common/channel_init.h"
10 #include "mojo/embedder/scoped_platform_handle.h" 10 #include "mojo/embedder/scoped_platform_handle.h"
11 #include "mojo/public/interfaces/shell/shell.mojom.h" 11 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h"
12 12
13 namespace IPC { 13 namespace IPC {
14 class Sender; 14 class Sender;
15 } 15 }
16 16
17 namespace content { 17 namespace content {
18 18
19 // MojoApplicationHost represents the code needed on the browser side to setup 19 // MojoApplicationHost represents the code needed on the browser side to setup
20 // a child process as a Mojo application via Chrome IPC. The child process 20 // a child process as a Mojo application via Chrome IPC. The child process
21 // should use MojoApplication to handle messages generated by an instance of 21 // should use MojoApplication to handle messages generated by an instance of
22 // MojoApplicationHost. MojoApplicationHost makes the mojo::ShellClient 22 // MojoApplicationHost. MojoApplicationHost makes the mojo::ShellClient
23 // interface available so that child-provided services can be invoked. 23 // interface available so that child-provided services can be invoked.
24 class MojoApplicationHost { 24 class MojoApplicationHost {
25 public: 25 public:
26 MojoApplicationHost(); 26 MojoApplicationHost();
27 virtual ~MojoApplicationHost(); 27 virtual ~MojoApplicationHost();
28 28
29 // Two-phase initialization: 29 // Two-phase initialization:
30 // 1- Init makes the shell_client() available synchronously. 30 // 1- Init makes the shell_client() available synchronously.
31 // 2- Activate establishes the actual connection to the peer process. 31 // 2- Activate establishes the actual connection to the peer process.
32 bool Init(); 32 bool Init();
33 bool Activate(IPC::Sender* sender, base::ProcessHandle process_handle); 33 bool Activate(IPC::Sender* sender, base::ProcessHandle process_handle);
34 34
35 bool did_activate() const { return did_activate_; } 35 bool did_activate() const { return did_activate_; }
36 36
37 mojo::ShellClient* shell_client() { 37 mojo::ServiceProvider* service_provider() {
38 DCHECK(shell_.get()); 38 DCHECK(child_service_provider_.get());
39 return shell_->client(); 39 return child_service_provider_->client();
40 } 40 }
41 41
42 private: 42 private:
43 class ShellImpl : public mojo::InterfaceImpl<mojo::Shell> { 43 class ServiceProviderImpl
44 : public mojo::InterfaceImpl<mojo::ServiceProvider> {
44 public: 45 public:
45 virtual void OnConnectionError() OVERRIDE { 46 virtual void OnConnectionError() OVERRIDE {
46 // TODO(darin): How should we handle this error? 47 // TODO(darin): How should we handle this error?
47 } 48 }
48 49
49 // mojo::Shell methods: 50 // mojo::ServiceProvider methods:
50 virtual void Connect(const mojo::String& url, 51 virtual void ConnectToService(
51 mojo::ScopedMessagePipeHandle handle) OVERRIDE; 52 const mojo::String& url,
53 mojo::ScopedMessagePipeHandle handle) OVERRIDE;
52 }; 54 };
53 55
54 mojo::common::ChannelInit channel_init_; 56 mojo::common::ChannelInit channel_init_;
55 mojo::embedder::ScopedPlatformHandle client_handle_; 57 mojo::embedder::ScopedPlatformHandle client_handle_;
56 58
57 scoped_ptr<ShellImpl> shell_; 59 scoped_ptr<ServiceProviderImpl> child_service_provider_;
58 60
59 bool did_activate_; 61 bool did_activate_;
60 62
61 DISALLOW_COPY_AND_ASSIGN(MojoApplicationHost); 63 DISALLOW_COPY_AND_ASSIGN(MojoApplicationHost);
62 }; 64 };
63 65
64 } // namespace content 66 } // namespace content
65 67
66 #endif // CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_ 68 #endif // CONTENT_BROWSER_MOJO_MOJO_APPLICATION_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/mojo/mojo_application_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698