| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
| 7 | 7 |
| 8 #include "base/environment.h" | 8 #include "base/environment.h" |
| 9 #include "base/process/kill.h" | 9 #include "base/process/kill.h" |
| 10 #include "base/process/process_handle.h" | 10 #include "base/process/process_handle.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "content/public/common/process_type.h" | 14 #include "content/public/common/process_type.h" |
| 15 #include "ipc/ipc_sender.h" | 15 #include "ipc/ipc_sender.h" |
| 16 | 16 |
| 17 #if defined(OS_MACOSX) | 17 #if defined(OS_MACOSX) |
| 18 #include "base/process/port_provider_mac.h" | 18 #include "base/process/port_provider_mac.h" |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 namespace base { | 21 namespace base { |
| 22 class CommandLine; | 22 class CommandLine; |
| 23 class FilePath; | 23 class FilePath; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace shell { |
| 27 class InterfaceProvider; |
| 28 class InterfaceRegistry; |
| 29 } |
| 30 |
| 26 namespace content { | 31 namespace content { |
| 27 | 32 |
| 28 class BrowserChildProcessHostDelegate; | 33 class BrowserChildProcessHostDelegate; |
| 29 class ChildProcessHost; | 34 class ChildProcessHost; |
| 30 class SandboxedProcessLauncherDelegate; | 35 class SandboxedProcessLauncherDelegate; |
| 31 class ServiceRegistry; | |
| 32 struct ChildProcessData; | 36 struct ChildProcessData; |
| 33 | 37 |
| 34 // This represents child processes of the browser process, i.e. plugins. They | 38 // This represents child processes of the browser process, i.e. plugins. They |
| 35 // will get terminated at browser shutdown. | 39 // will get terminated at browser shutdown. |
| 36 class CONTENT_EXPORT BrowserChildProcessHost : public IPC::Sender { | 40 class CONTENT_EXPORT BrowserChildProcessHost : public IPC::Sender { |
| 37 public: | 41 public: |
| 38 // Used to create a child process host. The delegate must outlive this object. | 42 // Used to create a child process host. The delegate must outlive this object. |
| 39 // |process_type| needs to be either an enum value from ProcessType or an | 43 // |process_type| needs to be either an enum value from ProcessType or an |
| 40 // embedder-defined value. | 44 // embedder-defined value. |
| 41 static BrowserChildProcessHost* Create( | 45 static BrowserChildProcessHost* Create( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // Sets the user-visible name of the process. | 86 // Sets the user-visible name of the process. |
| 83 virtual void SetName(const base::string16& name) = 0; | 87 virtual void SetName(const base::string16& name) = 0; |
| 84 | 88 |
| 85 // Set the handle of the process. BrowserChildProcessHost will do this when | 89 // Set the handle of the process. BrowserChildProcessHost will do this when |
| 86 // the Launch method is used to start the process. However if the owner | 90 // the Launch method is used to start the process. However if the owner |
| 87 // of this object doesn't call Launch and starts the process in another way, | 91 // of this object doesn't call Launch and starts the process in another way, |
| 88 // they need to call this method so that the process handle is associated with | 92 // they need to call this method so that the process handle is associated with |
| 89 // this object. | 93 // this object. |
| 90 virtual void SetHandle(base::ProcessHandle handle) = 0; | 94 virtual void SetHandle(base::ProcessHandle handle) = 0; |
| 91 | 95 |
| 92 // Get the Mojo service registry connected to the child process. Returns | 96 // Returns the shell::InterfaceRegistry the browser process uses to expose |
| 93 // nullptr if no service registry exists. | 97 // interfaces to the child. |
| 94 virtual ServiceRegistry* GetServiceRegistry() = 0; | 98 virtual shell::InterfaceRegistry* GetInterfaceRegistry() = 0; |
| 99 |
| 100 // Returns the shell::InterfaceProvider the browser process can use to bind |
| 101 // interfaces exposed to it from the child. |
| 102 virtual shell::InterfaceProvider* GetRemoteInterfaces() = 0; |
| 95 | 103 |
| 96 #if defined(OS_MACOSX) | 104 #if defined(OS_MACOSX) |
| 97 // Returns a PortProvider used to get the task port for child processes. | 105 // Returns a PortProvider used to get the task port for child processes. |
| 98 static base::PortProvider* GetPortProvider(); | 106 static base::PortProvider* GetPortProvider(); |
| 99 #endif | 107 #endif |
| 100 }; | 108 }; |
| 101 | 109 |
| 102 }; // namespace content | 110 }; // namespace content |
| 103 | 111 |
| 104 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ | 112 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_CHILD_PROCESS_HOST_H_ |
| OLD | NEW |