OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <atlbase.h> | 9 #include <atlbase.h> |
10 #include <atlapp.h> | 10 #include <atlapp.h> |
11 #include <atlcrack.h> | 11 #include <atlcrack.h> |
12 #include <atlmisc.h> | 12 #include <atlmisc.h> |
13 #include <peninputpanel.h> | 13 #include <peninputpanel.h> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/memory/scoped_vector.h" | 18 #include "base/memory/scoped_vector.h" |
19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
20 #include "base/time.h" | 20 #include "base/time.h" |
21 #include "base/win/scoped_comptr.h" | 21 #include "base/win/scoped_comptr.h" |
22 #include "content/browser/accessibility/browser_accessibility_manager.h" | 22 #include "content/browser/accessibility/browser_accessibility_manager.h" |
23 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 23 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
24 #include "content/common/content_export.h" | 24 #include "content/common/content_export.h" |
25 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
26 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
27 #include "ui/base/gestures/gesture_types.h" | |
28 #include "ui/base/gestures/gesture_recognizer.h" | |
27 #include "ui/base/win/ime_input.h" | 29 #include "ui/base/win/ime_input.h" |
28 #include "ui/gfx/native_widget_types.h" | 30 #include "ui/gfx/native_widget_types.h" |
29 #include "ui/gfx/point.h" | 31 #include "ui/gfx/point.h" |
30 #include "ui/gfx/surface/accelerated_surface_win.h" | 32 #include "ui/gfx/surface/accelerated_surface_win.h" |
31 #include "ui/gfx/sys_color_change_listener.h" | 33 #include "ui/gfx/sys_color_change_listener.h" |
32 #include "webkit/glue/webcursor.h" | 34 #include "webkit/glue/webcursor.h" |
33 | 35 |
34 class BackingStore; | 36 class BackingStore; |
35 class SkRegion; | 37 class SkRegion; |
36 | 38 |
37 namespace content { | 39 namespace content { |
38 class RenderWidgetHost; | 40 class RenderWidgetHost; |
39 } | 41 } |
40 | 42 |
41 namespace gfx { | 43 namespace gfx { |
42 class Size; | 44 class Size; |
43 class Rect; | 45 class Rect; |
44 } | 46 } |
45 | 47 |
46 namespace IPC { | 48 namespace IPC { |
47 class Message; | 49 class Message; |
48 } | 50 } |
49 | 51 |
50 namespace ui { | 52 namespace ui { |
51 class ViewProp; | 53 class ViewProp; |
52 } | 54 } |
53 | 55 |
56 namespace views{ | |
57 class GestureEvent; | |
58 } | |
59 | |
54 typedef CWinTraits<WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0> | 60 typedef CWinTraits<WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0> |
55 RenderWidgetHostHWNDTraits; | 61 RenderWidgetHostHWNDTraits; |
56 | 62 |
57 CONTENT_EXPORT extern const wchar_t kRenderWidgetHostHWNDClass[]; | 63 CONTENT_EXPORT extern const wchar_t kRenderWidgetHostHWNDClass[]; |
58 | 64 |
59 // TODO(ananta) | 65 // TODO(ananta) |
60 // This should be removed once we have the new windows SDK which defines these | 66 // This should be removed once we have the new windows SDK which defines these |
61 // messages. | 67 // messages. |
62 #if !defined(WM_POINTERUPDATE) | 68 #if !defined(WM_POINTERUPDATE) |
63 #define WM_POINTERUPDATE 0x0245 | 69 #define WM_POINTERUPDATE 0x0245 |
(...skipping 23 matching lines...) Expand all Loading... | |
87 // references to it must become NULL." | 93 // references to it must become NULL." |
88 // | 94 // |
89 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. | 95 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. |
90 class RenderWidgetHostViewWin | 96 class RenderWidgetHostViewWin |
91 : public CWindowImpl<RenderWidgetHostViewWin, | 97 : public CWindowImpl<RenderWidgetHostViewWin, |
92 CWindow, | 98 CWindow, |
93 RenderWidgetHostHWNDTraits>, | 99 RenderWidgetHostHWNDTraits>, |
94 public content::RenderWidgetHostViewBase, | 100 public content::RenderWidgetHostViewBase, |
95 public content::NotificationObserver, | 101 public content::NotificationObserver, |
96 public BrowserAccessibilityDelegate, | 102 public BrowserAccessibilityDelegate, |
97 public gfx::SysColorChangeListener { | 103 public gfx::SysColorChangeListener, |
104 public ui::GestureConsumer, | |
105 public ui::GestureEventHelper { | |
98 public: | 106 public: |
99 virtual ~RenderWidgetHostViewWin(); | 107 virtual ~RenderWidgetHostViewWin(); |
100 | 108 |
101 CONTENT_EXPORT void CreateWnd(HWND parent); | 109 CONTENT_EXPORT void CreateWnd(HWND parent); |
102 | 110 |
103 void ScheduleComposite(); | 111 void ScheduleComposite(); |
104 | 112 |
105 DECLARE_WND_CLASS_EX(kRenderWidgetHostHWNDClass, CS_DBLCLKS, 0); | 113 DECLARE_WND_CLASS_EX(kRenderWidgetHostHWNDClass, CS_DBLCLKS, 0); |
106 | 114 |
107 BEGIN_MSG_MAP(RenderWidgetHostHWND) | 115 BEGIN_MSG_MAP(RenderWidgetHostHWND) |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 virtual void AccessibilityScrollToMakeVisible( | 249 virtual void AccessibilityScrollToMakeVisible( |
242 int acc_obj_id, gfx::Rect subfocus) OVERRIDE; | 250 int acc_obj_id, gfx::Rect subfocus) OVERRIDE; |
243 virtual void AccessibilityScrollToPoint( | 251 virtual void AccessibilityScrollToPoint( |
244 int acc_obj_id, gfx::Point point) OVERRIDE; | 252 int acc_obj_id, gfx::Point point) OVERRIDE; |
245 virtual void AccessibilitySetTextSelection( | 253 virtual void AccessibilitySetTextSelection( |
246 int acc_obj_id, int start_offset, int end_offset) OVERRIDE; | 254 int acc_obj_id, int start_offset, int end_offset) OVERRIDE; |
247 | 255 |
248 // Implementation of SysColorChangeListener: | 256 // Implementation of SysColorChangeListener: |
249 virtual void OnSysColorChange() OVERRIDE; | 257 virtual void OnSysColorChange() OVERRIDE; |
250 | 258 |
259 // Overridden from ui::GestureEventHelper. | |
260 virtual ui::GestureEvent* CreateGestureEvent( | |
261 ui::EventType type, | |
262 const gfx::Point& location, | |
263 int flags, | |
264 const base::Time& time, | |
sky
2012/05/04 16:23:40
Same comment from other review: no refs for times.
| |
265 float param_first, | |
266 float param_second, | |
267 unsigned int touch_id_bitfield) OVERRIDE; | |
268 virtual ui::TouchEvent* CreateTouchEvent( | |
269 ui::EventType type, | |
270 const gfx::Point& location, | |
271 int touch_id, | |
272 const base::TimeDelta& time_stamp) OVERRIDE; | |
273 virtual bool DispatchLongPressGestureEvent(ui::GestureEvent* event) OVERRIDE; | |
274 virtual bool DispatchCancelTouchEvent(ui::TouchEvent* event) OVERRIDE; | |
275 | |
251 protected: | 276 protected: |
252 friend class content::RenderWidgetHostView; | 277 friend class content::RenderWidgetHostView; |
253 | 278 |
254 // Should construct only via RenderWidgetHostView::CreateViewForWidget. | 279 // Should construct only via RenderWidgetHostView::CreateViewForWidget. |
255 // | 280 // |
256 // The view will associate itself with the given widget. | 281 // The view will associate itself with the given widget. |
257 explicit RenderWidgetHostViewWin(content::RenderWidgetHost* widget); | 282 explicit RenderWidgetHostViewWin(content::RenderWidgetHost* widget); |
258 | 283 |
259 // Windows Message Handlers | 284 // Windows Message Handlers |
260 LRESULT OnCreate(CREATESTRUCT* create_struct); | 285 LRESULT OnCreate(CREATESTRUCT* create_struct); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
326 bool Send(IPC::Message* message); | 351 bool Send(IPC::Message* message); |
327 | 352 |
328 // Set the tooltip region to the size of the window, creating the tooltip | 353 // Set the tooltip region to the size of the window, creating the tooltip |
329 // hwnd if it has not been created yet. | 354 // hwnd if it has not been created yet. |
330 void EnsureTooltip(); | 355 void EnsureTooltip(); |
331 | 356 |
332 // Tooltips become invalid when the root ancestor changes. When the View | 357 // Tooltips become invalid when the root ancestor changes. When the View |
333 // becomes hidden, this method is called to reset the tooltip. | 358 // becomes hidden, this method is called to reset the tooltip. |
334 void ResetTooltip(); | 359 void ResetTooltip(); |
335 | 360 |
361 // Builds and forwards a WebKitGestureEvent to the renderer. | |
362 bool ForwardGestureEventToRenderer( | |
363 WebKit::WebInputEvent::Type eventType, | |
sky
2012/05/04 16:23:40
eventType -> event_type
| |
364 const views::GestureEvent* gesture); | |
365 void ProcessGestures( ui::GestureRecognizer::Gestures* gestures); | |
sky
2012/05/04 16:23:40
remove space.
Add newline before methods.
| |
336 // Sends the specified mouse event to the renderer. | 366 // Sends the specified mouse event to the renderer. |
337 void ForwardMouseEventToRenderer(UINT message, WPARAM wparam, LPARAM lparam); | 367 void ForwardMouseEventToRenderer(UINT message, WPARAM wparam, LPARAM lparam); |
338 | 368 |
339 // Synthesize mouse wheel event. | |
340 LRESULT SynthesizeMouseWheel(bool is_vertical, int scroll_code, | |
341 short scroll_position); | |
342 | |
343 // Shuts down the render_widget_host_. This is a separate function so we can | 369 // Shuts down the render_widget_host_. This is a separate function so we can |
344 // invoke it from the message loop. | 370 // invoke it from the message loop. |
345 void ShutdownHost(); | 371 void ShutdownHost(); |
346 | 372 |
347 // Redraws the window synchronously, and any child windows (i.e. plugins) | 373 // Redraws the window synchronously, and any child windows (i.e. plugins) |
348 // asynchronously. | 374 // asynchronously. |
349 void Redraw(); | 375 void Redraw(); |
350 | 376 |
351 // Draw our background over the given HDC in the given |rect|. The background | 377 // Draw our background over the given HDC in the given |rect|. The background |
352 // will be tiled such that it lines up with existing tiles starting from the | 378 // will be tiled such that it lines up with existing tiles starting from the |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
568 | 594 |
569 // Set to true if we received a focus change after a WM_POINTERDOWN message. | 595 // Set to true if we received a focus change after a WM_POINTERDOWN message. |
570 bool received_focus_change_after_pointer_down_; | 596 bool received_focus_change_after_pointer_down_; |
571 | 597 |
572 // Region in which the view will be transparent to clicks. | 598 // Region in which the view will be transparent to clicks. |
573 scoped_ptr<SkRegion> transparent_region_; | 599 scoped_ptr<SkRegion> transparent_region_; |
574 | 600 |
575 // Are touch events currently enabled? | 601 // Are touch events currently enabled? |
576 bool touch_events_enabled_; | 602 bool touch_events_enabled_; |
577 | 603 |
604 scoped_ptr<ui::GestureRecognizer> gesture_recognizer_; | |
605 | |
578 gfx::ScopedSysColorChangeListener sys_color_change_listener_; | 606 gfx::ScopedSysColorChangeListener sys_color_change_listener_; |
579 | 607 |
580 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewWin); | 608 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewWin); |
581 }; | 609 }; |
582 | 610 |
583 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_ | 611 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_ |
OLD | NEW |