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