| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_GLUE_WEBWIDGET_IMPL_H__ | |
| 6 #define WEBKIT_GLUE_WEBWIDGET_IMPL_H__ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/ref_counted.h" | |
| 10 #include "webkit/api/public/WebPoint.h" | |
| 11 #include "webkit/api/public/WebSize.h" | |
| 12 #include "webkit/glue/webwidget.h" | |
| 13 | |
| 14 #include "FramelessScrollViewClient.h" | |
| 15 | |
| 16 namespace WebCore { | |
| 17 class Frame; | |
| 18 class FramelessScrollView; | |
| 19 class KeyboardEvent; | |
| 20 class Page; | |
| 21 class PlatformKeyboardEvent; | |
| 22 class Range; | |
| 23 class Widget; | |
| 24 } | |
| 25 | |
| 26 namespace WebKit { | |
| 27 class WebKeyboardEvent; | |
| 28 class WebMouseEvent; | |
| 29 class WebMouseWheelEvent; | |
| 30 struct WebRect; | |
| 31 } | |
| 32 | |
| 33 struct MenuItem; | |
| 34 class WebWidgetDelegate; | |
| 35 | |
| 36 class WebWidgetImpl : public WebWidget, | |
| 37 public WebCore::FramelessScrollViewClient, | |
| 38 public base::RefCounted<WebWidgetImpl> { | |
| 39 public: | |
| 40 // WebWidget | |
| 41 virtual void Close(); | |
| 42 virtual void Resize(const WebKit::WebSize& new_size); | |
| 43 virtual WebKit::WebSize GetSize() { return size(); } | |
| 44 virtual void Layout(); | |
| 45 virtual void Paint(skia::PlatformCanvas* canvas, | |
| 46 const WebKit::WebRect& rect); | |
| 47 virtual bool HandleInputEvent(const WebKit::WebInputEvent* input_event); | |
| 48 virtual void MouseCaptureLost(); | |
| 49 virtual void SetFocus(bool enable); | |
| 50 virtual bool ImeSetComposition(int string_type, | |
| 51 int cursor_position, | |
| 52 int target_start, | |
| 53 int target_end, | |
| 54 const std::wstring& ime_string); | |
| 55 virtual bool ImeUpdateStatus(bool* enable_ime, | |
| 56 WebKit::WebRect* caret_rect); | |
| 57 virtual void SetTextDirection(WebTextDirection direction); | |
| 58 | |
| 59 // WebWidgetImpl | |
| 60 void Init(WebCore::FramelessScrollView* widget, | |
| 61 const WebKit::WebRect& bounds); | |
| 62 | |
| 63 const WebKit::WebSize& size() const { return size_; } | |
| 64 | |
| 65 WebWidgetDelegate* delegate() { | |
| 66 return delegate_; | |
| 67 } | |
| 68 | |
| 69 void MouseMove(const WebKit::WebMouseEvent& mouse_event); | |
| 70 void MouseLeave(const WebKit::WebMouseEvent& mouse_event); | |
| 71 void MouseDown(const WebKit::WebMouseEvent& mouse_event); | |
| 72 void MouseUp(const WebKit::WebMouseEvent& mouse_event); | |
| 73 void MouseDoubleClick(const WebKit::WebMouseEvent& mouse_event); | |
| 74 void MouseWheel(const WebKit::WebMouseWheelEvent& wheel_event); | |
| 75 bool KeyEvent(const WebKit::WebKeyboardEvent& key_event); | |
| 76 | |
| 77 protected: | |
| 78 friend class WebWidget; // So WebWidget::Create can call our constructor | |
| 79 friend class base::RefCounted<WebWidgetImpl>; | |
| 80 | |
| 81 WebWidgetImpl(WebWidgetDelegate* delegate); | |
| 82 ~WebWidgetImpl(); | |
| 83 | |
| 84 // WebCore::HostWindow methods: | |
| 85 virtual void repaint(const WebCore::IntRect&, | |
| 86 bool content_changed, | |
| 87 bool immediate = false, | |
| 88 bool repaint_content_only = false); | |
| 89 virtual void scroll(const WebCore::IntSize& scroll_delta, | |
| 90 const WebCore::IntRect& scroll_rect, | |
| 91 const WebCore::IntRect& clip_rect); | |
| 92 virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const; | |
| 93 virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const; | |
| 94 virtual PlatformWidget platformWindow() const; | |
| 95 virtual void scrollRectIntoView(const WebCore::IntRect&, | |
| 96 const WebCore::ScrollView*) const; | |
| 97 | |
| 98 // WebCore::FramelessScrollViewClient methods: | |
| 99 virtual void popupClosed(WebCore::FramelessScrollView* popup_view); | |
| 100 | |
| 101 WebWidgetDelegate* delegate_; | |
| 102 WebKit::WebSize size_; | |
| 103 | |
| 104 WebKit::WebPoint last_mouse_position_; | |
| 105 | |
| 106 // This is a non-owning ref. The popup will notify us via popupClosed() | |
| 107 // before it is destroyed. | |
| 108 WebCore::FramelessScrollView* widget_; | |
| 109 | |
| 110 private: | |
| 111 DISALLOW_COPY_AND_ASSIGN(WebWidgetImpl); | |
| 112 }; | |
| 113 | |
| 114 #endif // WEBKIT_GLUE_WEBWIDGET_IMPL_H__ | |
| OLD | NEW |