OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_PLUGIN_PLUGIN_CHANNEL_H_ | 5 #ifndef CHROME_PLUGIN_PLUGIN_CHANNEL_H_ |
6 #define CHROME_PLUGIN_PLUGIN_CHANNEL_H_ | 6 #define CHROME_PLUGIN_PLUGIN_CHANNEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // Returns the event that's set when a call to the renderer causes a modal | 43 // Returns the event that's set when a call to the renderer causes a modal |
44 // dialog to come up. | 44 // dialog to come up. |
45 base::WaitableEvent* GetModalDialogEvent(gfx::NativeViewId containing_window); | 45 base::WaitableEvent* GetModalDialogEvent(gfx::NativeViewId containing_window); |
46 | 46 |
47 bool in_send() { return in_send_ != 0; } | 47 bool in_send() { return in_send_ != 0; } |
48 | 48 |
49 bool off_the_record() { return off_the_record_; } | 49 bool off_the_record() { return off_the_record_; } |
50 void set_off_the_record(bool value) { off_the_record_ = value; } | 50 void set_off_the_record(bool value) { off_the_record_ = value; } |
51 | 51 |
52 #if defined(OS_POSIX) | 52 #if defined(OS_POSIX) |
53 int renderer_fd() const { return renderer_fd_; } | 53 int renderer_fd() const { return channel_->GetClientFileDescriptor(); } |
54 #endif | 54 #endif |
55 | 55 |
56 protected: | 56 protected: |
57 // IPC::Channel::Listener implementation: | 57 // IPC::Channel::Listener implementation: |
58 virtual void OnChannelConnected(int32 peer_pid); | 58 virtual void OnChannelConnected(int32 peer_pid); |
59 virtual void OnChannelError(); | 59 virtual void OnChannelError(); |
60 | 60 |
61 virtual void CleanUp(); | 61 virtual void CleanUp(); |
62 | 62 |
63 // Overrides PluginChannelBase::Init. | 63 // Overrides PluginChannelBase::Init. |
64 virtual bool Init(MessageLoop* ipc_message_loop, bool create_pipe_now); | 64 virtual bool Init(MessageLoop* ipc_message_loop, bool create_pipe_now); |
65 | 65 |
66 private: | 66 private: |
67 class MessageFilter; | 67 class MessageFilter; |
68 | 68 |
69 // Called on the plugin thread | 69 // Called on the plugin thread |
70 PluginChannel(); | 70 PluginChannel(); |
71 | 71 |
72 void OnControlMessageReceived(const IPC::Message& msg); | 72 void OnControlMessageReceived(const IPC::Message& msg); |
73 | 73 |
74 static PluginChannelBase* ClassFactory() { return new PluginChannel(); } | 74 static PluginChannelBase* ClassFactory() { return new PluginChannel(); } |
75 | 75 |
76 void OnCreateInstance(const std::string& mime_type, int* instance_id); | 76 void OnCreateInstance(const std::string& mime_type, int* instance_id); |
77 void OnDestroyInstance(int instance_id, IPC::Message* reply_msg); | 77 void OnDestroyInstance(int instance_id, IPC::Message* reply_msg); |
78 void OnGenerateRouteID(int* route_id); | 78 void OnGenerateRouteID(int* route_id); |
79 void OnClearSiteData(uint64 flags, | 79 void OnClearSiteData(uint64 flags, |
80 const std::string& domain, | 80 const std::string& domain, |
81 base::Time begin_time); | 81 base::Time begin_time); |
82 | 82 |
83 #if defined(OS_POSIX) | |
84 // Close the plugin process' copy of the renderer's side of the plugin | |
85 // channel. This can be called after the renderer is known to have its own | |
86 // copy of renderer_fd_. | |
87 void CloseRendererFD(); | |
88 #endif | |
89 | |
90 std::vector<scoped_refptr<WebPluginDelegateStub> > plugin_stubs_; | 83 std::vector<scoped_refptr<WebPluginDelegateStub> > plugin_stubs_; |
91 | 84 |
92 // Handle to the renderer process who is on the other side of the channel. | 85 // Handle to the renderer process who is on the other side of the channel. |
93 base::ProcessHandle renderer_handle_; | 86 base::ProcessHandle renderer_handle_; |
94 | 87 |
95 // The id of the renderer who is on the other side of the channel. | 88 // The id of the renderer who is on the other side of the channel. |
96 int renderer_id_; | 89 int renderer_id_; |
97 | 90 |
98 #if defined(OS_POSIX) | |
99 // FD for the renderer end of the socket. It is closed when the IPC layer | |
100 // indicates that the channel is connected, proving that the renderer has | |
101 // access to its side of the socket. | |
102 int renderer_fd_; | |
103 #endif | |
104 | |
105 int in_send_; // Tracks if we're in a Send call. | 91 int in_send_; // Tracks if we're in a Send call. |
106 bool log_messages_; // True if we should log sent and received messages. | 92 bool log_messages_; // True if we should log sent and received messages. |
107 bool off_the_record_; // True if the renderer is in off the record mode. | 93 bool off_the_record_; // True if the renderer is in off the record mode. |
108 scoped_refptr<MessageFilter> filter_; // Handles the modal dialog events. | 94 scoped_refptr<MessageFilter> filter_; // Handles the modal dialog events. |
109 | 95 |
110 DISALLOW_COPY_AND_ASSIGN(PluginChannel); | 96 DISALLOW_COPY_AND_ASSIGN(PluginChannel); |
111 }; | 97 }; |
112 | 98 |
113 #endif // CHROME_PLUGIN_PLUGIN_CHANNEL_H_ | 99 #endif // CHROME_PLUGIN_PLUGIN_CHANNEL_H_ |
OLD | NEW |