| Index: webkit/tools/test_shell/webwidget_host.h
|
| ===================================================================
|
| --- webkit/tools/test_shell/webwidget_host.h (revision 1852)
|
| +++ webkit/tools/test_shell/webwidget_host.h (working copy)
|
| @@ -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__
|
| +#ifndef WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_
|
| +#define WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_
|
|
|
| -#include <windows.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 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 @@
|
| 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 @@
|
| 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 @@
|
| #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 @@
|
| #endif
|
| };
|
|
|
| -#endif // WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H__
|
| -
|
| +#endif // WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_
|
|
|