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 std::vector
<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 CreateBrowserAccessibilityManagerIfNeeded() OVERRIDE
;
239 virtual bool LockMouse() OVERRIDE
;
240 virtual void UnlockMouse() OVERRIDE
;
241 virtual void SetClickthroughRegion(SkRegion
* region
) OVERRIDE
;
243 // Implementation of NotificationObserver:
244 virtual void Observe(int type
,
245 const NotificationSource
& source
,
246 const NotificationDetails
& details
) OVERRIDE
;
248 // Implementation of BrowserAccessibilityDelegate:
249 virtual void SetAccessibilityFocus(int acc_obj_id
) OVERRIDE
;
250 virtual void AccessibilityDoDefaultAction(int acc_obj_id
) OVERRIDE
;
251 virtual void AccessibilityScrollToMakeVisible(
252 int acc_obj_id
, gfx::Rect subfocus
) OVERRIDE
;
253 virtual void AccessibilityScrollToPoint(
254 int acc_obj_id
, gfx::Point point
) OVERRIDE
;
255 virtual void AccessibilitySetTextSelection(
256 int acc_obj_id
, int start_offset
, int end_offset
) OVERRIDE
;
257 virtual gfx::Point
GetLastTouchEventLocation() const OVERRIDE
;
258 virtual void FatalAccessibilityTreeError() OVERRIDE
;
260 // Overridden from ui::GestureEventHelper.
261 virtual bool CanDispatchToConsumer(ui::GestureConsumer
* consumer
) OVERRIDE
;
262 virtual void DispatchPostponedGestureEvent(ui::GestureEvent
* event
) OVERRIDE
;
263 virtual void DispatchCancelTouchEvent(ui::TouchEvent
* event
) OVERRIDE
;
265 // Overridden from ui::TextInputClient for Win8/metro TSF support.
266 // Following methods are not used in existing IMM32 related implementation.
267 virtual void SetCompositionText(
268 const ui::CompositionText
& composition
) OVERRIDE
;
269 virtual void ConfirmCompositionText() OVERRIDE
;
270 virtual void ClearCompositionText() OVERRIDE
;
271 virtual void InsertText(const base::string16
& text
) OVERRIDE
;
272 virtual void InsertChar(base::char16 ch
, int flags
) OVERRIDE
;
273 virtual gfx::NativeWindow
GetAttachedWindow() const OVERRIDE
;
274 virtual ui::TextInputType
GetTextInputType() const OVERRIDE
;
275 virtual ui::TextInputMode
GetTextInputMode() const OVERRIDE
;
276 virtual bool CanComposeInline() const OVERRIDE
;
277 virtual gfx::Rect
GetCaretBounds() const OVERRIDE
;
278 virtual bool GetCompositionCharacterBounds(uint32 index
,
279 gfx::Rect
* rect
) const OVERRIDE
;
280 virtual bool HasCompositionText() const OVERRIDE
;
281 virtual bool GetTextRange(gfx::Range
* range
) const OVERRIDE
;
282 virtual bool GetCompositionTextRange(gfx::Range
* range
) const OVERRIDE
;
283 virtual bool GetSelectionRange(gfx::Range
* range
) const OVERRIDE
;
284 virtual bool SetSelectionRange(const gfx::Range
& range
) OVERRIDE
;
285 virtual bool DeleteRange(const gfx::Range
& range
) OVERRIDE
;
286 virtual bool GetTextFromRange(const gfx::Range
& range
,
287 base::string16
* text
) const OVERRIDE
;
288 virtual void OnInputMethodChanged() OVERRIDE
;
289 virtual bool ChangeTextDirectionAndLayoutAlignment(
290 base::i18n::TextDirection direction
) OVERRIDE
;
291 virtual void ExtendSelectionAndDelete(size_t before
, size_t after
) OVERRIDE
;
292 virtual void EnsureCaretInRect(const gfx::Rect
& rect
) OVERRIDE
;
293 virtual void OnCandidateWindowShown() OVERRIDE
;
294 virtual void OnCandidateWindowUpdated() OVERRIDE
;
295 virtual void OnCandidateWindowHidden() OVERRIDE
;
298 friend class RenderWidgetHostView
;
300 // Should construct only via RenderWidgetHostView::CreateViewForWidget.
302 // The view will associate itself with the given widget.
303 explicit RenderWidgetHostViewWin(RenderWidgetHost
* widget
);
305 // Windows Message Handlers
306 LRESULT
OnCreate(CREATESTRUCT
* create_struct
);
307 void OnActivate(UINT
, BOOL
, HWND
);
309 void OnPaint(HDC unused_dc
);
310 void OnNCPaint(HRGN update_region
);
311 LRESULT
OnNCHitTest(const CPoint
& pt
);
312 LRESULT
OnEraseBkgnd(HDC dc
);
313 LRESULT
OnSetCursor(HWND window
, UINT hittest_code
, UINT mouse_message_id
);
314 void OnSetFocus(HWND window
);
315 void OnKillFocus(HWND window
);
316 void OnCaptureChanged(HWND window
);
318 void OnInputLangChange(DWORD character_set
, HKL input_language_id
);
319 void OnThemeChanged();
320 LRESULT
OnNotify(int w_param
, NMHDR
* header
);
321 LRESULT
OnImeSetContext(
322 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
323 LRESULT
OnImeStartComposition(
324 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
325 LRESULT
OnImeComposition(
326 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
327 LRESULT
OnImeEndComposition(
328 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
329 LRESULT
OnImeRequest(
330 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
331 LRESULT
OnMouseEvent(
332 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
334 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
335 LRESULT
OnWheelEvent(
336 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
337 LRESULT
OnTouchEvent(
338 UINT message
, WPARAM wparam
, LPARAM lparam
, BOOL
& handled
);
339 LRESULT
OnMouseActivate(UINT message
,
343 // Handle MSAA requests for accessibility information.
344 LRESULT
OnGetObject(UINT message
, WPARAM wparam
, LPARAM lparam
,
346 // Handle vertical scrolling.
347 LRESULT
OnVScroll(int code
, short position
, HWND scrollbar_control
);
348 // Handle horizontal scrolling.
349 LRESULT
OnHScroll(int code
, short position
, HWND scrollbar_control
);
351 LRESULT
OnParentNotify(UINT message
, WPARAM wparam
, LPARAM lparam
,
354 // Handle high-level touch events.
355 LRESULT
OnGestureEvent(UINT message
, WPARAM wparam
, LPARAM lparam
,
357 LRESULT
OnMoveOrSize(UINT message
, WPARAM wparam
, LPARAM lparam
,
360 // Handle transitioning in and out of screensaver mode.
361 LRESULT
OnSessionChange(UINT message
,
366 void OnFinalMessage(HWND window
);
369 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewWinBrowserTest
,
370 TextInputTypeChanged
);
372 // Updates the display cursor to the current cursor if the cursor is over this
374 void UpdateCursorIfOverSelf();
376 // Tells Windows that we want to hear about mouse exit messages.
377 void TrackMouseLeave(bool start_tracking
);
379 // Sends a message to the RenderView in the renderer process.
380 bool Send(IPC::Message
* message
);
382 // Set the tooltip region to the size of the window, creating the tooltip
383 // hwnd if it has not been created yet.
384 void EnsureTooltip();
386 // Tooltips become invalid when the root ancestor changes. When the View
387 // becomes hidden, this method is called to reset the tooltip.
390 // Builds and forwards a WebKitGestureEvent to the renderer.
391 bool ForwardGestureEventToRenderer(
392 ui::GestureEvent
* gesture
);
394 // Process all of the given gestures (passes them on to renderer)
395 void ProcessGestures(ui::GestureRecognizer::Gestures
* gestures
);
397 // Sends the specified mouse event to the renderer.
398 void ForwardMouseEventToRenderer(UINT message
, WPARAM wparam
, LPARAM lparam
);
400 // Synthesize mouse wheel event.
401 LRESULT
SynthesizeMouseWheel(bool is_vertical
, int scroll_code
,
402 short scroll_position
);
404 // Shuts down the render_widget_host_. This is a separate function so we can
405 // invoke it from the message loop.
408 // Redraws the window synchronously, and any child windows (i.e. plugins)
412 // Draw our background over the given HDC in the given |rect|. The background
413 // will be tiled such that it lines up with existing tiles starting from the
415 void DrawBackground(const RECT
& rect
, CPaintDC
* dc
);
417 // Clean up the compositor window, if needed.
418 void CleanupCompositorWindow();
420 // Whether the window should be activated.
421 bool IsActivatable() const;
423 // Do initialization needed by both InitAsPopup() and InitAsFullscreen().
424 void DoPopupOrFullscreenInit(HWND parent_hwnd
,
425 const gfx::Rect
& pos
,
428 CPoint
GetClientCenter() const;
429 // In mouse lock mode, moves the mouse cursor to the center of the view if it
430 // is too close to the border.
431 void MoveCursorToCenterIfNecessary();
433 void HandleLockedMouseEvent(UINT message
, WPARAM wparam
, LPARAM lparam
);
435 LRESULT
OnDocumentFeed(RECONVERTSTRING
* reconv
);
436 LRESULT
OnReconvertString(RECONVERTSTRING
* reconv
);
437 LRESULT
OnQueryCharPosition(IMECHARPOSITION
* position
);
439 // Sets the appropriate mode for raw-touches or gestures. Currently touch mode
440 // will only take effect on Win7+.
441 void UpdateDesiredTouchMode();
443 // Configures the enable/disable state of |ime_input_| to match with the
444 // current |text_input_type_|.
445 void UpdateIMEState();
447 // Returns bounds of the view in pixels.
448 gfx::Rect
GetPixelBounds() const;
450 // Sets the appropriate input scope for given |text_input_type| if TSF-aware
451 // is not required. Does nothing if TSF-aware is required (and TSF text store
452 // is responsible for managing input scope). Currently input scope will only
453 // take effect on Vista+.
454 void UpdateInputScopeIfNecessary(ui::TextInputType text_input_type
);
456 // The associated Model. While |this| is being Destroyed,
457 // |render_widget_host_| is NULL and the Windows message loop is run one last
458 // time. Message handlers must check for a NULL |render_widget_host_|.
459 RenderWidgetHostImpl
* render_widget_host_
;
461 // When we are doing accelerated compositing
462 HWND compositor_host_window_
;
464 // Presents a texture received from another process to the compositing
466 scoped_ptr
<AcceleratedSurface
> accelerated_surface_
;
468 // true if the compositor host window must be hidden after the
469 // software renderered view is updated.
470 bool hide_compositor_window_at_next_paint_
;
472 // The cursor for the page. This is passed up from the renderer.
473 WebCursor current_cursor_
;
475 // Indicates if the page is loading.
478 // true if we are currently tracking WM_MOUSEEXIT messages.
479 bool track_mouse_leave_
;
481 // Wrapper class for IMM32 APIs.
482 // (See "ui/base/ime/win/imm32_manager.h" for its details.)
483 scoped_ptr
<ui::IMM32Manager
> imm32_manager_
;
485 // Represents whether or not this browser process is receiving status
486 // messages about the focused edit control from a renderer process.
487 bool ime_notification_
;
489 // true if Enter was hit when render widget host was in focus.
490 bool capture_enter_key_
;
492 // The touch-state. Its touch-points are updated as necessary. A new
493 // touch-point is added from an TOUCHEVENTF_DOWN message, and a touch-point
494 // is removed from the list on an TOUCHEVENTF_UP message.
495 scoped_ptr
<WebTouchState
> touch_state_
;
497 // True if we're in the midst of a paint operation and should respond to
498 // DidPaintRect() notifications by merely invalidating. See comments on
499 // render_widget_host_view.h:DidPaintRect().
500 bool about_to_validate_and_paint_
;
502 // true if the View should be closed when its HWND is deactivated (used to
503 // support SELECT popups which are closed when they are deactivated).
504 bool close_on_deactivate_
;
506 // Whether Destroy() has been called. Used to detect a crasher
507 // (http://crbug.com/24248) where render_view_host_ has been deleted when
508 // OnFinalMessage is called.
509 bool being_destroyed_
;
512 // The text to be shown in the tooltip, supplied by the renderer.
513 base::string16 tooltip_text_
;
514 // The tooltip control hwnd
516 // Whether or not a tooltip is currently visible. We use this to track
517 // whether or not we want to force-close the tooltip when we receive mouse
518 // move notifications from the renderer. See comment in OnMsgSetTooltipText.
519 bool tooltip_showing_
;
521 // Factory used to safely scope delayed calls to ShutdownHost().
522 base::WeakPtrFactory
<RenderWidgetHostViewWin
> weak_factory_
;
524 // The time at which this view started displaying white pixels as a result of
525 // not having anything to paint (empty backing store from renderer). This
526 // value returns true for is_null() if we are not recording whiteout times.
527 base::TimeTicks whiteout_start_time_
;
529 // The time it took after this view was selected for it to be fully painted.
530 base::TimeTicks web_contents_switch_paint_time_
;
532 // Registrar so we can listen to RENDERER_PROCESS_TERMINATED events.
533 NotificationRegistrar registrar_
;
535 // Stores the current text input type received by TextInputStateChanged()
537 ui::TextInputType text_input_type_
;
538 ui::TextInputMode text_input_mode_
;
539 bool can_compose_inline_
;
541 ScopedVector
<ui::ViewProp
> props_
;
543 // Is the widget fullscreen?
546 // Used to record the last position of the mouse.
548 // While the mouse is locked, |unlocked| and |unlocked_global| store the
549 // last known position just as mouse lock was entered.
550 // Relative to the upper-left corner of the view.
552 // Relative to the upper-left corner of the screen.
553 gfx::Point unlocked_global
;
555 // Only valid while the mouse is locked.
556 gfx::Point locked_global
;
557 } last_mouse_position_
;
559 // When the mouse cursor is moved to the center of the view by
560 // MoveCursorToCenterIfNecessary(), we ignore the resulting WM_MOUSEMOVE
564 // Relative to the upper-left corner of the screen.
566 } move_to_center_request_
;
568 // In the case of the mouse being moved away from the view and then moved
569 // back, we regard the mouse movement as (0, 0).
570 bool ignore_mouse_movement_
;
572 gfx::Range composition_range_
;
574 // The current composition character bounds.
575 std::vector
<gfx::Rect
> composition_character_bounds_
;
577 // A cached latest caret rectangle sent from renderer.
578 gfx::Rect caret_rect_
;
580 // TODO(ananta): The pointer and touch related members should be moved to an
581 // independent class to reduce the clutter. This includes members
582 // pointer_down_context_ and last_touch_location_.
584 // Set to true if we are in the context of a pointer down message.
585 bool pointer_down_context_
;
587 // The global x, y coordinates of the last point a touch event was
588 // received, used to determine if it's okay to open the on-screen
589 // keyboard. Reset when the window loses focus.
590 gfx::Point last_touch_location_
;
592 // Region in which the view will be transparent to clicks.
593 scoped_ptr
<SkRegion
> transparent_region_
;
595 // Are touch events currently enabled?
596 bool touch_events_enabled_
;
598 scoped_ptr
<ui::GestureRecognizer
> gesture_recognizer_
;
600 // The OS-provided default IAccessible instance for our hwnd.
601 base::win::ScopedComPtr
<IAccessible
> window_iaccessible_
;
603 std::vector
<ui::LatencyInfo
> software_latency_info_
;
605 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewWin
);
608 } // namespace content
610 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_WIN_H_