summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell/webwidget_host.h
diff options
context:
space:
mode:
authoravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-09 18:33:11 +0000
committeravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-09 18:33:11 +0000
commite0751dc32e9a2f42267df6583d6feea0815a9a1a (patch)
tree438c39a7f782c729b44b9b9cb538f802e270ce4d /webkit/tools/test_shell/webwidget_host.h
parent27e64ed028a384c7c605dc3a68b1d4b87bf6a9a9 (diff)
downloadchromium_src-e0751dc32e9a2f42267df6583d6feea0815a9a1a.zip
chromium_src-e0751dc32e9a2f42267df6583d6feea0815a9a1a.tar.gz
chromium_src-e0751dc32e9a2f42267df6583d6feea0815a9a1a.tar.bz2
Bulk fixes to get Mac Test Shell more compile-happy.
Review URL: http://codereview.chromium.org/1818 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1909 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/webwidget_host.h')
-rw-r--r--webkit/tools/test_shell/webwidget_host.h51
1 files changed, 34 insertions, 17 deletions
diff --git a/webkit/tools/test_shell/webwidget_host.h b/webkit/tools/test_shell/webwidget_host.h
index b7a5945..c318c18 100644
--- a/webkit/tools/test_shell/webwidget_host.h
+++ b/webkit/tools/test_shell/webwidget_host.h
@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H__
-#define WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H__
-
-#include <windows.h>
+#ifndef WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_
+#define WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_
+#include "base/basictypes.h"
+#include "base/gfx/native_widget_types.h"
+#include "base/gfx/platform_canvas.h"
#include "base/gfx/rect.h"
#include "base/scoped_ptr.h"
@@ -14,26 +15,31 @@ class WebWidget;
class WebWidgetDelegate;
namespace gfx {
-class PlatformCanvasWin;
class Size;
}
-// This class is a simple HWND-based host for a WebWidget
+// This class is a simple ViewHandle-based host for a WebWidget
class WebWidgetHost {
public:
- // The new instance is deleted once the associated HWND is destroyed. The
- // newly created window should be resized after it is created, using the
+ // The new instance is deleted once the associated ViewHandle is destroyed.
+ // The newly created window should be resized after it is created, using the
// MoveWindow (or equivalent) function.
- static WebWidgetHost* Create(HWND parent_window, WebWidgetDelegate* delegate);
+ static WebWidgetHost* Create(gfx::WindowHandle parent_window,
+ WebWidgetDelegate* delegate);
- static WebWidgetHost* FromWindow(HWND hwnd);
+ static WebWidgetHost* FromWindow(gfx::WindowHandle view);
+#if defined(OS_MACOSX)
+ static void HandleEvent(gfx::WindowHandle window, NSEvent *event);
+#endif
- HWND window_handle() const { return hwnd_; }
+ gfx::ViewHandle window_handle() const { return view_; }
WebWidget* webwidget() const { return webwidget_; }
void DidInvalidateRect(const gfx::Rect& rect);
void DidScrollRect(int dx, int dy, const gfx::Rect& clip_rect);
+#if defined(OS_WIN)
void SetCursor(HCURSOR cursor);
+#endif
void DiscardBackingStore();
@@ -41,6 +47,7 @@ class WebWidgetHost {
WebWidgetHost();
~WebWidgetHost();
+#if defined(OS_WIN)
// Per-class wndproc. Returns true if the event should be swallowed.
virtual bool WndProc(UINT message, WPARAM wparam, LPARAM lparam);
@@ -52,6 +59,19 @@ class WebWidgetHost {
void CaptureLostEvent();
void SetFocus(bool enable);
+ static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
+#elif defined(OS_MACOSX)
+ // These need to be called from a non-subclass, so they need to be public.
+ public:
+ void Paint();
+ void Resize(const gfx::Rect& rect);
+ void MouseEvent(NSEvent *);
+ void WheelEvent(NSEvent *);
+ void KeyEvent(NSEvent *);
+ void SetFocus(bool enable);
+ protected:
+#endif
+
void TrackMouseLeave(bool enable);
void ResetScrollRect();
void PaintRect(const gfx::Rect& rect);
@@ -62,11 +82,9 @@ class WebWidgetHost {
#endif
}
- static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
-
- HWND hwnd_;
+ gfx::ViewHandle view_;
WebWidget* webwidget_;
- scoped_ptr<gfx::PlatformCanvasWin> canvas_;
+ scoped_ptr<gfx::PlatformCanvas> canvas_;
// specifies the portion of the webwidget that needs painting
gfx::Rect paint_rect_;
@@ -83,5 +101,4 @@ class WebWidgetHost {
#endif
};
-#endif // WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H__
-
+#endif // WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_