| 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_WEBWIDGET_IMPL_H__ |
| 6 #define WEBKIT_GLUE_WEBWIDGET_IMPL_H__ | 6 #define WEBKIT_GLUE_WEBWIDGET_IMPL_H__ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
| 11 #include "base/gfx/native_widget_types.h" | 11 #include "base/gfx/native_widget_types.h" |
| 12 #include "base/gfx/point.h" | 12 #include "base/gfx/point.h" |
| 13 #include "base/gfx/size.h" | 13 #include "base/gfx/size.h" |
| 14 #include "webkit/glue/webwidget.h" | 14 #include "webkit/glue/webwidget.h" |
| 15 | 15 |
| 16 #include "FramelessScrollViewClient.h" | 16 #include "FramelessScrollViewClient.h" |
| 17 | 17 |
| 18 namespace WebCore { | 18 namespace WebCore { |
| 19 class Frame; | 19 class Frame; |
| 20 class FramelessScrollView; | 20 class FramelessScrollView; |
| 21 class KeyboardEvent; | 21 class KeyboardEvent; |
| 22 class Page; | 22 class Page; |
| 23 class PlatformKeyboardEvent; | 23 class PlatformKeyboardEvent; |
| 24 class Range; | 24 class Range; |
| 25 class Widget; | 25 class Widget; |
| 26 } | 26 } |
| 27 | 27 |
| 28 struct MenuItem; |
| 28 class WebKeyboardEvent; | 29 class WebKeyboardEvent; |
| 29 class WebMouseEvent; | 30 class WebMouseEvent; |
| 30 class WebMouseWheelEvent; | 31 class WebMouseWheelEvent; |
| 31 class WebWidgetDelegate; | 32 class WebWidgetDelegate; |
| 32 | 33 |
| 33 class WebWidgetImpl : public WebWidget, | 34 class WebWidgetImpl : public WebWidget, |
| 34 public WebCore::FramelessScrollViewClient, | 35 public WebCore::FramelessScrollViewClient, |
| 35 public base::RefCounted<WebWidgetImpl> { | 36 public base::RefCounted<WebWidgetImpl> { |
| 36 public: | 37 public: |
| 37 // WebWidget | 38 // WebWidget |
| 38 virtual void Close(); | 39 virtual void Close(); |
| 39 virtual void Resize(const gfx::Size& new_size); | 40 virtual void Resize(const gfx::Size& new_size); |
| 40 virtual gfx::Size GetSize() { return size(); } | 41 virtual gfx::Size GetSize() { return size(); } |
| 41 virtual void Layout(); | 42 virtual void Layout(); |
| 42 virtual void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect); | 43 virtual void Paint(skia::PlatformCanvas* canvas, const gfx::Rect& rect); |
| 43 virtual bool HandleInputEvent(const WebInputEvent* input_event); | 44 virtual bool HandleInputEvent(const WebInputEvent* input_event); |
| 44 virtual void MouseCaptureLost(); | 45 virtual void MouseCaptureLost(); |
| 45 virtual void SetFocus(bool enable); | 46 virtual void SetFocus(bool enable); |
| 46 virtual bool ImeSetComposition(int string_type, | 47 virtual bool ImeSetComposition(int string_type, |
| 47 int cursor_position, | 48 int cursor_position, |
| 48 int target_start, | 49 int target_start, |
| 49 int target_end, | 50 int target_end, |
| 50 const std::wstring& ime_string); | 51 const std::wstring& ime_string); |
| 51 virtual bool ImeUpdateStatus(bool* enable_ime, | 52 virtual bool ImeUpdateStatus(bool* enable_ime, |
| 52 gfx::Rect* caret_rect); | 53 gfx::Rect* caret_rect); |
| 53 | 54 |
| 54 // WebWidgetImpl | 55 // WebWidgetImpl |
| 55 void Init(WebCore::FramelessScrollView* widget, const gfx::Rect& bounds); | 56 void Init(WebCore::FramelessScrollView* widget, const gfx::Rect& bounds); |
| 57 void InitWithItems(WebCore::FramelessScrollView* widget, |
| 58 const gfx::Rect& bounds, |
| 59 int item_height, |
| 60 int selected_index, |
| 61 const std::vector<MenuItem>& items); |
| 56 | 62 |
| 57 const gfx::Size& size() const { return size_; } | 63 const gfx::Size& size() const { return size_; } |
| 58 | 64 |
| 59 WebWidgetDelegate* delegate() { | 65 WebWidgetDelegate* delegate() { |
| 60 return delegate_; | 66 return delegate_; |
| 61 } | 67 } |
| 62 | 68 |
| 63 void MouseMove(const WebMouseEvent& mouse_event); | 69 void MouseMove(const WebMouseEvent& mouse_event); |
| 64 void MouseLeave(const WebMouseEvent& mouse_event); | 70 void MouseLeave(const WebMouseEvent& mouse_event); |
| 65 void MouseDown(const WebMouseEvent& mouse_event); | 71 void MouseDown(const WebMouseEvent& mouse_event); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 WebWidgetDelegate* delegate_; | 109 WebWidgetDelegate* delegate_; |
| 104 gfx::Size size_; | 110 gfx::Size size_; |
| 105 | 111 |
| 106 gfx::Point last_mouse_position_; | 112 gfx::Point last_mouse_position_; |
| 107 | 113 |
| 108 // This is a non-owning ref. The popup will notify us via popupClosed() | 114 // This is a non-owning ref. The popup will notify us via popupClosed() |
| 109 // before it is destroyed. | 115 // before it is destroyed. |
| 110 WebCore::FramelessScrollView* widget_; | 116 WebCore::FramelessScrollView* widget_; |
| 111 | 117 |
| 112 private: | 118 private: |
| 113 DISALLOW_EVIL_CONSTRUCTORS(WebWidgetImpl); | 119 DISALLOW_COPY_AND_ASSIGN(WebWidgetImpl); |
| 114 }; | 120 }; |
| 115 | 121 |
| 116 #endif // WEBKIT_GLUE_WEBWIDGET_IMPL_H__ | 122 #endif // WEBKIT_GLUE_WEBWIDGET_IMPL_H__ |
| OLD | NEW |