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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_
14 #include "base/compiler_specific.h"
15 #include "base/gtest_prod_util.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/scoped_vector.h"
18 #include "base/memory/weak_ptr.h"
19 #include "base/time/time.h"
20 #include "base/win/scoped_comptr.h"
21 #include "content/browser/accessibility/browser_accessibility_manager.h"
22 #include "content/browser/renderer_host/render_widget_host_view_base.h"
23 #include "content/common/content_export.h"
24 #include "content/public/browser/notification_observer.h"
25 #include "content/public/browser/notification_registrar.h"
26 #include "ui/base/ime/text_input_client.h"
27 #include "ui/base/ime/win/tsf_bridge.h"
28 #include "ui/events/gestures/gesture_recognizer.h"
29 #include "ui/events/gestures/gesture_types.h"
30 #include "ui/gfx/native_widget_types.h"
31 #include "ui/gfx/point.h"
32 #include "ui/surface/accelerated_surface_win.h"
33 #include "webkit/common/cursors/webcursor.h"
57 class RenderWidgetHost
;
60 typedef CWinTraits
<WS_CHILD
| WS_CLIPCHILDREN
| WS_CLIPSIBLINGS
, 0>
61 RenderWidgetHostHWNDTraits
;
63 CONTENT_EXPORT
extern const wchar_t kRenderWidgetHostHWNDClass
[];
65 ///////////////////////////////////////////////////////////////////////////////
66 // RenderWidgetHostViewWin
68 // An object representing the "View" of a rendered web page. This object is
69 // responsible for displaying the content of the web page, receiving windows
70 // messages, and containing plugins HWNDs. It is the implementation of the
71 // RenderWidgetHostView that the cross-platform RenderWidgetHost object uses
72 // to display the data.
74 // Comment excerpted from render_widget_host.h:
76 // "The lifetime of the RenderWidgetHostHWND is tied to the render process.
77 // If the render process dies, the RenderWidgetHostHWND goes away and all
78 // references to it must become NULL."
80 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
81 class RenderWidgetHostViewWin
82 : public CWindowImpl
<RenderWidgetHostViewWin
,
84 RenderWidgetHostHWNDTraits
>,
85 public RenderWidgetHostViewBase
,
86 public NotificationObserver
,
87 public BrowserAccessibilityDelegate
,
88 public ui::GestureConsumer
,
89 public ui::GestureEventHelper
,
90 public ui::TextInputClient
{ // for Win8/metro TSF support.
92 virtual ~RenderWidgetHostViewWin();
94 CONTENT_EXPORT
void CreateWnd(HWND parent
);
96 void AcceleratedPaint(HDC dc
);
98 DECLARE_WND_CLASS_EX(kRenderWidgetHostHWNDClass
, CS_DBLCLKS
, 0);
100 BEGIN_MSG_MAP(RenderWidgetHostHWND
)
101 MSG_WM_CREATE(OnCreate
)
102 MSG_WM_ACTIVATE(OnActivate
)
103 MSG_WM_DESTROY(OnDestroy
)
104 MSG_WM_PAINT(OnPaint
)
105 MSG_WM_NCPAINT(OnNCPaint
)
106 MSG_WM_NCHITTEST(OnNCHitTest
)
107 MSG_WM_ERASEBKGND(OnEraseBkgnd
)
108 MSG_WM_SETCURSOR(OnSetCursor
)
109 MSG_WM_SETFOCUS(OnSetFocus
)
110 MSG_WM_KILLFOCUS(OnKillFocus
)
111 MSG_WM_CAPTURECHANGED(OnCaptureChanged
)
112 MSG_WM_CANCELMODE(OnCancelMode
)
113 MSG_WM_INPUTLANGCHANGE(OnInputLangChange
)
114 MSG_WM_THEMECHANGED(OnThemeChanged
)
115 MSG_WM_NOTIFY(OnNotify
)
116 MESSAGE_HANDLER(WM_IME_SETCONTEXT
, OnImeSetContext
)
117 MESSAGE_HANDLER(WM_IME_STARTCOMPOSITION
, OnImeStartComposition
)
118 MESSAGE_HANDLER(WM_IME_COMPOSITION
, OnImeComposition
)
119 MESSAGE_HANDLER(WM_IME_ENDCOMPOSITION
, OnImeEndComposition
)
120 MESSAGE_HANDLER(WM_IME_REQUEST
, OnImeRequest
)
121 MESSAGE_HANDLER(WM_MOUSEMOVE
, OnMouseEvent
)
122 MESSAGE_HANDLER(WM_MOUSELEAVE
, OnMouseEvent
)
123 MESSAGE_HANDLER(WM_LBUTTONDOWN
, OnMouseEvent
)
124 MESSAGE_HANDLER(WM_MBUTTONDOWN
, OnMouseEvent
)
125 MESSAGE_HANDLER(WM_RBUTTONDOWN
, OnMouseEvent
)
126 MESSAGE_HANDLER(WM_LBUTTONUP
, OnMouseEvent
)
127 MESSAGE_HANDLER(WM_MBUTTONUP
, OnMouseEvent
)
128 MESSAGE_HANDLER(WM_RBUTTONUP
, OnMouseEvent
)
129 MESSAGE_HANDLER(WM_LBUTTONDBLCLK
, OnMouseEvent
)
130 MESSAGE_HANDLER(WM_MBUTTONDBLCLK
, OnMouseEvent
)
131 MESSAGE_HANDLER(WM_RBUTTONDBLCLK
, OnMouseEvent
)
132 MESSAGE_HANDLER(WM_SYSKEYDOWN
, OnKeyEvent
)
133 MESSAGE_HANDLER(WM_SYSKEYUP
, OnKeyEvent
)
134 MESSAGE_HANDLER(WM_KEYDOWN
, OnKeyEvent
)
135 MESSAGE_HANDLER(WM_KEYUP
, OnKeyEvent
)
136 MESSAGE_HANDLER(WM_MOUSEWHEEL
, OnWheelEvent
)
137 MESSAGE_HANDLER(WM_MOUSEHWHEEL
, OnWheelEvent
)
138 MESSAGE_HANDLER(WM_HSCROLL
, OnWheelEvent
)
139 MESSAGE_HANDLER(WM_VSCROLL
, OnWheelEvent
)
140 MESSAGE_HANDLER(WM_CHAR
, OnKeyEvent
)
141 MESSAGE_HANDLER(WM_SYSCHAR
, OnKeyEvent
)
142 MESSAGE_HANDLER(WM_TOUCH
, OnTouchEvent
)
143 MESSAGE_HANDLER(WM_IME_CHAR
, OnKeyEvent
)
144 MESSAGE_HANDLER(WM_MOUSEACTIVATE
, OnMouseActivate
)
145 MESSAGE_HANDLER(WM_GETOBJECT
, OnGetObject
)
146 MESSAGE_HANDLER(WM_PARENTNOTIFY
, OnParentNotify
)
147 MESSAGE_HANDLER(WM_GESTURE
, OnGestureEvent
)
148 MESSAGE_HANDLER(WM_MOVE
, OnMoveOrSize
)
149 MESSAGE_HANDLER(WM_SIZE
, OnMoveOrSize
)
150 MESSAGE_HANDLER(WM_WTSSESSION_CHANGE
, OnSessionChange
)
153 // RenderWidgetHostView implementation.
154 virtual void InitAsChild(gfx::NativeView parent_view
) OVERRIDE
;
155 virtual RenderWidgetHost
* GetRenderWidgetHost() const OVERRIDE
;
156 virtual void SetSize(const gfx::Size
& size
) OVERRIDE
;
157 virtual void SetBounds(const gfx::Rect
& rect
) OVERRIDE
;
158 virtual gfx::NativeView
GetNativeView() const OVERRIDE
;
159 virtual gfx::NativeViewId
GetNativeViewId() const OVERRIDE
;
160 virtual gfx::NativeViewAccessible
GetNativeViewAccessible() OVERRIDE
;
161 virtual bool HasFocus() const OVERRIDE
;
162 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE
;
163 virtual void Show() OVERRIDE
;
164 virtual void Hide() OVERRIDE
;
165 virtual bool IsShowing() OVERRIDE
;
166 virtual gfx::Rect
GetViewBounds() const OVERRIDE
;
167 virtual void SetBackground(const SkBitmap
& background
) OVERRIDE
;
169 // Implementation of RenderWidgetHostViewPort.
170 virtual void InitAsPopup(RenderWidgetHostView
* parent_host_view
,
171 const gfx::Rect
& pos
) OVERRIDE
;
172 virtual void InitAsFullscreen(
173 RenderWidgetHostView
* reference_host_view
) OVERRIDE
;
174 virtual void WasShown() OVERRIDE
;
175 virtual void WasHidden() OVERRIDE
;
176 virtual void MovePluginWindows(
177 const gfx::Vector2d
& scroll_offset
,
178 const std::vector
<WebPluginGeometry
>& moves
) OVERRIDE
;
179 virtual void Focus() OVERRIDE
;
180 virtual void Blur() OVERRIDE
;
181 virtual void UpdateCursor(const WebCursor
& cursor
) OVERRIDE
;
182 virtual void SetIsLoading(bool is_loading
) OVERRIDE
;
183 virtual void TextInputTypeChanged(ui::TextInputType type
,
184 ui::TextInputMode input_mode
,
185 bool can_compose_inline
) OVERRIDE
;
186 virtual void SelectionBoundsChanged(
187 const ViewHostMsg_SelectionBounds_Params
& params
) OVERRIDE
;
188 virtual void ScrollOffsetChanged() OVERRIDE
;
189 virtual void ImeCancelComposition() OVERRIDE
;
190 virtual void ImeCompositionRangeChanged(
191 const gfx::Range
& range
,
192 const std::vector
<gfx::Rect
>& character_bounds
) OVERRIDE
;
193 virtual void DidUpdateBackingStore(
194 const gfx::Rect
& scroll_rect
,
195 const gfx::Vector2d
& scroll_delta
,
196 const std::vector
<gfx::Rect
>& copy_rects
,
197 const ui::LatencyInfo
& latency_info
) OVERRIDE
;
198 virtual void RenderProcessGone(base::TerminationStatus status
,
199 int error_code
) OVERRIDE
;
200 virtual bool CanSubscribeFrame() const OVERRIDE
;
202 // called by WebContentsImpl before DestroyWindow
203 virtual void WillWmDestroy() OVERRIDE
;
204 virtual void Destroy() OVERRIDE
;
205 virtual void SetTooltipText(const base::string16
& tooltip_text
) OVERRIDE
;
206 virtual BackingStore
* AllocBackingStore(const gfx::Size
& size
) OVERRIDE
;
207 virtual void CopyFromCompositingSurface(
208 const gfx::Rect
& src_subrect
,
209 const gfx::Size
& dst_size
,
210 const base::Callback
<void(bool, const SkBitmap
&)>& callback
) OVERRIDE
;
211 virtual void CopyFromCompositingSurfaceToVideoFrame(
212 const gfx::Rect
& src_subrect
,
213 const scoped_refptr
<media::VideoFrame
>& target
,
214 const base::Callback
<void(bool)>& callback
) OVERRIDE
;
215 virtual bool CanCopyToVideoFrame() const OVERRIDE
;
216 virtual void OnAcceleratedCompositingStateChange() OVERRIDE
;
217 virtual void AcceleratedSurfaceInitialized(int host_id
,
218 int route_id
) OVERRIDE
;
219 virtual void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo
& touch
,
220 InputEventAckState ack_result
) OVERRIDE
;
221 virtual void SetHasHorizontalScrollbar(
222 bool has_horizontal_scrollbar
) OVERRIDE
;
223 virtual void SetScrollOffsetPinning(
224 bool is_pinned_to_left
, bool is_pinned_to_right
) OVERRIDE
;
225 virtual void GetScreenInfo(blink::WebScreenInfo
* results
) OVERRIDE
;
226 virtual gfx::Rect
GetBoundsInRootWindow() OVERRIDE
;
227 virtual gfx::GLSurfaceHandle
GetCompositingSurface() OVERRIDE
;
228 virtual void ResizeCompositingSurface(const gfx::Size
&) OVERRIDE
;
229 virtual void AcceleratedSurfaceBuffersSwapped(
230 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params
& params
,
231 int gpu_host_id
) OVERRIDE
;
232 virtual void AcceleratedSurfacePostSubBuffer(
233 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params
& params
,
234 int gpu_host_id
) OVERRIDE
;
235 virtual void AcceleratedSurfaceSuspend() OVERRIDE
;
236 virtual void AcceleratedSurfaceRelease() OVERRIDE
;
237 virtual bool HasAcceleratedSurface(const gfx::Size
& desired_size
) OVERRIDE
;
238 virtual void OnAccessibilityEvents(
239 const std::vector
<AccessibilityHostMsg_EventParams
>& params
241 virtual bool LockMouse() OVERRIDE
;
242 virtual void UnlockMouse() OVERRIDE
;
243 virtual void SetClickthroughRegion(SkRegion
* region
) OVERRIDE
;
245 // Implementation of NotificationObserver:
246 virtual void Observe(int type
,
247 const NotificationSource
& source
,
248 const NotificationDetails
& details
) OVERRIDE
;
250 // Implementation of BrowserAccessibilityDelegate:
251 virtual void SetAccessibilityFocus(int acc_obj_id
) OVERRIDE
;
252 virtual void AccessibilityDoDefaultAction(int acc_obj_id
) OVERRIDE
;
253 virtual void AccessibilityScrollToMakeVisible(
254 int acc_obj_id
, gfx::Rect subfocus
) OVERRIDE
;
255 virtual void AccessibilityScrollToPoint(
256 int acc_obj_id
, gfx::Point point
) OVERRIDE
;
257 virtual void AccessibilitySetTextSelection(
258 int acc_obj_id
, int start_offset
, int end_offset
) OVERRIDE
;
259 virtual gfx::Point
GetLastTouchEventLocation() const OVERRIDE
;
260 virtual void FatalAccessibilityTreeError() OVERRIDE
;
262 // Overridden from ui::GestureEventHelper.
263 virtual bool CanDispatchToConsumer(ui::GestureConsumer
* consumer
) OVERRIDE
;
264 virtual void DispatchPostponedGestureEvent(ui::GestureEvent
* event
) OVERRIDE
;
265 virtual void DispatchCancelTouchEvent(ui::TouchEvent
* event
) OVERRIDE
;
267 // Overridden from ui::TextInputClient for Win8/metro TSF support.
268 // Following methods are not used in existing IMM32 related implementation.
269 virtual void SetCompositionText(
270 const ui::CompositionText
& composition
) OVERRIDE
;
271 virtual void ConfirmCompositionText() OVERRIDE
;
272 virtual void ClearCompositionText() OVERRIDE
;
273 virtual void InsertText(const base::string16
& text
) OVERRIDE
;
274 virtual void InsertChar(char16 ch
, int flags
) OVERRIDE
;
275 virtual gfx::NativeWindow
GetAttachedWindow() const OVERRIDE
;
276 virtual ui::TextInputType
GetTextInputType() const OVERRIDE
;
277 virtual ui::TextInputMode
GetTextInputMode() const OVERRIDE
;
278 virtual bool CanComposeInline() const OVERRIDE
;
279 virtual gfx::Rect
GetCaretBounds() const OVERRIDE
;
280 virtual bool GetCompositionCharacterBounds(uint32 index
,
281 gfx::Rect
* rect
) const OVERRIDE
;
282 virtual bool HasCompositionText() const OVERRIDE
;
283 virtual bool GetTextRange(gfx::Range
* range
) const OVERRIDE
;
284 virtual bool GetCompositionTextRange(gfx::Range
* range
) const OVERRIDE
;
285 virtual bool GetSelectionRange(gfx::Range
* range
) const OVERRIDE
;
286 virtual bool SetSelectionRange(const gfx::Range
& range
) OVERRIDE
;
287 virtual bool DeleteRange(const gfx::Range
& range
) OVERRIDE
;
288 virtual bool GetTextFromRange(const gfx::Range
& range
,
289 base::string16
* text
) const OVERRIDE
;
290 virtual void OnInputMethodChanged() OVERRIDE
;
291 virtual bool ChangeTextDirectionAndLayoutAlignment(
292 base::i18n::TextDirection direction
) OVERRIDE
;
293 virtual void ExtendSelectionAndDelete(size_t before
, size_t after
) OVERRIDE
;
294 virtual void EnsureCaretInRect(const gfx::Rect
& rect
) OVERRIDE
;
295 virtual void OnCandidateWindowShown() OVERRIDE
;
296 virtual void OnCandidateWindowUpdated() OVERRIDE
;
297 virtual void OnCandidateWindowHidden() OVERRIDE
;
300 friend class RenderWidgetHostView
;
302 // Should construct only via RenderWidgetHostView::CreateViewForWidget.
304 // The view will associate itself with the given widget.
305 explicit RenderWidgetHostViewWin(RenderWidgetHost
* widget
);
307 // Windows Message Handlers
308 LRESULT
OnCreate(CREATESTRUCT
* create_struct
);
309 void OnActivate(UINT
, BOOL
, HWND
);
311 void OnPaint(HDC unused_dc
);
312 void OnNCPaint(HRGN update_region
);
313 LRESULT
OnNCHitTest(const CPoint
& pt
);
314 LRESULT
OnEraseBkgnd(HDC dc
);
315 LRESULT
OnSetCursor(HWND window
, UINT hittest_code
, UINT mouse_message_id
);
316 void OnSetFocus(HWND window
);
317 void OnKillFocus(HWND window
);
318 void OnCaptureChanged(HWND window
);
320 void OnInputLangChange(DWORD character_set
, HKL input_language_id
);
321 void OnThemeChanged();
322 LRESULT
OnNotify(int w_param
, NMHDR
* header
);
323 LRESULT
OnImeSetContext(
324 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
325 LRESULT
OnImeStartComposition(
326 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
327 LRESULT
OnImeComposition(
328 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
329 LRESULT
OnImeEndComposition(
330 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
331 LRESULT
OnImeRequest(
332 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
333 LRESULT
OnMouseEvent(
334 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
336 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
337 LRESULT
OnWheelEvent(
338 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
339 LRESULT
OnTouchEvent(
340 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
341 LRESULT
OnMouseActivate(UINT message
,
345 // Handle MSAA requests for accessibility information.
346 LRESULT
OnGetObject(UINT message
, WPARAM wparam
, LPARAM lparam
,
348 // Handle vertical scrolling.
349 LRESULT
OnVScroll(int code
, short position
, HWND scrollbar_control
);
350 // Handle horizontal scrolling.
351 LRESULT
OnHScroll(int code
, short position
, HWND scrollbar_control
);
353 LRESULT
OnParentNotify(UINT message
, WPARAM wparam
, LPARAM lparam
,
356 // Handle high-level touch events.
357 LRESULT
OnGestureEvent(UINT message
, WPARAM wparam
, LPARAM lparam
,
359 LRESULT
OnMoveOrSize(UINT message
, WPARAM wparam
, LPARAM lparam
,
362 // Handle transitioning in and out of screensaver mode.
363 LRESULT
OnSessionChange(UINT message
,
368 void OnFinalMessage(HWND window
);
371 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewWinBrowserTest
,
372 TextInputTypeChanged
);
374 // Updates the display cursor to the current cursor if the cursor is over this
376 void UpdateCursorIfOverSelf();
378 // Tells Windows that we want to hear about mouse exit messages.
379 void TrackMouseLeave(bool start_tracking
);
381 // Sends a message to the RenderView in the renderer process.
382 bool Send(IPC::Message
* message
);
384 // Set the tooltip region to the size of the window, creating the tooltip
385 // hwnd if it has not been created yet.
386 void EnsureTooltip();
388 // Tooltips become invalid when the root ancestor changes. When the View
389 // becomes hidden, this method is called to reset the tooltip.
392 // Builds and forwards a WebKitGestureEvent to the renderer.
393 bool ForwardGestureEventToRenderer(
394 ui::GestureEvent
* gesture
);
396 // Process all of the given gestures (passes them on to renderer)
397 void ProcessGestures(ui::GestureRecognizer::Gestures
* gestures
);
399 // Sends the specified mouse event to the renderer.
400 void ForwardMouseEventToRenderer(UINT message
, WPARAM wparam
, LPARAM lparam
);
402 // Synthesize mouse wheel event.
403 LRESULT
SynthesizeMouseWheel(bool is_vertical
, int scroll_code
,
404 short scroll_position
);
406 // Shuts down the render_widget_host_. This is a separate function so we can
407 // invoke it from the message loop.
410 // Redraws the window synchronously, and any child windows (i.e. plugins)
414 // Draw our background over the given HDC in the given |rect|. The background
415 // will be tiled such that it lines up with existing tiles starting from the
417 void DrawBackground(const RECT
& rect
, CPaintDC
* dc
);
419 // Clean up the compositor window, if needed.
420 void CleanupCompositorWindow();
422 // Whether the window should be activated.
423 bool IsActivatable() const;
425 // Do initialization needed by both InitAsPopup() and InitAsFullscreen().
426 void DoPopupOrFullscreenInit(HWND parent_hwnd
,
427 const gfx::Rect
& pos
,
430 CPoint
GetClientCenter() const;
431 // In mouse lock mode, moves the mouse cursor to the center of the view if it
432 // is too close to the border.
433 void MoveCursorToCenterIfNecessary();
435 void HandleLockedMouseEvent(UINT message
, WPARAM wparam
, LPARAM lparam
);
437 LRESULT
OnDocumentFeed(RECONVERTSTRING
* reconv
);
438 LRESULT
OnReconvertString(RECONVERTSTRING
* reconv
);
439 LRESULT
OnQueryCharPosition(IMECHARPOSITION
* position
);
441 // Sets the appropriate mode for raw-touches or gestures. Currently touch mode
442 // will only take effect on Win7+.
443 void UpdateDesiredTouchMode();
445 // Configures the enable/disable state of |ime_input_| to match with the
446 // current |text_input_type_|.
447 void UpdateIMEState();
449 // Returns bounds of the view in pixels.
450 gfx::Rect
GetPixelBounds() const;
452 // Sets the appropriate input scope for given |text_input_type| if TSF-aware
453 // is not required. Does nothing if TSF-aware is required (and TSF text store
454 // is responsible for managing input scope). Currently input scope will only
455 // take effect on Vista+.
456 void UpdateInputScopeIfNecessary(ui::TextInputType text_input_type
);
458 // Create a BrowserAccessibilityManager with an empty document if it
459 // doesn't already exist.
460 void CreateBrowserAccessibilityManagerIfNeeded();
462 // The associated Model. While |this| is being Destroyed,
463 // |render_widget_host_| is NULL and the Windows message loop is run one last
464 // time. Message handlers must check for a NULL |render_widget_host_|.
465 RenderWidgetHostImpl
* render_widget_host_
;
467 // When we are doing accelerated compositing
468 HWND compositor_host_window_
;
470 // Presents a texture received from another process to the compositing
472 scoped_ptr
<AcceleratedSurface
> accelerated_surface_
;
474 // true if the compositor host window must be hidden after the
475 // software renderered view is updated.
476 bool hide_compositor_window_at_next_paint_
;
478 // The cursor for the page. This is passed up from the renderer.
479 WebCursor current_cursor_
;
481 // Indicates if the page is loading.
484 // true if we are currently tracking WM_MOUSEEXIT messages.
485 bool track_mouse_leave_
;
487 // Wrapper class for IMM32 APIs.
488 // (See "ui/base/ime/win/imm32_manager.h" for its details.)
489 scoped_ptr
<ui::IMM32Manager
> imm32_manager_
;
491 // Represents whether or not this browser process is receiving status
492 // messages about the focused edit control from a renderer process.
493 bool ime_notification_
;
495 // true if Enter was hit when render widget host was in focus.
496 bool capture_enter_key_
;
498 // The touch-state. Its touch-points are updated as necessary. A new
499 // touch-point is added from an TOUCHEVENTF_DOWN message, and a touch-point
500 // is removed from the list on an TOUCHEVENTF_UP message.
501 scoped_ptr
<WebTouchState
> touch_state_
;
503 // True if we're in the midst of a paint operation and should respond to
504 // DidPaintRect() notifications by merely invalidating. See comments on
505 // render_widget_host_view.h:DidPaintRect().
506 bool about_to_validate_and_paint_
;
508 // true if the View should be closed when its HWND is deactivated (used to
509 // support SELECT popups which are closed when they are deactivated).
510 bool close_on_deactivate_
;
512 // Whether Destroy() has been called. Used to detect a crasher
513 // (http://crbug.com/24248) where render_view_host_ has been deleted when
514 // OnFinalMessage is called.
515 bool being_destroyed_
;
518 // The text to be shown in the tooltip, supplied by the renderer.
519 base::string16 tooltip_text_
;
520 // The tooltip control hwnd
522 // Whether or not a tooltip is currently visible. We use this to track
523 // whether or not we want to force-close the tooltip when we receive mouse
524 // move notifications from the renderer. See comment in OnMsgSetTooltipText.
525 bool tooltip_showing_
;
527 // Factory used to safely scope delayed calls to ShutdownHost().
528 base::WeakPtrFactory
<RenderWidgetHostViewWin
> weak_factory_
;
530 // The time at which this view started displaying white pixels as a result of
531 // not having anything to paint (empty backing store from renderer). This
532 // value returns true for is_null() if we are not recording whiteout times.
533 base::TimeTicks whiteout_start_time_
;
535 // The time it took after this view was selected for it to be fully painted.
536 base::TimeTicks web_contents_switch_paint_time_
;
538 // Registrar so we can listen to RENDERER_PROCESS_TERMINATED events.
539 NotificationRegistrar registrar_
;
541 // Stores the current text input type received by TextInputStateChanged()
543 ui::TextInputType text_input_type_
;
544 ui::TextInputMode text_input_mode_
;
545 bool can_compose_inline_
;
547 ScopedVector
<ui::ViewProp
> props_
;
549 // Is the widget fullscreen?
552 // Used to record the last position of the mouse.
554 // While the mouse is locked, |unlocked| and |unlocked_global| store the
555 // last known position just as mouse lock was entered.
556 // Relative to the upper-left corner of the view.
558 // Relative to the upper-left corner of the screen.
559 gfx::Point unlocked_global
;
561 // Only valid while the mouse is locked.
562 gfx::Point locked_global
;
563 } last_mouse_position_
;
565 // When the mouse cursor is moved to the center of the view by
566 // MoveCursorToCenterIfNecessary(), we ignore the resulting WM_MOUSEMOVE
570 // Relative to the upper-left corner of the screen.
572 } move_to_center_request_
;
574 // In the case of the mouse being moved away from the view and then moved
575 // back, we regard the mouse movement as (0, 0).
576 bool ignore_mouse_movement_
;
578 gfx::Range composition_range_
;
580 // The current composition character bounds.
581 std::vector
<gfx::Rect
> composition_character_bounds_
;
583 // A cached latest caret rectangle sent from renderer.
584 gfx::Rect caret_rect_
;
586 // TODO(ananta): The pointer and touch related members should be moved to an
587 // independent class to reduce the clutter. This includes members
588 // pointer_down_context_ and last_touch_location_.
590 // Set to true if we are in the context of a pointer down message.
591 bool pointer_down_context_
;
593 // The global x, y coordinates of the last point a touch event was
594 // received, used to determine if it's okay to open the on-screen
595 // keyboard. Reset when the window loses focus.
596 gfx::Point last_touch_location_
;
598 // Region in which the view will be transparent to clicks.
599 scoped_ptr
<SkRegion
> transparent_region_
;
601 // Are touch events currently enabled?
602 bool touch_events_enabled_
;
604 scoped_ptr
<ui::GestureRecognizer
> gesture_recognizer_
;
606 // The OS-provided default IAccessible instance for our hwnd.
607 base::win::ScopedComPtr
<IAccessible
> window_iaccessible_
;
609 ui::LatencyInfo software_latency_info_
;
611 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewWin
);
614 } // namespace content
616 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_