| 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 | 7 |
| 8 #include <atlbase.h> | 8 #include <atlbase.h> |
| 9 #include <atlapp.h> | 9 #include <atlapp.h> |
| 10 #include <atlcrack.h> | 10 #include <atlcrack.h> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "content/public/browser/notification_registrar.h" | 25 #include "content/public/browser/notification_registrar.h" |
| 26 #include "ui/base/gestures/gesture_recognizer.h" | 26 #include "ui/base/gestures/gesture_recognizer.h" |
| 27 #include "ui/base/gestures/gesture_types.h" | 27 #include "ui/base/gestures/gesture_types.h" |
| 28 #include "ui/base/win/extra_sdk_defines.h" | 28 #include "ui/base/win/extra_sdk_defines.h" |
| 29 #include "ui/base/win/ime_input.h" | 29 #include "ui/base/win/ime_input.h" |
| 30 #include "ui/gfx/native_widget_types.h" | 30 #include "ui/gfx/native_widget_types.h" |
| 31 #include "ui/gfx/point.h" | 31 #include "ui/gfx/point.h" |
| 32 #include "ui/surface/accelerated_surface_win.h" | 32 #include "ui/surface/accelerated_surface_win.h" |
| 33 #include "webkit/glue/webcursor.h" | 33 #include "webkit/glue/webcursor.h" |
| 34 | 34 |
| 35 class BackingStore; | |
| 36 class SkRegion; | 35 class SkRegion; |
| 37 class WebTouchState; | |
| 38 | |
| 39 namespace content { | |
| 40 class RenderWidgetHost; | |
| 41 } | |
| 42 | 36 |
| 43 namespace gfx { | 37 namespace gfx { |
| 44 class Size; | 38 class Size; |
| 45 class Rect; | 39 class Rect; |
| 46 } | 40 } |
| 47 | 41 |
| 48 namespace IPC { | 42 namespace IPC { |
| 49 class Message; | 43 class Message; |
| 50 } | 44 } |
| 51 | 45 |
| 52 namespace ui { | 46 namespace ui { |
| 53 class ViewProp; | 47 class ViewProp; |
| 54 } | 48 } |
| 55 | 49 |
| 50 namespace content { |
| 51 class BackingStore; |
| 52 class RenderWidgetHost; |
| 53 class WebTouchState; |
| 54 |
| 56 typedef CWinTraits<WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0> | 55 typedef CWinTraits<WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0> |
| 57 RenderWidgetHostHWNDTraits; | 56 RenderWidgetHostHWNDTraits; |
| 58 | 57 |
| 59 CONTENT_EXPORT extern const wchar_t kRenderWidgetHostHWNDClass[]; | 58 CONTENT_EXPORT extern const wchar_t kRenderWidgetHostHWNDClass[]; |
| 60 | 59 |
| 61 /////////////////////////////////////////////////////////////////////////////// | 60 /////////////////////////////////////////////////////////////////////////////// |
| 62 // RenderWidgetHostViewWin | 61 // RenderWidgetHostViewWin |
| 63 // | 62 // |
| 64 // An object representing the "View" of a rendered web page. This object is | 63 // An object representing the "View" of a rendered web page. This object is |
| 65 // responsible for displaying the content of the web page, receiving windows | 64 // responsible for displaying the content of the web page, receiving windows |
| 66 // messages, and containing plugins HWNDs. It is the implementation of the | 65 // messages, and containing plugins HWNDs. It is the implementation of the |
| 67 // RenderWidgetHostView that the cross-platform RenderWidgetHost object uses | 66 // RenderWidgetHostView that the cross-platform RenderWidgetHost object uses |
| 68 // to display the data. | 67 // to display the data. |
| 69 // | 68 // |
| 70 // Comment excerpted from render_widget_host.h: | 69 // Comment excerpted from render_widget_host.h: |
| 71 // | 70 // |
| 72 // "The lifetime of the RenderWidgetHostHWND is tied to the render process. | 71 // "The lifetime of the RenderWidgetHostHWND is tied to the render process. |
| 73 // If the render process dies, the RenderWidgetHostHWND goes away and all | 72 // If the render process dies, the RenderWidgetHostHWND goes away and all |
| 74 // references to it must become NULL." | 73 // references to it must become NULL." |
| 75 // | 74 // |
| 76 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. | 75 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. |
| 77 class RenderWidgetHostViewWin | 76 class RenderWidgetHostViewWin |
| 78 : public CWindowImpl<RenderWidgetHostViewWin, | 77 : public CWindowImpl<RenderWidgetHostViewWin, |
| 79 CWindow, | 78 CWindow, |
| 80 RenderWidgetHostHWNDTraits>, | 79 RenderWidgetHostHWNDTraits>, |
| 81 public content::RenderWidgetHostViewBase, | 80 public RenderWidgetHostViewBase, |
| 82 public content::NotificationObserver, | 81 public NotificationObserver, |
| 83 public BrowserAccessibilityDelegate, | 82 public BrowserAccessibilityDelegate, |
| 84 public ui::GestureConsumer, | 83 public ui::GestureConsumer, |
| 85 public ui::GestureEventHelper { | 84 public ui::GestureEventHelper { |
| 86 public: | 85 public: |
| 87 virtual ~RenderWidgetHostViewWin(); | 86 virtual ~RenderWidgetHostViewWin(); |
| 88 | 87 |
| 89 CONTENT_EXPORT void CreateWnd(HWND parent); | 88 CONTENT_EXPORT void CreateWnd(HWND parent); |
| 90 | 89 |
| 91 void AcceleratedPaint(HDC dc); | 90 void AcceleratedPaint(HDC dc); |
| 92 | 91 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate) | 138 MESSAGE_HANDLER(WM_MOUSEACTIVATE, OnMouseActivate) |
| 140 MESSAGE_HANDLER(WM_GETOBJECT, OnGetObject) | 139 MESSAGE_HANDLER(WM_GETOBJECT, OnGetObject) |
| 141 MESSAGE_HANDLER(WM_PARENTNOTIFY, OnParentNotify) | 140 MESSAGE_HANDLER(WM_PARENTNOTIFY, OnParentNotify) |
| 142 MESSAGE_HANDLER(WM_POINTERDOWN, OnPointerMessage) | 141 MESSAGE_HANDLER(WM_POINTERDOWN, OnPointerMessage) |
| 143 MESSAGE_HANDLER(WM_POINTERUP, OnPointerMessage) | 142 MESSAGE_HANDLER(WM_POINTERUP, OnPointerMessage) |
| 144 MESSAGE_HANDLER(WM_GESTURE, OnGestureEvent) | 143 MESSAGE_HANDLER(WM_GESTURE, OnGestureEvent) |
| 145 END_MSG_MAP() | 144 END_MSG_MAP() |
| 146 | 145 |
| 147 // RenderWidgetHostView implementation. | 146 // RenderWidgetHostView implementation. |
| 148 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; | 147 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; |
| 149 virtual content::RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; | 148 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; |
| 150 virtual void SetSize(const gfx::Size& size) OVERRIDE; | 149 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
| 151 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; | 150 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; |
| 152 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 151 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
| 153 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; | 152 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; |
| 154 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; | 153 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; |
| 155 virtual bool HasFocus() const OVERRIDE; | 154 virtual bool HasFocus() const OVERRIDE; |
| 156 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE; | 155 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE; |
| 157 virtual void Show() OVERRIDE; | 156 virtual void Show() OVERRIDE; |
| 158 virtual void Hide() OVERRIDE; | 157 virtual void Hide() OVERRIDE; |
| 159 virtual bool IsShowing() OVERRIDE; | 158 virtual bool IsShowing() OVERRIDE; |
| 160 virtual gfx::Rect GetViewBounds() const OVERRIDE; | 159 virtual gfx::Rect GetViewBounds() const OVERRIDE; |
| 161 virtual void SetBackground(const SkBitmap& background) OVERRIDE; | 160 virtual void SetBackground(const SkBitmap& background) OVERRIDE; |
| 162 | 161 |
| 163 // Implementation of RenderWidgetHostViewPort. | 162 // Implementation of RenderWidgetHostViewPort. |
| 164 virtual void InitAsPopup(content::RenderWidgetHostView* parent_host_view, | 163 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, |
| 165 const gfx::Rect& pos) OVERRIDE; | 164 const gfx::Rect& pos) OVERRIDE; |
| 166 virtual void InitAsFullscreen( | 165 virtual void InitAsFullscreen( |
| 167 content::RenderWidgetHostView* reference_host_view) OVERRIDE; | 166 RenderWidgetHostView* reference_host_view) OVERRIDE; |
| 168 virtual void WasRestored() OVERRIDE; | 167 virtual void WasRestored() OVERRIDE; |
| 169 virtual void WasHidden() OVERRIDE; | 168 virtual void WasHidden() OVERRIDE; |
| 170 virtual void MovePluginWindows( | 169 virtual void MovePluginWindows( |
| 171 const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE; | 170 const std::vector<webkit::npapi::WebPluginGeometry>& moves) OVERRIDE; |
| 172 virtual void Focus() OVERRIDE; | 171 virtual void Focus() OVERRIDE; |
| 173 virtual void Blur() OVERRIDE; | 172 virtual void Blur() OVERRIDE; |
| 174 virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; | 173 virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; |
| 175 virtual void SetIsLoading(bool is_loading) OVERRIDE; | 174 virtual void SetIsLoading(bool is_loading) OVERRIDE; |
| 176 virtual void TextInputStateChanged(ui::TextInputType type, | 175 virtual void TextInputStateChanged(ui::TextInputType type, |
| 177 bool can_compose_inline) OVERRIDE; | 176 bool can_compose_inline) OVERRIDE; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 int gpu_host_id) OVERRIDE; | 210 int gpu_host_id) OVERRIDE; |
| 212 virtual void AcceleratedSurfaceSuspend() OVERRIDE; | 211 virtual void AcceleratedSurfaceSuspend() OVERRIDE; |
| 213 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE; | 212 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE; |
| 214 virtual void OnAccessibilityNotifications( | 213 virtual void OnAccessibilityNotifications( |
| 215 const std::vector<AccessibilityHostMsg_NotificationParams>& params | 214 const std::vector<AccessibilityHostMsg_NotificationParams>& params |
| 216 ) OVERRIDE; | 215 ) OVERRIDE; |
| 217 virtual bool LockMouse() OVERRIDE; | 216 virtual bool LockMouse() OVERRIDE; |
| 218 virtual void UnlockMouse() OVERRIDE; | 217 virtual void UnlockMouse() OVERRIDE; |
| 219 virtual void SetClickthroughRegion(SkRegion* region) OVERRIDE; | 218 virtual void SetClickthroughRegion(SkRegion* region) OVERRIDE; |
| 220 | 219 |
| 221 // Implementation of content::NotificationObserver: | 220 // Implementation of NotificationObserver: |
| 222 virtual void Observe(int type, | 221 virtual void Observe(int type, |
| 223 const content::NotificationSource& source, | 222 const NotificationSource& source, |
| 224 const content::NotificationDetails& details) OVERRIDE; | 223 const NotificationDetails& details) OVERRIDE; |
| 225 | 224 |
| 226 // Implementation of BrowserAccessibilityDelegate: | 225 // Implementation of BrowserAccessibilityDelegate: |
| 227 virtual void SetAccessibilityFocus(int acc_obj_id) OVERRIDE; | 226 virtual void SetAccessibilityFocus(int acc_obj_id) OVERRIDE; |
| 228 virtual void AccessibilityDoDefaultAction(int acc_obj_id) OVERRIDE; | 227 virtual void AccessibilityDoDefaultAction(int acc_obj_id) OVERRIDE; |
| 229 virtual void AccessibilityScrollToMakeVisible( | 228 virtual void AccessibilityScrollToMakeVisible( |
| 230 int acc_obj_id, gfx::Rect subfocus) OVERRIDE; | 229 int acc_obj_id, gfx::Rect subfocus) OVERRIDE; |
| 231 virtual void AccessibilityScrollToPoint( | 230 virtual void AccessibilityScrollToPoint( |
| 232 int acc_obj_id, gfx::Point point) OVERRIDE; | 231 int acc_obj_id, gfx::Point point) OVERRIDE; |
| 233 virtual void AccessibilitySetTextSelection( | 232 virtual void AccessibilitySetTextSelection( |
| 234 int acc_obj_id, int start_offset, int end_offset) OVERRIDE; | 233 int acc_obj_id, int start_offset, int end_offset) OVERRIDE; |
| 235 | 234 |
| 236 // Overridden from ui::GestureEventHelper. | 235 // Overridden from ui::GestureEventHelper. |
| 237 virtual ui::GestureEvent* CreateGestureEvent( | 236 virtual ui::GestureEvent* CreateGestureEvent( |
| 238 ui::EventType type, | 237 ui::EventType type, |
| 239 const gfx::Point& location, | 238 const gfx::Point& location, |
| 240 int flags, | 239 int flags, |
| 241 base::Time time, | 240 base::Time time, |
| 242 float param_first, | 241 float param_first, |
| 243 float param_second, | 242 float param_second, |
| 244 unsigned int touch_id_bitfield) OVERRIDE; | 243 unsigned int touch_id_bitfield) OVERRIDE; |
| 245 virtual ui::TouchEvent* CreateTouchEvent( | 244 virtual ui::TouchEvent* CreateTouchEvent( |
| 246 ui::EventType type, | 245 ui::EventType type, |
| 247 const gfx::Point& location, | 246 const gfx::Point& location, |
| 248 int touch_id, | 247 int touch_id, |
| 249 base::TimeDelta time_stamp) OVERRIDE; | 248 base::TimeDelta time_stamp) OVERRIDE; |
| 250 virtual bool DispatchLongPressGestureEvent(ui::GestureEvent* event) OVERRIDE; | 249 virtual bool DispatchLongPressGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| 251 virtual bool DispatchCancelTouchEvent(ui::TouchEvent* event) OVERRIDE; | 250 virtual bool DispatchCancelTouchEvent(ui::TouchEvent* event) OVERRIDE; |
| 252 | 251 |
| 253 protected: | 252 protected: |
| 254 friend class content::RenderWidgetHostView; | 253 friend class RenderWidgetHostView; |
| 255 | 254 |
| 256 // Should construct only via RenderWidgetHostView::CreateViewForWidget. | 255 // Should construct only via RenderWidgetHostView::CreateViewForWidget. |
| 257 // | 256 // |
| 258 // The view will associate itself with the given widget. | 257 // The view will associate itself with the given widget. |
| 259 explicit RenderWidgetHostViewWin(content::RenderWidgetHost* widget); | 258 explicit RenderWidgetHostViewWin(RenderWidgetHost* widget); |
| 260 | 259 |
| 261 // Windows Message Handlers | 260 // Windows Message Handlers |
| 262 LRESULT OnCreate(CREATESTRUCT* create_struct); | 261 LRESULT OnCreate(CREATESTRUCT* create_struct); |
| 263 void OnActivate(UINT, BOOL, HWND); | 262 void OnActivate(UINT, BOOL, HWND); |
| 264 void OnDestroy(); | 263 void OnDestroy(); |
| 265 void OnPaint(HDC unused_dc); | 264 void OnPaint(HDC unused_dc); |
| 266 void OnNCPaint(HRGN update_region); | 265 void OnNCPaint(HRGN update_region); |
| 267 LRESULT OnNCHitTest(const CPoint& pt); | 266 LRESULT OnNCHitTest(const CPoint& pt); |
| 268 LRESULT OnEraseBkgnd(HDC dc); | 267 LRESULT OnEraseBkgnd(HDC dc); |
| 269 LRESULT OnSetCursor(HWND window, UINT hittest_code, UINT mouse_message_id); | 268 LRESULT OnSetCursor(HWND window, UINT hittest_code, UINT mouse_message_id); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 399 |
| 401 // Set window to receive gestures. | 400 // Set window to receive gestures. |
| 402 void SetToGestureMode(); | 401 void SetToGestureMode(); |
| 403 | 402 |
| 404 // Set window to raw touch events. Returns whether registering was successful. | 403 // Set window to raw touch events. Returns whether registering was successful. |
| 405 bool SetToTouchMode(); | 404 bool SetToTouchMode(); |
| 406 | 405 |
| 407 // The associated Model. While |this| is being Destroyed, | 406 // The associated Model. While |this| is being Destroyed, |
| 408 // |render_widget_host_| is NULL and the Windows message loop is run one last | 407 // |render_widget_host_| is NULL and the Windows message loop is run one last |
| 409 // time. Message handlers must check for a NULL |render_widget_host_|. | 408 // time. Message handlers must check for a NULL |render_widget_host_|. |
| 410 content::RenderWidgetHostImpl* render_widget_host_; | 409 RenderWidgetHostImpl* render_widget_host_; |
| 411 | 410 |
| 412 // When we are doing accelerated compositing | 411 // When we are doing accelerated compositing |
| 413 HWND compositor_host_window_; | 412 HWND compositor_host_window_; |
| 414 | 413 |
| 415 // Presents a texture received from another process to the compositing | 414 // Presents a texture received from another process to the compositing |
| 416 // window. | 415 // window. |
| 417 scoped_ptr<AcceleratedSurface> accelerated_surface_; | 416 scoped_ptr<AcceleratedSurface> accelerated_surface_; |
| 418 | 417 |
| 419 // true if the compositor host window must be hidden after the | 418 // true if the compositor host window must be hidden after the |
| 420 // software renderered view is updated. | 419 // software renderered view is updated. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 | 477 |
| 479 // The time at which this view started displaying white pixels as a result of | 478 // The time at which this view started displaying white pixels as a result of |
| 480 // not having anything to paint (empty backing store from renderer). This | 479 // not having anything to paint (empty backing store from renderer). This |
| 481 // value returns true for is_null() if we are not recording whiteout times. | 480 // value returns true for is_null() if we are not recording whiteout times. |
| 482 base::TimeTicks whiteout_start_time_; | 481 base::TimeTicks whiteout_start_time_; |
| 483 | 482 |
| 484 // The time it took after this view was selected for it to be fully painted. | 483 // The time it took after this view was selected for it to be fully painted. |
| 485 base::TimeTicks web_contents_switch_paint_time_; | 484 base::TimeTicks web_contents_switch_paint_time_; |
| 486 | 485 |
| 487 // Registrar so we can listen to RENDERER_PROCESS_TERMINATED events. | 486 // Registrar so we can listen to RENDERER_PROCESS_TERMINATED events. |
| 488 content::NotificationRegistrar registrar_; | 487 NotificationRegistrar registrar_; |
| 489 | 488 |
| 490 // Stores the current text input type received by TextInputStateChanged() | 489 // Stores the current text input type received by TextInputStateChanged() |
| 491 // method. | 490 // method. |
| 492 ui::TextInputType text_input_type_; | 491 ui::TextInputType text_input_type_; |
| 493 | 492 |
| 494 ScopedVector<ui::ViewProp> props_; | 493 ScopedVector<ui::ViewProp> props_; |
| 495 | 494 |
| 496 // Is the widget fullscreen? | 495 // Is the widget fullscreen? |
| 497 bool is_fullscreen_; | 496 bool is_fullscreen_; |
| 498 | 497 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 scoped_ptr<SkRegion> transparent_region_; | 549 scoped_ptr<SkRegion> transparent_region_; |
| 551 | 550 |
| 552 // Are touch events currently enabled? | 551 // Are touch events currently enabled? |
| 553 bool touch_events_enabled_; | 552 bool touch_events_enabled_; |
| 554 | 553 |
| 555 scoped_ptr<ui::GestureRecognizer> gesture_recognizer_; | 554 scoped_ptr<ui::GestureRecognizer> gesture_recognizer_; |
| 556 | 555 |
| 557 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewWin); | 556 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewWin); |
| 558 }; | 557 }; |
| 559 | 558 |
| 559 } // namespace content |
| 560 |
| 560 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_ | 561 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_ |
| OLD | NEW |