| OLD | NEW |
| 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 29 matching lines...) Expand all Loading... |
| 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 service_registry_.BindRemoteServiceProvider(message_pipe.Pass()); |
| 47 return true; | 47 return true; |
| 48 } | 48 } |
| 49 | 49 |
| 50 void MojoApplicationHost::Activate(IPC::Sender* sender, | 50 bool MojoApplicationHost::Activate(IPC::Sender* sender, |
| 51 base::ProcessHandle process_handle) { | 51 base::ProcessHandle process_handle) { |
| 52 DCHECK(!did_activate_); | 52 DCHECK(!did_activate_); |
| 53 DCHECK(client_handle_.is_valid()); | 53 DCHECK(client_handle_.is_valid()); |
| 54 | 54 |
| 55 base::PlatformFile client_file = | 55 base::PlatformFile client_file = |
| 56 PlatformFileFromScopedPlatformHandle(client_handle_.Pass()); | 56 PlatformFileFromScopedPlatformHandle(client_handle_.Pass()); |
| 57 did_activate_ = sender->Send(new MojoMsg_Activate( | 57 did_activate_ = sender->Send(new MojoMsg_Activate( |
| 58 IPC::GetFileHandleForProcess(client_file, process_handle, true))); | 58 IPC::GetFileHandleForProcess(client_file, process_handle, true))); |
| 59 return did_activate_; |
| 59 } | 60 } |
| 60 | 61 |
| 61 void MojoApplicationHost::WillDestroySoon() { | 62 void MojoApplicationHost::WillDestroySoon() { |
| 62 channel_init_.WillDestroySoon(); | 63 channel_init_.WillDestroySoon(); |
| 63 } | 64 } |
| 64 | 65 |
| 65 } // namespace content | 66 } // namespace content |
| OLD | NEW |