| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_ | 5 #ifndef WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_ |
| 6 #define WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_ | 6 #define WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/gfx/native_widget_types.h" | 9 #include "base/gfx/native_widget_types.h" |
| 10 #include "base/gfx/rect.h" | 10 #include "base/gfx/rect.h" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "skia/ext/platform_canvas.h" | 12 #include "skia/ext/platform_canvas.h" |
| 13 | 13 |
| 14 class WebWidget; | |
| 15 class WebWidgetDelegate; | |
| 16 | |
| 17 namespace gfx { | 14 namespace gfx { |
| 18 class Size; | 15 class Size; |
| 19 } | 16 } |
| 20 | 17 |
| 21 namespace WebKit { | 18 namespace WebKit { |
| 19 class WebWidget; |
| 20 class WebWidgetClient; |
| 22 struct WebScreenInfo; | 21 struct WebScreenInfo; |
| 23 } | 22 } |
| 24 | 23 |
| 25 #if defined(OS_MACOSX) | 24 #if defined(OS_MACOSX) |
| 26 #ifdef __OBJC__ | 25 #ifdef __OBJC__ |
| 27 @class NSEvent; | 26 @class NSEvent; |
| 28 #else | 27 #else |
| 29 class NSEvent; | 28 class NSEvent; |
| 30 #endif | 29 #endif |
| 31 #endif | 30 #endif |
| 32 | 31 |
| 33 // This class is a simple NativeView-based host for a WebWidget | 32 // This class is a simple NativeView-based host for a WebWidget |
| 34 class WebWidgetHost { | 33 class WebWidgetHost { |
| 35 public: | 34 public: |
| 36 // The new instance is deleted once the associated NativeView is destroyed. | 35 // The new instance is deleted once the associated NativeView is destroyed. |
| 37 // The newly created window should be resized after it is created, using the | 36 // The newly created window should be resized after it is created, using the |
| 38 // MoveWindow (or equivalent) function. | 37 // MoveWindow (or equivalent) function. |
| 39 static WebWidgetHost* Create(gfx::NativeView parent_view, | 38 static WebWidgetHost* Create(gfx::NativeView parent_view, |
| 40 WebWidgetDelegate* delegate); | 39 WebKit::WebWidgetClient* client); |
| 41 | 40 |
| 42 #if defined(OS_MACOSX) | 41 #if defined(OS_MACOSX) |
| 43 static void HandleEvent(gfx::NativeView view, NSEvent* event); | 42 static void HandleEvent(gfx::NativeView view, NSEvent* event); |
| 44 #endif | 43 #endif |
| 45 | 44 |
| 46 gfx::NativeView view_handle() const { return view_; } | 45 gfx::NativeView view_handle() const { return view_; } |
| 47 WebWidget* webwidget() const { return webwidget_; } | 46 WebKit::WebWidget* webwidget() const { return webwidget_; } |
| 48 | 47 |
| 49 void DidInvalidateRect(const gfx::Rect& rect); | 48 void DidInvalidateRect(const gfx::Rect& rect); |
| 50 void DidScrollRect(int dx, int dy, const gfx::Rect& clip_rect); | 49 void DidScrollRect(int dx, int dy, const gfx::Rect& clip_rect); |
| 51 #if defined(OS_WIN) | 50 #if defined(OS_WIN) |
| 52 void SetCursor(HCURSOR cursor); | 51 void SetCursor(HCURSOR cursor); |
| 53 #endif | 52 #endif |
| 54 | 53 |
| 55 void DiscardBackingStore(); | 54 void DiscardBackingStore(); |
| 56 // Allow clients to update the paint rect. For example, if we get a gdk | 55 // Allow clients to update the paint rect. For example, if we get a gdk |
| 57 // expose or WM_PAINT event, we need to update the paint rect. | 56 // expose or WM_PAINT event, we need to update the paint rect. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 void ResetScrollRect(); | 107 void ResetScrollRect(); |
| 109 void PaintRect(const gfx::Rect& rect); | 108 void PaintRect(const gfx::Rect& rect); |
| 110 | 109 |
| 111 void set_painting(bool value) { | 110 void set_painting(bool value) { |
| 112 #ifndef NDEBUG | 111 #ifndef NDEBUG |
| 113 painting_ = value; | 112 painting_ = value; |
| 114 #endif | 113 #endif |
| 115 } | 114 } |
| 116 | 115 |
| 117 gfx::NativeView view_; | 116 gfx::NativeView view_; |
| 118 WebWidget* webwidget_; | 117 WebKit::WebWidget* webwidget_; |
| 119 scoped_ptr<skia::PlatformCanvas> canvas_; | 118 scoped_ptr<skia::PlatformCanvas> canvas_; |
| 120 | 119 |
| 121 // specifies the portion of the webwidget that needs painting | 120 // specifies the portion of the webwidget that needs painting |
| 122 gfx::Rect paint_rect_; | 121 gfx::Rect paint_rect_; |
| 123 | 122 |
| 124 // specifies the portion of the webwidget that needs scrolling | 123 // specifies the portion of the webwidget that needs scrolling |
| 125 gfx::Rect scroll_rect_; | 124 gfx::Rect scroll_rect_; |
| 126 int scroll_dx_; | 125 int scroll_dx_; |
| 127 int scroll_dy_; | 126 int scroll_dy_; |
| 128 | 127 |
| 129 bool track_mouse_leave_; | 128 bool track_mouse_leave_; |
| 130 | 129 |
| 131 #ifndef NDEBUG | 130 #ifndef NDEBUG |
| 132 bool painting_; | 131 bool painting_; |
| 133 #endif | 132 #endif |
| 134 }; | 133 }; |
| 135 | 134 |
| 136 #endif // WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_ | 135 #endif // WEBKIT_TOOLS_TEST_SHELL_WEBWIDGET_HOST_H_ |
| OLD | NEW |