summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-27 21:39:15 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-27 21:39:15 +0000
commit18bcc3c1e8ac29683e6d09a9c2d8b3037b0fb360 (patch)
treec1941e26ff0fa733258e7c91d2f84ad436df6963 /webkit/glue
parentab58e6cec813b33eefb397be3cebc11fcc280bdf (diff)
downloadchromium_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 'webkit/glue')
-rw-r--r--webkit/glue/chromium_bridge_impl.cc18
-rw-r--r--webkit/glue/webkit_glue.h2
-rw-r--r--webkit/glue/webplugin.h9
-rw-r--r--webkit/glue/webplugin_impl.cc3
-rw-r--r--webkit/glue/webplugin_impl.h5
-rw-r--r--webkit/glue/webwidget_delegate.h2
6 files changed, 19 insertions, 20 deletions
diff --git a/webkit/glue/chromium_bridge_impl.cc b/webkit/glue/chromium_bridge_impl.cc
index 680ae9e..4780fa6 100644
--- a/webkit/glue/chromium_bridge_impl.cc
+++ b/webkit/glue/chromium_bridge_impl.cc
@@ -62,14 +62,10 @@
namespace {
-gfx::NativeView ToPlatform(WebCore::Widget* widget) {
+gfx::NativeViewId ToNativeId(WebCore::Widget* widget) {
if (!widget)
return 0;
- PlatformWidget widget_id = widget->root()->hostWindow()->platformWindow();
- // TODO(eseidel): This cast is a hack. We should replace gfx::NativeView with
- // something more abstract like PlatformWidget since webkit/glue should not
- // know about actual native widgets.
- return static_cast<gfx::NativeView>(widget_id);
+ return widget->root()->hostWindow()->platformWindow();
}
#if PLATFORM(WIN_OS)
@@ -433,25 +429,25 @@ PassRefPtr<Image> ChromiumBridge::loadPlatformImageResource(const char* name) {
// Screen ---------------------------------------------------------------------
int ChromiumBridge::screenDepth(Widget* widget) {
- return webkit_glue::GetScreenInfo(ToPlatform(widget)).depth;
+ return webkit_glue::GetScreenInfo(ToNativeId(widget)).depth;
}
int ChromiumBridge::screenDepthPerComponent(Widget* widget) {
- return webkit_glue::GetScreenInfo(ToPlatform(widget)).depth_per_component;
+ return webkit_glue::GetScreenInfo(ToNativeId(widget)).depth_per_component;
}
bool ChromiumBridge::screenIsMonochrome(Widget* widget) {
- return webkit_glue::GetScreenInfo(ToPlatform(widget)).is_monochrome;
+ return webkit_glue::GetScreenInfo(ToNativeId(widget)).is_monochrome;
}
IntRect ChromiumBridge::screenRect(Widget* widget) {
return webkit_glue::ToIntRect(
- webkit_glue::GetScreenInfo(ToPlatform(widget)).rect);
+ webkit_glue::GetScreenInfo(ToNativeId(widget)).rect);
}
IntRect ChromiumBridge::screenAvailableRect(Widget* widget) {
return webkit_glue::ToIntRect(
- webkit_glue::GetScreenInfo(ToPlatform(widget)).available_rect);
+ webkit_glue::GetScreenInfo(ToNativeId(widget)).available_rect);
}
// SharedTimers ----------------------------------------------------------------
diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h
index f3335b5..50cd2c4 100644
--- a/webkit/glue/webkit_glue.h
+++ b/webkit/glue/webkit_glue.h
@@ -241,7 +241,7 @@ bool EnsureFontLoaded(HFONT font);
#endif
// Returns screen information corresponding to the given window.
-ScreenInfo GetScreenInfo(gfx::NativeView window);
+ScreenInfo GetScreenInfo(gfx::NativeViewId window);
// Functions implemented by webkit_glue for WebKit ----------------------------
diff --git a/webkit/glue/webplugin.h b/webkit/glue/webplugin.h
index 7350df4..773752f 100644
--- a/webkit/glue/webplugin.h
+++ b/webkit/glue/webplugin.h
@@ -11,11 +11,11 @@
#include "base/basictypes.h"
#include "base/file_path.h"
#include "base/gfx/rect.h"
+#include "base/gfx/native_widget_types.h"
-// TODO(port): type typedefs are obviously incorrect on non-Windows
+// TODO(port): this typedef is obviously incorrect on non-Windows
// platforms, but now a lot of code now accidentally depends on them
// existing. #ifdef out these declarations and fix all the users.
-typedef struct HWND__* HWND;
typedef void* HANDLE;
class GURL;
@@ -58,7 +58,7 @@ struct WebPluginInfo {
// Describes the new location for a plugin window.
struct WebPluginGeometry {
- HWND window;
+ gfx::NativeView window;
gfx::Rect window_rect;
// Clip rect (include) and cutouts (excludes), relative to
// window_rect origin.
@@ -89,7 +89,8 @@ class WebPlugin {
// The pump_messages_event is a event handle which is valid only for
// windowless plugins and is used in NPP_HandleEvent calls to pump messages
// if the plugin enters a modal loop.
- virtual void SetWindow(HWND window, HANDLE pump_messages_event) = 0;
+ virtual void SetWindow(gfx::NativeView window,
+ HANDLE pump_messages_event) = 0;
// Cancels a pending request.
virtual void CancelResource(int id) = 0;
virtual void Invalidate() = 0;
diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc
index d7d32a4..5bf2f72 100644
--- a/webkit/glue/webplugin_impl.cc
+++ b/webkit/glue/webplugin_impl.cc
@@ -328,7 +328,8 @@ WebPluginImpl::WebPluginImpl(WebCore::Element* element,
WebPluginImpl::~WebPluginImpl() {
}
-void WebPluginImpl::SetWindow(HWND window, HANDLE pump_messages_event) {
+void WebPluginImpl::SetWindow(gfx::NativeView window,
+ HANDLE pump_messages_event) {
if (window) {
DCHECK(!windowless_); // Make sure not called twice.
window_ = window;
diff --git a/webkit/glue/webplugin_impl.h b/webkit/glue/webplugin_impl.h
index b99b784..58c633e 100644
--- a/webkit/glue/webplugin_impl.h
+++ b/webkit/glue/webplugin_impl.h
@@ -11,6 +11,7 @@
#include "config.h"
#include "base/compiler_specific.h"
+#include "base/gfx/native_widget_types.h"
MSVC_PUSH_WARNING_LEVEL(0);
#include "ResourceHandle.h"
@@ -146,7 +147,7 @@ class WebPluginImpl : public WebPlugin,
int arg_count, char** arg_names, char** arg_values);
// WebPlugin implementation:
- void SetWindow(HWND window, HANDLE pump_messages_event);
+ void SetWindow(gfx::NativeView window, HANDLE pump_messages_event);
// Given a (maybe partial) url, completes using the base url.
bool CompleteURL(const std::string& url_in, std::string* url_out);
@@ -323,7 +324,7 @@ class WebPluginImpl : public WebPlugin,
std::vector<ClientInfo> clients_;
bool windowless_;
- HWND window_;
+ gfx::NativeView window_;
WebCore::Element* element_;
WebFrameImpl* webframe_;
diff --git a/webkit/glue/webwidget_delegate.h b/webkit/glue/webwidget_delegate.h
index cd84041..81caeb31 100644
--- a/webkit/glue/webwidget_delegate.h
+++ b/webkit/glue/webwidget_delegate.h
@@ -20,7 +20,7 @@ struct WebPluginGeometry;
class WebWidgetDelegate {
public:
// Returns the view in which the WebWidget is embedded.
- virtual gfx::NativeView GetContainingView(WebWidget* webwidget) = 0;
+ virtual gfx::NativeViewId GetContainingView(WebWidget* webwidget) = 0;
// Called when a region of the WebWidget needs to be re-painted.
virtual void DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& rect) = 0;