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