OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_COMMON_CHILD_PROCESS_HOST_H_ | 5 #ifndef CONTENT_COMMON_CHILD_PROCESS_HOST_H_ |
6 #define CONTENT_COMMON_CHILD_PROCESS_HOST_H_ | 6 #define CONTENT_COMMON_CHILD_PROCESS_HOST_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 | 13 |
14 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
15 #include <windows.h> | 15 #include <windows.h> |
16 #endif // defined(OS_WIN) | 16 #endif // defined(OS_WIN) |
17 | 17 |
18 #include "base/basictypes.h" | 18 #include "base/basictypes.h" |
19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
20 #include "content/common/notification_type.h" | 20 #include "content/common/content_notification_types.h" |
21 #include "ipc/ipc_channel_proxy.h" | 21 #include "ipc/ipc_channel_proxy.h" |
22 | 22 |
23 class CommandLine; | 23 class CommandLine; |
24 class FilePath; | 24 class FilePath; |
25 | 25 |
26 namespace IPC { | 26 namespace IPC { |
27 class Message; | 27 class Message; |
28 } | 28 } |
29 | 29 |
30 // Provides common functionality for hosting a child process and processing IPC | 30 // Provides common functionality for hosting a child process and processing IPC |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 bool opening_channel() { return opening_channel_; } | 87 bool opening_channel() { return opening_channel_; } |
88 const std::string& channel_id() { return channel_id_; } | 88 const std::string& channel_id() { return channel_id_; } |
89 IPC::Channel* channel() { return channel_.get(); } | 89 IPC::Channel* channel() { return channel_.get(); } |
90 | 90 |
91 // Called when the child process goes away. | 91 // Called when the child process goes away. |
92 virtual void OnChildDied(); | 92 virtual void OnChildDied(); |
93 // Notifies the derived class that we told the child process to kill itself. | 93 // Notifies the derived class that we told the child process to kill itself. |
94 virtual void ShutdownStarted(); | 94 virtual void ShutdownStarted(); |
95 // Subclasses can implement specific notification methods. | 95 // Subclasses can implement specific notification methods. |
96 virtual void Notify(NotificationType type); | 96 virtual void Notify(int type); |
97 | 97 |
98 private: | 98 private: |
99 // By using an internal class as the IPC::Channel::Listener, we can intercept | 99 // By using an internal class as the IPC::Channel::Listener, we can intercept |
100 // OnMessageReceived/OnChannelConnected and do our own processing before | 100 // OnMessageReceived/OnChannelConnected and do our own processing before |
101 // calling the subclass' implementation. | 101 // calling the subclass' implementation. |
102 class ListenerHook : public IPC::Channel::Listener { | 102 class ListenerHook : public IPC::Channel::Listener { |
103 public: | 103 public: |
104 explicit ListenerHook(ChildProcessHost* host); | 104 explicit ListenerHook(ChildProcessHost* host); |
105 virtual bool OnMessageReceived(const IPC::Message& msg); | 105 virtual bool OnMessageReceived(const IPC::Message& msg); |
106 virtual void OnChannelConnected(int32 peer_pid); | 106 virtual void OnChannelConnected(int32 peer_pid); |
(...skipping 10 matching lines...) Expand all Loading... |
117 | 117 |
118 // Holds all the IPC message filters. Since this object lives on the IO | 118 // Holds all the IPC message filters. Since this object lives on the IO |
119 // thread, we don't have a IPC::ChannelProxy and so we manage filters | 119 // thread, we don't have a IPC::ChannelProxy and so we manage filters |
120 // manually. | 120 // manually. |
121 std::vector<scoped_refptr<IPC::ChannelProxy::MessageFilter> > filters_; | 121 std::vector<scoped_refptr<IPC::ChannelProxy::MessageFilter> > filters_; |
122 | 122 |
123 DISALLOW_COPY_AND_ASSIGN(ChildProcessHost); | 123 DISALLOW_COPY_AND_ASSIGN(ChildProcessHost); |
124 }; | 124 }; |
125 | 125 |
126 #endif // CONTENT_COMMON_CHILD_PROCESS_HOST_H_ | 126 #endif // CONTENT_COMMON_CHILD_PROCESS_HOST_H_ |
OLD | NEW |