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

Side by Side Diff: trunk/src/content/browser/mojo/mojo_application_host.cc

Issue 352013002: Revert 279557 "Support exposing Mojo services between render fra..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 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
Property Changes:
Deleted: svn:eol-style
- LF
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 #include "content/browser/mojo/mojo_application_host.h" 5 #include "content/browser/mojo/mojo_application_host.h"
6 6
7 #include "content/common/mojo/mojo_messages.h" 7 #include "content/common/mojo/mojo_messages.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 #include "ipc/ipc_sender.h" 9 #include "ipc/ipc_sender.h"
10 #include "mojo/embedder/platform_channel_pair.h" 10 #include "mojo/embedder/platform_channel_pair.h"
(...skipping 12 matching lines...) Expand all
23 23
24 } // namespace 24 } // namespace
25 25
26 MojoApplicationHost::MojoApplicationHost() : did_activate_(false) { 26 MojoApplicationHost::MojoApplicationHost() : did_activate_(false) {
27 } 27 }
28 28
29 MojoApplicationHost::~MojoApplicationHost() { 29 MojoApplicationHost::~MojoApplicationHost() {
30 } 30 }
31 31
32 bool MojoApplicationHost::Init() { 32 bool MojoApplicationHost::Init() {
33 DCHECK(!client_handle_.is_valid()) << "Already initialized!"; 33 DCHECK(!child_service_provider_.get()) << "Already initialized!";
34 34
35 mojo::embedder::PlatformChannelPair channel_pair; 35 mojo::embedder::PlatformChannelPair channel_pair;
36 36
37 mojo::ScopedMessagePipeHandle message_pipe = channel_init_.Init( 37 mojo::ScopedMessagePipeHandle message_pipe = channel_init_.Init(
38 PlatformFileFromScopedPlatformHandle(channel_pair.PassServerHandle()), 38 PlatformFileFromScopedPlatformHandle(channel_pair.PassServerHandle()),
39 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 39 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
40 if (!message_pipe.is_valid()) 40 if (!message_pipe.is_valid())
41 return false; 41 return false;
42 42
43 // Forward this to the client once we know its process handle. 43 // Forward this to the client once we know its process handle.
44 client_handle_ = channel_pair.PassClientHandle(); 44 client_handle_ = channel_pair.PassClientHandle();
45 45
46 service_registry_.BindRemoteServiceProvider(message_pipe.Pass()); 46 child_service_provider_.reset(
47 BindToPipe(new ServiceProviderImpl(), message_pipe.Pass()));
47 return true; 48 return true;
48 } 49 }
49 50
50 bool MojoApplicationHost::Activate(IPC::Sender* sender, 51 bool MojoApplicationHost::Activate(IPC::Sender* sender,
51 base::ProcessHandle process_handle) { 52 base::ProcessHandle process_handle) {
52 DCHECK(!did_activate_); 53 DCHECK(!did_activate_);
53 DCHECK(client_handle_.is_valid()); 54 DCHECK(client_handle_.is_valid());
54 55
55 base::PlatformFile client_file = 56 base::PlatformFile client_file =
56 PlatformFileFromScopedPlatformHandle(client_handle_.Pass()); 57 PlatformFileFromScopedPlatformHandle(client_handle_.Pass());
57 did_activate_ = sender->Send(new MojoMsg_Activate( 58 did_activate_ = sender->Send(new MojoMsg_Activate(
58 IPC::GetFileHandleForProcess(client_file, process_handle, true))); 59 IPC::GetFileHandleForProcess(client_file, process_handle, true)));
59 return did_activate_; 60 return did_activate_;
60 } 61 }
61 62
63 void MojoApplicationHost::ServiceProviderImpl::ConnectToService(
64 const mojo::String& service_url,
65 const mojo::String& service_name,
66 mojo::ScopedMessagePipeHandle handle,
67 const mojo::String& requestor_url) {
68 // TODO(darin): Provide something meaningful here.
69 }
70
62 } // namespace content 71 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698