diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-27 21:39:15 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-27 21:39:15 +0000 |
commit | 18bcc3c1e8ac29683e6d09a9c2d8b3037b0fb360 (patch) | |
tree | c1941e26ff0fa733258e7c91d2f84ad436df6963 /chrome/common | |
parent | ab58e6cec813b33eefb397be3cebc11fcc280bdf (diff) | |
download | chromium_src-18bcc3c1e8ac29683e6d09a9c2d8b3037b0fb360.zip chromium_src-18bcc3c1e8ac29683e6d09a9c2d8b3037b0fb360.tar.gz chromium_src-18bcc3c1e8ac29683e6d09a9c2d8b3037b0fb360.tar.bz2 |
POSIX: gfx::NativeViewId and CrossProcessEvent
Create a couple new typedefs for porting work. Firstly,
gfx::NativeViewId is a handle to a platform specific widget in the
renderer process. For Windows, this is just a HWND as before. However,
in other platforms the ids used in the renderer process will be
something else.
CrossProcessEvent is the type of a HANDLE to a Windows event object
which is used across processes. Since we aren't going to support these
sorts of events on non-Windows platforms, this will have to go away at
some point. For now, however, this lets us build code without too many
ifdefs all over the place.
Review URL: http://codereview.chromium.org/18768
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8756 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/modal_dialog_event.h | 20 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 24 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 50 |
3 files changed, 60 insertions, 34 deletions
diff --git a/chrome/common/modal_dialog_event.h b/chrome/common/modal_dialog_event.h new file mode 100644 index 0000000..2a14c87 --- /dev/null +++ b/chrome/common/modal_dialog_event.h @@ -0,0 +1,20 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_COMMON_MODAL_DIALOG_EVENT_H_ +#define CHROME_COMMON_MODAL_DIALOG_EVENT_H_ + +// This structure is passed around where we need a modal dialog event, which +// is currently not plumbed on Mac & Linux. +// +// TODO(port) Fix this. This structure should probably go away and we should +// do the modal dialog event in some portable way. If you remove this, be +// sure to also remove the ParamTraits for it in resource_messages.h +struct ModalDialogEvent { +#if defined(OS_WIN) + HANDLE event; +#endif +}; + +#endif // CHROME_COMMON_MODAL_DIALOG_EVENT_H_ diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index b0338b7..83dddb1 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -15,6 +15,7 @@ #include "chrome/common/filter_policy.h" #include "chrome/common/ipc_message.h" #include "chrome/common/ipc_message_utils.h" +#include "chrome/common/modal_dialog_event.h" #include "chrome/common/page_transition_types.h" #include "googleurl/src/gurl.h" #include "net/base/upload_data.h" @@ -1723,6 +1724,29 @@ struct ParamTraits<webkit_glue::ScreenInfo> { } }; +template<> +struct ParamTraits<ModalDialogEvent> { + typedef ModalDialogEvent param_type; +#if defined(OS_WIN) + static void Write(Message* m, const param_type& p) { + WriteParam(m, p.event); + } + static bool Read(const Message* m, void** iter, param_type* p) { + return ReadParam(m, iter, &p->event); + } +#else + static void Write(Message* m, const param_type& p) { + } + static bool Read(const Message* m, void** iter, param_type* p) { + return true; + } +#endif + + static void Log(const param_type& p, std::wstring* l) { + l->append(L"<ModalDialogEvent>"); + } +}; + } // namespace IPC #endif // CHROME_COMMON_RENDER_MESSAGES_H_ diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 1081e54..30c6469 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -13,6 +13,7 @@ #include "base/clipboard.h" #include "base/gfx/rect.h" +#include "base/gfx/native_widget_types.h" #include "base/shared_memory.h" #include "chrome/common/ipc_message_macros.h" #include "skia/include/SkBitmap.h" @@ -39,12 +40,14 @@ IPC_BEGIN_MESSAGES(View, 1) IPC_MESSAGE_CONTROL1(ViewMsg_SetNextPageID, int32 /* next_page_id */) -#if defined(OS_WIN) // Tells the renderer to create a new view. // This message is slightly different, the view it takes is the view to // create, the message itself is sent as a non-view control message. - IPC_MESSAGE_CONTROL4(ViewMsg_New, HWND, HANDLE, WebPreferences, int32) -#endif // defined(OS_WIN) + IPC_MESSAGE_CONTROL4(ViewMsg_New, + gfx::NativeViewId, /* parent window */ + ModalDialogEvent, /* model dialog box event */ + WebPreferences, + int32 /* view id */) // Tells the renderer to set its maximum cache size to the supplied value IPC_MESSAGE_CONTROL3(ViewMsg_SetCacheCapacities, @@ -61,13 +64,8 @@ IPC_BEGIN_MESSAGES(View, 1) // Reply in response to ViewHostMsg_ShowView or ViewHostMsg_ShowWidget. // similar to the new command, but used when the renderer created a view // first, and we need to update it -#if defined(OS_WIN) IPC_MESSAGE_ROUTED1(ViewMsg_CreatingNew_ACK, - HWND /* parent_hwnd */) -#else // defined(OS_WIN) - // On POSIX, we don't pass "window handles" between processes. - IPC_MESSAGE_ROUTED0(ViewMsg_CreatingNew_ACK) -#endif + gfx::NativeViewId /* parent_hwnd */) // Tells the render view to close. IPC_MESSAGE_ROUTED0(ViewMsg_Close) @@ -495,7 +493,6 @@ IPC_END_MESSAGES(View) // These are messages sent from the renderer to the browser process. IPC_BEGIN_MESSAGES(ViewHost, 2) -#if defined(OS_WIN) // Sent by the renderer when it is creating a new window. The browser creates // a tab for it and responds with a ViewMsg_CreatingNew_ACK. If route_id is // MSG_ROUTING_NONE, the view couldn't be created. modal_dialog_event is set @@ -504,16 +501,7 @@ IPC_BEGIN_MESSAGES(ViewHost, 2) int /* opener_id */, bool /* user_gesture */, int /* route_id */, - HANDLE /* modal_dialog_event */) -#else // defined(OS_WIN) - // On POSIX, we don't use the cross process events for modal dialogs. At some - // point, we won't use them on any platform, but for now we just define a - // message without the last parameter. - IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_CreateWindow, - int /* opener_id */, - bool /* user_gesture */, - int /* route_id */) -#endif + ModalDialogEvent /* modal_dialog_event */) // Similar to ViewHostMsg_CreateView, except used for sub-widgets, like // <select> dropdowns. This message is sent to the WebContents that @@ -523,13 +511,11 @@ IPC_BEGIN_MESSAGES(ViewHost, 2) bool /* focus on show */, int /* route_id */) -#if defined(OS_WIN) // These two messages are sent as a result of the above two, in the browser // process, from RenderWidgetHelper to RenderViewHost. IPC_MESSAGE_ROUTED2(ViewHostMsg_CreateWindowWithRoute, int /* route_id */, - HANDLE /* modal_dialog_event */) -#endif // defined(OS_WIN) + ModalDialogEvent /* modal_dialog_event */) IPC_MESSAGE_ROUTED2(ViewHostMsg_CreateWidgetWithRoute, int /* route_id */, @@ -643,7 +629,7 @@ IPC_BEGIN_MESSAGES(ViewHost, 2) // generates a ViewMsg_ScrollRect_ACK message. IPC_MESSAGE_ROUTED1(ViewHostMsg_ScrollRect, ViewHostMsg_ScrollRect_Params) -#endif // defined(OS_WIN) +#endif // Acknowledges receipt of a ViewMsg_HandleInputEvent message. // Payload is a WebInputEvent::Type which is the type of the event, followed @@ -654,12 +640,10 @@ IPC_BEGIN_MESSAGES(ViewHost, 2) IPC_MESSAGE_ROUTED0(ViewHostMsg_Focus) IPC_MESSAGE_ROUTED0(ViewHostMsg_Blur) -#if defined(OS_WIN) // Returns the window location of the given window. IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_GetWindowRect, - HWND /* window */, + gfx::NativeViewId /* window */, gfx::Rect /* Out: Window location */) -#endif // defined(OS_WIN) IPC_MESSAGE_ROUTED1(ViewHostMsg_SetCursor, WebCursor) // Result of string search in the page. @@ -850,12 +834,12 @@ IPC_BEGIN_MESSAGES(ViewHost, 2) // Please see ResourceMessageFilter::OnLoadFont for details. IPC_SYNC_MESSAGE_CONTROL1_0(ViewHostMsg_LoadFont, LOGFONT /* font data */) +#endif // defined(OS_WIN) // Returns ScreenInfo corresponding to the given window. IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_GetScreenInfo, - gfx::NativeView /* window */, + gfx::NativeViewId /* window */, webkit_glue::ScreenInfo /* results */) -#endif // defined(OS_WIN) // Send the tooltip text for the current mouse position to the browser. IPC_MESSAGE_ROUTED1(ViewHostMsg_SetTooltipText, @@ -967,7 +951,7 @@ IPC_BEGIN_MESSAGES(ViewHost, 2) // final print settings. The output parameter is the same as // ViewMsg_PrintPages which is executed implicitly. IPC_SYNC_MESSAGE_ROUTED3_1(ViewHostMsg_ScriptedPrint, - HWND /* host_window */, + gfx::NativeViewId /* host_window */, int /* cookie */, int /* expected_pages_count */, ViewMsg_PrintPages_Params /* settings choosen by @@ -1106,18 +1090,16 @@ IPC_BEGIN_MESSAGES(ViewHost, 2) IPC_MESSAGE_ROUTED1(ViewHostMsg_UnloadListenerChanged, bool /* has_listener */) -#if defined(OS_WIN) // Returns the window location of the window this widget is embeded. IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_GetRootWindowRect, - HWND /* window */, + gfx::NativeViewId /* window */, gfx::Rect /* Out: Window location */) // Returns the resizer box location in the window this widget is embeded. // Important for Mac OS X, but not Win or Linux. IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_GetRootWindowResizerRect, - HWND /* window */, + gfx::NativeViewId /* window */, gfx::Rect /* Out: Window location */) -#endif // defined(OS_WIN) // Queries the browser for suggestion for autofill in a form input field. IPC_MESSAGE_ROUTED4(ViewHostMsg_QueryFormFieldAutofill, |