summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-01 01:48:52 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-01 01:48:52 +0000
commit829c2841a0e30b9f08453566ffc52d2c386a9045 (patch)
treeb916ff2699e97a13f027d3e2cb60be781c0e18c8 /chrome/common
parent5c0b8e45fa1260f311d71073c8a9b89db199d992 (diff)
downloadchromium_src-829c2841a0e30b9f08453566ffc52d2c386a9045.zip
chromium_src-829c2841a0e30b9f08453566ffc52d2c386a9045.tar.gz
chromium_src-829c2841a0e30b9f08453566ffc52d2c386a9045.tar.bz2
Port plugin messages.
Review URL: http://codereview.chromium.org/49050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12928 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/child_process_host.cc10
-rw-r--r--chrome/common/child_thread.cc8
-rw-r--r--chrome/common/ipc_logging.cc5
-rw-r--r--chrome/common/plugin_messages.h56
-rw-r--r--chrome/common/plugin_messages_internal.h39
5 files changed, 53 insertions, 65 deletions
diff --git a/chrome/common/child_process_host.cc b/chrome/common/child_process_host.cc
index b22d751..7f934b0 100644
--- a/chrome/common/child_process_host.cc
+++ b/chrome/common/child_process_host.cc
@@ -14,12 +14,10 @@
#include "chrome/common/ipc_logging.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
+#include "chrome/common/plugin_messages.h"
#include "chrome/common/process_watcher.h"
#include "chrome/common/result_codes.h"
-#if defined(OS_WIN)
-#include "chrome/common/plugin_messages.h"
-#endif
namespace {
typedef std::list<ChildProcessHost*> ChildProcessList;
@@ -153,7 +151,6 @@ void ChildProcessHost::ListenerHook::OnMessageReceived(
msg, host_, &msg_is_ok);
if (!handled) {
-#if defined(OS_WIN)
if (msg.type() == PluginProcessHostMsg_ShutdownRequest::ID) {
// Must remove the process from the list now, in case it gets used for a
// new instance before our watcher tells us that the process terminated.
@@ -161,9 +158,6 @@ void ChildProcessHost::ListenerHook::OnMessageReceived(
if (host_->CanShutdown())
host_->Send(new PluginProcessMsg_Shutdown());
} else {
-#else
- {
-#endif
host_->OnMessageReceived(msg);
}
}
@@ -180,9 +174,7 @@ void ChildProcessHost::ListenerHook::OnMessageReceived(
void ChildProcessHost::ListenerHook::OnChannelConnected(int32 peer_pid) {
host_->opening_channel_ = false;
host_->OnChannelConnected(peer_pid);
-#if defined(OS_WIN)
host_->Send(new PluginProcessMsg_AskBeforeShutdown());
-#endif
// Notify in the main loop of the connection.
host_->Notify(NotificationType::CHILD_PROCESS_HOST_CONNECTED);
diff --git a/chrome/common/child_thread.cc b/chrome/common/child_thread.cc
index c1ad034..94b3186 100644
--- a/chrome/common/child_thread.cc
+++ b/chrome/common/child_thread.cc
@@ -9,11 +9,9 @@
#include "chrome/common/child_process.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/ipc_logging.h"
+#include "chrome/common/plugin_messages.h"
#include "webkit/glue/webkit_glue.h"
-#if defined(OS_WIN)
-#include "chrome/common/plugin_messages.h"
-#endif
// V8 needs a 1MB stack size.
const size_t ChildThread::kV8StackSize = 1024 * 1024;
@@ -71,7 +69,6 @@ void ChildThread::OnMessageReceived(const IPC::Message& msg) {
if (resource_dispatcher_->OnMessageReceived(msg))
return;
-#if defined(OS_WIN)
if (msg.type() == PluginProcessMsg_AskBeforeShutdown::ID) {
check_with_browser_before_shutdown_ = true;
return;
@@ -81,7 +78,6 @@ void ChildThread::OnMessageReceived(const IPC::Message& msg) {
owner_loop_->PostTask(FROM_HERE, new MessageLoop::QuitTask());
return;
}
-#endif
if (msg.routing_id() == MSG_ROUTING_CONTROL) {
OnControlMessageReceived(msg);
@@ -121,11 +117,9 @@ void ChildThread::OnProcessFinalRelease() {
return;
}
-#if defined(OS_WIN)
// The child process shutdown sequence is a request response based mechanism,
// where we send out an initial feeler request to the child process host
// instance in the browser to verify if it's ok to shutdown the child process.
// The browser then sends back a response if it's ok to shutdown.
Send(new PluginProcessHostMsg_ShutdownRequest);
-#endif
}
diff --git a/chrome/common/ipc_logging.cc b/chrome/common/ipc_logging.cc
index d02b3b2..cb63533 100644
--- a/chrome/common/ipc_logging.cc
+++ b/chrome/common/ipc_logging.cc
@@ -27,8 +27,11 @@
// can get *MsgLog function etc. This makes ipc logs much more informative.
#include "chrome/common/render_messages.h"
#include "chrome/test/automation/automation_messages.h"
+
#if defined(OS_WIN)
-// TODO(port): These messages will need to be ported at some point
+// Pulling this file in Mac/Linux causes a lot of binaries to need to bring in
+// WebKit and all the dependencies, which results in a very large number of
+// linker errors.
#include "chrome/common/plugin_messages.h"
#endif
diff --git a/chrome/common/plugin_messages.h b/chrome/common/plugin_messages.h
index 4cc8048..7b5ce73 100644
--- a/chrome/common/plugin_messages.h
+++ b/chrome/common/plugin_messages.h
@@ -13,6 +13,7 @@
#include <string>
#include <vector>
+#include "base/gfx/native_widget_types.h"
#include "base/gfx/rect.h"
#include "base/basictypes.h"
#include "chrome/common/ipc_message_utils.h"
@@ -27,12 +28,14 @@
// predefined IPC message.
struct PluginMsg_Init_Params {
- HWND containing_window;
+ gfx::NativeViewId containing_window;
GURL url;
std::vector<std::string> arg_names;
std::vector<std::string> arg_values;
- bool load_manually;
+#if defined(OS_WIN)
HANDLE modal_dialog_event;
+#endif
+ bool load_manually;
};
struct PluginHostMsg_URLRequest_Params {
@@ -43,7 +46,7 @@ struct PluginHostMsg_URLRequest_Params {
bool is_file_data;
bool notify;
std::string url;
- HANDLE notify_data;
+ intptr_t notify_data;
bool popups_allowed;
};
@@ -51,13 +54,8 @@ struct PluginMsg_URLRequestReply_Params {
int resource_id;
std::string url;
bool notify_needed;
- HANDLE notify_data;
- HANDLE stream;
-};
-
-struct PluginMsg_PrintResponse_Params {
- HANDLE shared_memory;
- size_t size;
+ intptr_t notify_data;
+ intptr_t stream;
};
struct PluginMsg_DidReceiveResponseParams {
@@ -96,7 +94,7 @@ struct NPVariant_Param {
double double_value;
std::string string_value;
int npobject_routing_id;
- void* npobject_pointer;
+ intptr_t npobject_pointer;
};
@@ -112,16 +110,20 @@ struct ParamTraits<PluginMsg_Init_Params> {
DCHECK(p.arg_names.size() == p.arg_values.size());
WriteParam(m, p.arg_names);
WriteParam(m, p.arg_values);
- WriteParam(m, p.load_manually);
+#if defined(OS_WIN)
WriteParam(m, p.modal_dialog_event);
+#endif
+ WriteParam(m, p.load_manually);
}
static bool Read(const Message* m, void** iter, param_type* p) {
return ReadParam(m, iter, &p->containing_window) &&
ReadParam(m, iter, &p->url) &&
ReadParam(m, iter, &p->arg_names) &&
ReadParam(m, iter, &p->arg_values) &&
- ReadParam(m, iter, &p->load_manually) &&
- ReadParam(m, iter, &p->modal_dialog_event);
+#if defined(OS_WIN)
+ ReadParam(m, iter, &p->modal_dialog_event) &&
+#endif
+ ReadParam(m, iter, &p->load_manually);
}
static void Log(const param_type& p, std::wstring* l) {
l->append(L"(");
@@ -133,9 +135,11 @@ struct ParamTraits<PluginMsg_Init_Params> {
l->append(L", ");
LogParam(p.arg_values, l);
l->append(L", ");
- LogParam(p.load_manually, l);
- l->append(L", ");
+#if defined(OS_WIN)
LogParam(p.modal_dialog_event, l);
+ l->append(L", ");
+#endif
+ LogParam(p.load_manually, l);
l->append(L")");
}
};
@@ -223,22 +227,6 @@ struct ParamTraits<PluginMsg_URLRequestReply_Params> {
};
template <>
-struct ParamTraits<PluginMsg_PrintResponse_Params> {
- typedef PluginMsg_PrintResponse_Params param_type;
- static void Write(Message* m, const param_type& p) {
- WriteParam(m, p.shared_memory);
- WriteParam(m, p.size);
- }
- static bool Read(const Message* m, void** iter, param_type* r) {
- return
- ReadParam(m, iter, &r->shared_memory) &&
- ReadParam(m, iter, &r->size);
- }
- static void Log(const param_type& p, std::wstring* l) {
- }
-};
-
-template <>
struct ParamTraits<PluginMsg_DidReceiveResponseParams> {
typedef PluginMsg_DidReceiveResponseParams param_type;
static void Write(Message* m, const param_type& p) {
@@ -294,6 +282,7 @@ struct ParamTraits<NPEvent> {
return true;
}
static void Log(const param_type& p, std::wstring* l) {
+#if defined(OS_WIN)
std::wstring event, wparam, lparam;
lparam = StringPrintf(L"(%d, %d)", LOWORD(p.lParam), HIWORD(p.lParam));
switch(p.event) {
@@ -356,6 +345,9 @@ struct ParamTraits<NPEvent> {
l->append(L", ");
LogParam(lparam, l);
l->append(L")");
+#else
+ l->append(L"<NPEvent>");
+#endif
}
};
diff --git a/chrome/common/plugin_messages_internal.h b/chrome/common/plugin_messages_internal.h
index 61c53f0..11a0365 100644
--- a/chrome/common/plugin_messages_internal.h
+++ b/chrome/common/plugin_messages_internal.h
@@ -41,11 +41,6 @@ IPC_BEGIN_MESSAGES(PluginProcessHost)
IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_ChannelCreated,
std::wstring /* channel_name */)
- IPC_MESSAGE_ROUTED3(PluginProcessHostMsg_DownloadUrl,
- std::string /* URL */,
- int /* process id */,
- HWND /* caller window */)
-
IPC_SYNC_MESSAGE_CONTROL0_1(PluginProcessHostMsg_GetPluginFinderUrl,
std::string /* plugin finder URL */)
@@ -77,6 +72,7 @@ IPC_BEGIN_MESSAGES(PluginProcessHost)
int /* network error */,
std::string /* proxy list */)
+#if defined(OS_WIN)
// Creates a child window of the given parent window on the UI thread.
IPC_SYNC_MESSAGE_CONTROL1_1(PluginProcessHostMsg_CreateWindow,
HWND /* parent */,
@@ -86,6 +82,12 @@ IPC_BEGIN_MESSAGES(PluginProcessHost)
IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_DestroyWindow,
HWND /* window */)
+ IPC_MESSAGE_ROUTED3(PluginProcessHostMsg_DownloadUrl,
+ std::string /* URL */,
+ int /* process id */,
+ HWND /* caller window */)
+#endif
+
IPC_END_MESSAGES(PluginProcessHost)
@@ -122,12 +124,13 @@ IPC_BEGIN_MESSAGES(Plugin)
// plugin knows it can send more invalidates.
IPC_MESSAGE_ROUTED0(PluginMsg_DidPaint)
- IPC_SYNC_MESSAGE_ROUTED0_1(PluginMsg_Print,
- PluginMsg_PrintResponse_Params /* params */)
+ IPC_SYNC_MESSAGE_ROUTED0_2(PluginMsg_Print,
+ base::SharedMemoryHandle /* shared_memory*/,
+ size_t /* size */)
IPC_SYNC_MESSAGE_ROUTED0_2(PluginMsg_GetPluginScriptableObject,
int /* route_id */,
- void* /* npobject_ptr */)
+ intptr_t /* npobject_ptr */)
IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_DidFinishLoadWithReason,
int /* reason */)
@@ -173,7 +176,7 @@ IPC_BEGIN_MESSAGES(Plugin)
std::wstring /* result */,
bool /* success */,
bool /* notify required */,
- int /* notify data */)
+ intptr_t /* notify data */)
IPC_MESSAGE_ROUTED2(PluginMsg_DidReceiveManualResponse,
std::string /* url */,
@@ -194,7 +197,7 @@ IPC_BEGIN_MESSAGES(Plugin)
IPC_SYNC_MESSAGE_ROUTED3_0(PluginMsg_URLRequestRouted,
std::string /* url */,
bool /* notify_needed */,
- HANDLE /* notify data */)
+ intptr_t /* notify data */)
IPC_END_MESSAGES(Plugin)
@@ -206,13 +209,17 @@ IPC_BEGIN_MESSAGES(PluginHost)
// Sends the plugin window information to the renderer.
// The window parameter is a handle to the window if the plugin is a windowed
// plugin. It is NULL for windowless plugins.
+ IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindow,
+ gfx::NativeViewId /* window */)
+
+#if defined(OS_WIN)
// The modal_loop_pump_messages_event parameter is an event handle which is
// passed in for windowless plugins and is used to indicate if messages
// are to be pumped in sync calls to the plugin process. Currently used
// in HandleEvent calls.
- IPC_SYNC_MESSAGE_ROUTED2_0(PluginHostMsg_SetWindow,
- HWND /* window */,
+ IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindowlessPumpEvent,
HANDLE /* modal_loop_pump_messages_event */)
+#endif
IPC_MESSAGE_ROUTED1(PluginHostMsg_URLRequest,
PluginHostMsg_URLRequest_Params)
@@ -226,12 +233,12 @@ IPC_BEGIN_MESSAGES(PluginHost)
IPC_SYNC_MESSAGE_ROUTED1_2(PluginHostMsg_GetWindowScriptNPObject,
int /* route id */,
bool /* success */,
- void* /* npobject_ptr */)
+ intptr_t /* npobject_ptr */)
IPC_SYNC_MESSAGE_ROUTED1_2(PluginHostMsg_GetPluginElement,
int /* route id */,
bool /* success */,
- void* /* npobject_ptr */)
+ intptr_t /* npobject_ptr */)
IPC_MESSAGE_ROUTED3(PluginHostMsg_SetCookie,
GURL /* url */,
@@ -264,9 +271,9 @@ IPC_BEGIN_MESSAGES(PluginHost)
IPC_MESSAGE_ROUTED5(PluginHostMsg_InitiateHTTPRangeRequest,
std::string /* url */,
std::string /* range_info */,
- HANDLE /* existing_stream */,
+ intptr_t /* existing_stream */,
bool /* notify_needed */,
- HANDLE /* notify_data */)
+ intptr_t /* notify_data */)
IPC_END_MESSAGES(PluginHost)