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_AURA_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
13 #include "base/callback.h"
14 #include "base/gtest_prod_util.h"
15 #include "base/memory/linked_ptr.h"
16 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/weak_ptr.h"
19 #include "content/browser/accessibility/browser_accessibility_manager.h"
20 #include "content/browser/compositor/delegated_frame_host.h"
21 #include "content/browser/compositor/image_transport_factory.h"
22 #include "content/browser/compositor/owned_mailbox.h"
23 #include "content/browser/renderer_host/render_widget_host_view_base.h"
24 #include "content/common/content_export.h"
25 #include "content/common/cursors/webcursor.h"
26 #include "third_party/skia/include/core/SkRegion.h"
27 #include "ui/aura/client/cursor_client_observer.h"
28 #include "ui/aura/client/focus_change_observer.h"
29 #include "ui/aura/window_delegate.h"
30 #include "ui/aura/window_tree_host_observer.h"
31 #include "ui/base/ime/text_input_client.h"
32 #include "ui/gfx/display_observer.h"
33 #include "ui/gfx/insets.h"
34 #include "ui/gfx/rect.h"
35 #include "ui/wm/public/activation_change_observer.h"
36 #include "ui/wm/public/activation_delegate.h"
38 struct ViewHostMsg_TextInputState_Params
;
43 class ScopedTooltipDisabler
;
48 class CopyOutputRequest
;
49 class CopyOutputResult
;
50 class DelegatedFrameData
;
71 class LegacyRenderWidgetHostHWND
;
74 class OverscrollController
;
75 class RenderFrameHostImpl
;
76 class RenderWidgetHostImpl
;
77 class RenderWidgetHostView
;
79 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
80 class CONTENT_EXPORT RenderWidgetHostViewAura
81 : public RenderWidgetHostViewBase
,
82 public DelegatedFrameHostClient
,
83 public ui::TextInputClient
,
84 public gfx::DisplayObserver
,
85 public aura::WindowTreeHostObserver
,
86 public aura::WindowDelegate
,
87 public aura::client::ActivationDelegate
,
88 public aura::client::ActivationChangeObserver
,
89 public aura::client::FocusChangeObserver
,
90 public aura::client::CursorClientObserver
,
91 public base::SupportsWeakPtr
<RenderWidgetHostViewAura
> {
93 // Displays and controls touch editing elements such as selection handles.
94 class TouchEditingClient
{
96 TouchEditingClient() {}
98 // Tells the client to start showing touch editing handles.
99 virtual void StartTouchEditing() = 0;
101 // Notifies the client that touch editing is no longer needed. |quick|
102 // determines whether the handles should fade out quickly or slowly.
103 virtual void EndTouchEditing(bool quick
) = 0;
105 // Notifies the client that the selection bounds need to be updated.
106 virtual void OnSelectionOrCursorChanged(const gfx::Rect
& anchor
,
107 const gfx::Rect
& focus
) = 0;
109 // Notifies the client that the current text input type as changed.
110 virtual void OnTextInputTypeChanged(ui::TextInputType type
) = 0;
112 // Notifies the client that an input event is about to be sent to the
113 // renderer. Returns true if the client wants to stop event propagation.
114 virtual bool HandleInputEvent(const ui::Event
* event
) = 0;
116 // Notifies the client that a gesture event ack was received.
117 virtual void GestureEventAck(int gesture_event_type
) = 0;
119 // This is called when the view is destroyed, so that the client can
120 // perform any necessary clean-up.
121 virtual void OnViewDestroyed() = 0;
124 virtual ~TouchEditingClient() {}
127 void set_touch_editing_client(TouchEditingClient
* client
) {
128 touch_editing_client_
= client
;
131 explicit RenderWidgetHostViewAura(RenderWidgetHost
* host
);
133 // RenderWidgetHostView implementation.
134 virtual void InitAsChild(gfx::NativeView parent_view
) OVERRIDE
;
135 virtual RenderWidgetHost
* GetRenderWidgetHost() const OVERRIDE
;
136 virtual void SetSize(const gfx::Size
& size
) OVERRIDE
;
137 virtual void SetBounds(const gfx::Rect
& rect
) OVERRIDE
;
138 virtual gfx::Vector2dF
GetLastScrollOffset() const OVERRIDE
;
139 virtual gfx::NativeView
GetNativeView() const OVERRIDE
;
140 virtual gfx::NativeViewId
GetNativeViewId() const OVERRIDE
;
141 virtual gfx::NativeViewAccessible
GetNativeViewAccessible() OVERRIDE
;
142 virtual ui::TextInputClient
* GetTextInputClient() OVERRIDE
;
143 virtual bool HasFocus() const OVERRIDE
;
144 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE
;
145 virtual void Show() OVERRIDE
;
146 virtual void Hide() OVERRIDE
;
147 virtual bool IsShowing() OVERRIDE
;
148 virtual gfx::Rect
GetViewBounds() const OVERRIDE
;
149 virtual void SetBackgroundOpaque(bool opaque
) OVERRIDE
;
150 virtual gfx::Size
GetVisibleViewportSize() const OVERRIDE
;
151 virtual void SetInsets(const gfx::Insets
& insets
) OVERRIDE
;
153 // Overridden from RenderWidgetHostViewBase:
154 virtual void InitAsPopup(RenderWidgetHostView
* parent_host_view
,
155 const gfx::Rect
& pos
) OVERRIDE
;
156 virtual void InitAsFullscreen(
157 RenderWidgetHostView
* reference_host_view
) OVERRIDE
;
158 virtual void WasShown() OVERRIDE
;
159 virtual void WasHidden() OVERRIDE
;
160 virtual void MovePluginWindows(
161 const std::vector
<WebPluginGeometry
>& moves
) OVERRIDE
;
162 virtual void Focus() OVERRIDE
;
163 virtual void Blur() OVERRIDE
;
164 virtual void UpdateCursor(const WebCursor
& cursor
) OVERRIDE
;
165 virtual void SetIsLoading(bool is_loading
) OVERRIDE
;
166 virtual void TextInputStateChanged(
167 const ViewHostMsg_TextInputState_Params
& params
) OVERRIDE
;
168 virtual void ImeCancelComposition() OVERRIDE
;
169 virtual void ImeCompositionRangeChanged(
170 const gfx::Range
& range
,
171 const std::vector
<gfx::Rect
>& character_bounds
) OVERRIDE
;
172 virtual void RenderProcessGone(base::TerminationStatus status
,
173 int error_code
) OVERRIDE
;
174 virtual void Destroy() OVERRIDE
;
175 virtual void SetTooltipText(const base::string16
& tooltip_text
) OVERRIDE
;
176 virtual void SelectionChanged(const base::string16
& text
,
178 const gfx::Range
& range
) OVERRIDE
;
179 virtual gfx::Size
GetRequestedRendererSize() const OVERRIDE
;
180 virtual void SelectionBoundsChanged(
181 const ViewHostMsg_SelectionBounds_Params
& params
) OVERRIDE
;
182 virtual void CopyFromCompositingSurface(
183 const gfx::Rect
& src_subrect
,
184 const gfx::Size
& dst_size
,
185 const base::Callback
<void(bool, const SkBitmap
&)>& callback
,
186 const SkColorType color_type
) OVERRIDE
;
187 virtual void CopyFromCompositingSurfaceToVideoFrame(
188 const gfx::Rect
& src_subrect
,
189 const scoped_refptr
<media::VideoFrame
>& target
,
190 const base::Callback
<void(bool)>& callback
) OVERRIDE
;
191 virtual bool CanCopyToVideoFrame() const OVERRIDE
;
192 virtual bool CanSubscribeFrame() const OVERRIDE
;
193 virtual void BeginFrameSubscription(
194 scoped_ptr
<RenderWidgetHostViewFrameSubscriber
> subscriber
) OVERRIDE
;
195 virtual void EndFrameSubscription() OVERRIDE
;
196 virtual void AcceleratedSurfaceInitialized(int host_id
,
197 int route_id
) OVERRIDE
;
198 virtual void AcceleratedSurfaceBuffersSwapped(
199 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params
& params_in_pixel
,
200 int gpu_host_id
) OVERRIDE
;
201 virtual void AcceleratedSurfacePostSubBuffer(
202 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params
& params_in_pixel
,
203 int gpu_host_id
) OVERRIDE
;
204 virtual void AcceleratedSurfaceSuspend() OVERRIDE
;
205 virtual void AcceleratedSurfaceRelease() OVERRIDE
;
206 virtual bool HasAcceleratedSurface(const gfx::Size
& desired_size
) OVERRIDE
;
207 virtual void GetScreenInfo(blink::WebScreenInfo
* results
) OVERRIDE
;
208 virtual gfx::Rect
GetBoundsInRootWindow() OVERRIDE
;
209 virtual void WheelEventAck(const blink::WebMouseWheelEvent
& event
,
210 InputEventAckState ack_result
) OVERRIDE
;
211 virtual void GestureEventAck(const blink::WebGestureEvent
& event
,
212 InputEventAckState ack_result
) OVERRIDE
;
213 virtual void ProcessAckedTouchEvent(
214 const TouchEventWithLatencyInfo
& touch
,
215 InputEventAckState ack_result
) OVERRIDE
;
216 virtual scoped_ptr
<SyntheticGestureTarget
> CreateSyntheticGestureTarget()
218 virtual InputEventAckState
FilterInputEvent(
219 const blink::WebInputEvent
& input_event
) OVERRIDE
;
220 virtual gfx::GLSurfaceHandle
GetCompositingSurface() OVERRIDE
;
221 virtual BrowserAccessibilityManager
* CreateBrowserAccessibilityManager(
222 BrowserAccessibilityDelegate
* delegate
) OVERRIDE
;
223 virtual gfx::AcceleratedWidget
AccessibilityGetAcceleratedWidget() OVERRIDE
;
224 virtual gfx::NativeViewAccessible
AccessibilityGetNativeViewAccessible()
226 virtual bool LockMouse() OVERRIDE
;
227 virtual void UnlockMouse() OVERRIDE
;
228 virtual void OnSwapCompositorFrame(
229 uint32 output_surface_id
,
230 scoped_ptr
<cc::CompositorFrame
> frame
) OVERRIDE
;
233 virtual void SetParentNativeViewAccessible(
234 gfx::NativeViewAccessible accessible_parent
) OVERRIDE
;
235 virtual gfx::NativeViewId
GetParentForWindowlessPlugin() const OVERRIDE
;
238 // Overridden from ui::TextInputClient:
239 virtual void SetCompositionText(
240 const ui::CompositionText
& composition
) OVERRIDE
;
241 virtual void ConfirmCompositionText() OVERRIDE
;
242 virtual void ClearCompositionText() OVERRIDE
;
243 virtual void InsertText(const base::string16
& text
) OVERRIDE
;
244 virtual void InsertChar(base::char16 ch
, int flags
) OVERRIDE
;
245 virtual gfx::NativeWindow
GetAttachedWindow() const OVERRIDE
;
246 virtual ui::TextInputType
GetTextInputType() const OVERRIDE
;
247 virtual ui::TextInputMode
GetTextInputMode() const OVERRIDE
;
248 virtual bool CanComposeInline() const OVERRIDE
;
249 virtual gfx::Rect
GetCaretBounds() const OVERRIDE
;
250 virtual bool GetCompositionCharacterBounds(uint32 index
,
251 gfx::Rect
* rect
) const OVERRIDE
;
252 virtual bool HasCompositionText() const OVERRIDE
;
253 virtual bool GetTextRange(gfx::Range
* range
) const OVERRIDE
;
254 virtual bool GetCompositionTextRange(gfx::Range
* range
) const OVERRIDE
;
255 virtual bool GetSelectionRange(gfx::Range
* range
) const OVERRIDE
;
256 virtual bool SetSelectionRange(const gfx::Range
& range
) OVERRIDE
;
257 virtual bool DeleteRange(const gfx::Range
& range
) OVERRIDE
;
258 virtual bool GetTextFromRange(const gfx::Range
& range
,
259 base::string16
* text
) const OVERRIDE
;
260 virtual void OnInputMethodChanged() OVERRIDE
;
261 virtual bool ChangeTextDirectionAndLayoutAlignment(
262 base::i18n::TextDirection direction
) OVERRIDE
;
263 virtual void ExtendSelectionAndDelete(size_t before
, size_t after
) OVERRIDE
;
264 virtual void EnsureCaretInRect(const gfx::Rect
& rect
) OVERRIDE
;
265 virtual void OnCandidateWindowShown() OVERRIDE
;
266 virtual void OnCandidateWindowUpdated() OVERRIDE
;
267 virtual void OnCandidateWindowHidden() OVERRIDE
;
268 virtual bool IsEditingCommandEnabled(int command_id
) OVERRIDE
;
269 virtual void ExecuteEditingCommand(int command_id
) OVERRIDE
;
271 // Overridden from gfx::DisplayObserver:
272 virtual void OnDisplayAdded(const gfx::Display
& new_display
) OVERRIDE
;
273 virtual void OnDisplayRemoved(const gfx::Display
& old_display
) OVERRIDE
;
274 virtual void OnDisplayMetricsChanged(const gfx::Display
& display
,
275 uint32_t metrics
) OVERRIDE
;
277 // Overridden from aura::WindowDelegate:
278 virtual gfx::Size
GetMinimumSize() const OVERRIDE
;
279 virtual gfx::Size
GetMaximumSize() const OVERRIDE
;
280 virtual void OnBoundsChanged(const gfx::Rect
& old_bounds
,
281 const gfx::Rect
& new_bounds
) OVERRIDE
;
282 virtual gfx::NativeCursor
GetCursor(const gfx::Point
& point
) OVERRIDE
;
283 virtual int GetNonClientComponent(const gfx::Point
& point
) const OVERRIDE
;
284 virtual bool ShouldDescendIntoChildForEventHandling(
286 const gfx::Point
& location
) OVERRIDE
;
287 virtual bool CanFocus() OVERRIDE
;
288 virtual void OnCaptureLost() OVERRIDE
;
289 virtual void OnPaint(gfx::Canvas
* canvas
) OVERRIDE
;
290 virtual void OnDeviceScaleFactorChanged(float device_scale_factor
) OVERRIDE
;
291 virtual void OnWindowDestroying(aura::Window
* window
) OVERRIDE
;
292 virtual void OnWindowDestroyed(aura::Window
* window
) OVERRIDE
;
293 virtual void OnWindowTargetVisibilityChanged(bool visible
) OVERRIDE
;
294 virtual bool HasHitTestMask() const OVERRIDE
;
295 virtual void GetHitTestMask(gfx::Path
* mask
) const OVERRIDE
;
297 // Overridden from ui::EventHandler:
298 virtual void OnKeyEvent(ui::KeyEvent
* event
) OVERRIDE
;
299 virtual void OnMouseEvent(ui::MouseEvent
* event
) OVERRIDE
;
300 virtual void OnScrollEvent(ui::ScrollEvent
* event
) OVERRIDE
;
301 virtual void OnTouchEvent(ui::TouchEvent
* event
) OVERRIDE
;
302 virtual void OnGestureEvent(ui::GestureEvent
* event
) OVERRIDE
;
304 // Overridden from aura::client::ActivationDelegate:
305 virtual bool ShouldActivate() const OVERRIDE
;
307 // Overridden from aura::client::ActivationChangeObserver:
308 virtual void OnWindowActivated(aura::Window
* gained_activation
,
309 aura::Window
* lost_activation
) OVERRIDE
;
311 // Overridden from aura::client::CursorClientObserver:
312 virtual void OnCursorVisibilityChanged(bool is_visible
) OVERRIDE
;
314 // Overridden from aura::client::FocusChangeObserver:
315 virtual void OnWindowFocused(aura::Window
* gained_focus
,
316 aura::Window
* lost_focus
) OVERRIDE
;
318 // Overridden from aura::WindowTreeHostObserver:
319 virtual void OnHostMoved(const aura::WindowTreeHost
* host
,
320 const gfx::Point
& new_origin
) OVERRIDE
;
323 // Sets the cutout rects from constrained windows. These are rectangles that
324 // windowed NPAPI plugins shouldn't paint in. Overwrites any previous cutout
326 void UpdateConstrainedWindowRects(const std::vector
<gfx::Rect
>& rects
);
328 // Updates the cursor clip region. Used for mouse locking.
329 void UpdateMouseLockRegion();
331 // Notification that the LegacyRenderWidgetHostHWND was destroyed.
332 void OnLegacyWindowDestroyed();
335 // Method to indicate if this instance is shutting down or closing.
336 // TODO(shrikant): Discuss around to see if it makes sense to add this method
337 // as part of RenderWidgetHostView.
338 bool IsClosing() const { return in_shutdown_
; }
340 // Sets whether the overscroll controller should be enabled for this page.
341 void SetOverscrollControllerEnabled(bool enabled
);
343 void SnapToPhysicalPixelBoundary();
345 OverscrollController
* overscroll_controller() const {
346 return overscroll_controller_
.get();
350 virtual ~RenderWidgetHostViewAura();
352 // Exposed for tests.
353 aura::Window
* window() { return window_
; }
354 virtual SkColorType
PreferredReadbackFormat() OVERRIDE
;
355 virtual DelegatedFrameHost
* GetDelegatedFrameHost() const OVERRIDE
;
358 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, SetCompositionText
);
359 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, TouchEventState
);
360 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
361 TouchEventPositionsArentRounded
);
362 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, TouchEventSyncAsync
);
363 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, SwapNotifiesWindow
);
364 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
365 SkippedDelegatedFrames
);
366 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, OutputSurfaceIdChange
);
367 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
368 DiscardDelegatedFrames
);
369 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
370 DiscardDelegatedFramesWithLocking
);
371 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, SoftwareDPIChange
);
372 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
373 UpdateCursorIfOverSelf
);
374 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraCopyRequestTest
,
375 DestroyedAfterCopyRequest
);
376 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
377 VisibleViewportTest
);
378 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
379 OverscrollResetsOnBlur
);
380 FRIEND_TEST_ALL_PREFIXES(WebContentsViewAuraTest
,
381 WebContentsViewReparent
);
383 class WindowObserver
;
384 friend class WindowObserver
;
386 void UpdateCursorIfOverSelf();
388 // Tracks whether SnapToPhysicalPixelBoundary() has been called.
389 bool has_snapped_to_boundary() { return has_snapped_to_boundary_
; }
390 void ResetHasSnappedToBoundary() { has_snapped_to_boundary_
= false; }
392 // Set the bounds of the window and handle size changes. Assumes the caller
393 // has already adjusted the origin of |rect| to conform to whatever coordinate
394 // space is required by the aura::Window.
395 void InternalSetBounds(const gfx::Rect
& rect
);
398 bool UsesNativeWindowFrame() const;
401 ui::InputMethod
* GetInputMethod() const;
403 // Returns whether the widget needs an input grab to work properly.
404 bool NeedsInputGrab();
406 // Confirm existing composition text in the webpage and ask the input method
407 // to cancel its ongoing composition session.
408 void FinishImeCompositionSession();
410 // This method computes movementX/Y and keeps track of mouse location for
411 // mouse lock on all mouse move events.
412 void ModifyEventMovementAndCoords(blink::WebMouseEvent
* event
);
414 // Sends an IPC to the renderer process to communicate whether or not
415 // the mouse cursor is visible anywhere on the screen.
416 void NotifyRendererOfCursorVisibilityState(bool is_visible
);
418 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty
419 // SchedulePaint() is invoked for |rect|.
420 void SchedulePaintIfNotInClip(const gfx::Rect
& rect
, const gfx::Rect
& clip
);
422 // Helper method to determine if, in mouse locked mode, the cursor should be
424 bool ShouldMoveToCenter();
426 // Called after |window_| is parented to a WindowEventDispatcher.
427 void AddedToRootWindow();
429 // Called prior to removing |window_| from a WindowEventDispatcher.
430 void RemovingFromRootWindow();
432 // DelegatedFrameHostClient implementation.
433 virtual ui::Compositor
* GetCompositor() const OVERRIDE
;
434 virtual ui::Layer
* GetLayer() OVERRIDE
;
435 virtual RenderWidgetHostImpl
* GetHost() OVERRIDE
;
436 virtual bool IsVisible() OVERRIDE
;
437 virtual scoped_ptr
<ResizeLock
> CreateResizeLock(
438 bool defer_compositor_lock
) OVERRIDE
;
439 virtual gfx::Size
DesiredFrameSize() OVERRIDE
;
440 virtual float CurrentDeviceScaleFactor() OVERRIDE
;
441 virtual gfx::Size
ConvertViewSizeToPixel(const gfx::Size
& size
) OVERRIDE
;
443 // Detaches |this| from the input method object.
444 void DetachFromInputMethod();
446 // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method
447 // calls our keybindings handler against the event and send matched
448 // edit commands to renderer instead.
449 void ForwardKeyboardEvent(const NativeWebKeyboardEvent
& event
);
451 // Dismisses a Web Popup on a mouse or touch press outside the popup and its
453 void ApplyEventFilterForPopupExit(ui::LocatedEvent
* event
);
455 // Converts |rect| from window coordinate to screen coordinate.
456 gfx::Rect
ConvertRectToScreen(const gfx::Rect
& rect
) const;
458 // Converts |rect| from screen coordinate to window coordinate.
459 gfx::Rect
ConvertRectFromScreen(const gfx::Rect
& rect
) const;
461 // Helper function to set keyboard focus to the main window.
462 void SetKeyboardFocus();
464 RenderFrameHostImpl
* GetFocusedFrame();
467 RenderWidgetHostImpl
* host_
;
469 aura::Window
* window_
;
471 scoped_ptr
<DelegatedFrameHost
> delegated_frame_host_
;
473 scoped_ptr
<WindowObserver
> window_observer_
;
475 // Are we in the process of closing? Tracked so fullscreen views can avoid
476 // sending a second shutdown request to the host when they lose the focus
477 // after requesting shutdown for another reason (e.g. Escape key).
480 // True if in the process of handling a window bounds changed notification.
481 bool in_bounds_changed_
;
483 // Is this a fullscreen view?
486 // Our parent host view, if this is a popup. NULL otherwise.
487 RenderWidgetHostViewAura
* popup_parent_host_view_
;
489 // Our child popup host. NULL if we do not have a child popup.
490 RenderWidgetHostViewAura
* popup_child_host_view_
;
492 class EventFilterForPopupExit
;
493 friend class EventFilterForPopupExit
;
494 scoped_ptr
<ui::EventHandler
> event_filter_for_popup_exit_
;
496 // True when content is being loaded. Used to show an hourglass cursor.
499 // The cursor for the page. This is passed up from the renderer.
500 WebCursor current_cursor_
;
502 // The touch-event. Its touch-points are updated as necessary. A new
503 // touch-point is added from an ET_TOUCH_PRESSED event, and a touch-point is
504 // removed from the list on an ET_TOUCH_RELEASED event.
505 blink::WebTouchEvent touch_event_
;
507 // The current text input type.
508 ui::TextInputType text_input_type_
;
509 // The current text input mode corresponding to HTML5 inputmode attribute.
510 ui::TextInputMode text_input_mode_
;
511 bool can_compose_inline_
;
513 // Rectangles for the selection anchor and focus.
514 gfx::Rect selection_anchor_rect_
;
515 gfx::Rect selection_focus_rect_
;
517 // The current composition character bounds.
518 std::vector
<gfx::Rect
> composition_character_bounds_
;
520 // Indicates if there is onging composition text.
521 bool has_composition_text_
;
523 // Whether return characters should be passed on to the RenderWidgetHostImpl.
524 bool accept_return_character_
;
526 // Current tooltip text.
527 base::string16 tooltip_
;
529 // The size and scale of the last software compositing frame that was swapped.
530 gfx::Size last_swapped_software_frame_size_
;
531 float last_swapped_software_frame_scale_factor_
;
533 // If non-NULL we're in OnPaint() and this is the supplied canvas.
534 gfx::Canvas
* paint_canvas_
;
536 // Used to record the last position of the mouse.
537 // While the mouse is locked, they store the last known position just as mouse
539 // Relative to the upper-left corner of the view.
540 gfx::Point unlocked_mouse_position_
;
541 // Relative to the upper-left corner of the screen.
542 gfx::Point unlocked_global_mouse_position_
;
543 // Last cursor position relative to screen. Used to compute movementX/Y.
544 gfx::Point global_mouse_position_
;
545 // In mouse locked mode, we syntheticaly move the mouse cursor to the center
546 // of the window when it reaches the window borders to avoid it going outside.
547 // This flag is used to differentiate between these synthetic mouse move
548 // events vs. normal mouse move events.
549 bool synthetic_move_sent_
;
551 // Used to track the state of the window we're created from. Only used when
552 // created fullscreen.
553 scoped_ptr
<aura::WindowTracker
> host_tracker_
;
555 // Used to track the last cursor visibility update that was sent to the
556 // renderer via NotifyRendererOfCursorVisibilityState().
557 enum CursorVisibilityState
{
562 CursorVisibilityState cursor_visibility_state_in_renderer_
;
565 // The list of rectangles from constrained windows over this view. Windowed
566 // NPAPI plugins shouldn't draw over them.
567 std::vector
<gfx::Rect
> constrained_rects_
;
569 typedef std::map
<HWND
, WebPluginGeometry
> PluginWindowMoves
;
570 // Contains information about each windowed plugin's clip and cutout rects (
571 // from the renderer). This is needed because when the transient windoiws
572 // over this view changes, we need this information in order to create a new
573 // region for the HWND.
574 PluginWindowMoves plugin_window_moves_
;
576 // The LegacyRenderWidgetHostHWND class provides a dummy HWND which is used
577 // for accessibility, as the container for windowless plugins like
578 // Flash/Silverlight, etc and for legacy drivers for trackpoints/trackpads,
580 // The LegacyRenderWidgetHostHWND instance is created during the first call
581 // to RenderWidgetHostViewAura::InternalSetBounds. The instance is destroyed
582 // when the LegacyRenderWidgetHostHWND hwnd is destroyed.
583 content::LegacyRenderWidgetHostHWND
* legacy_render_widget_host_HWND_
;
585 // Set to true if the legacy_render_widget_host_HWND_ instance was destroyed
586 // by Windows. This could happen if the browser window was destroyed by
587 // DestroyWindow for e.g. This flag helps ensure that we don't try to create
588 // the LegacyRenderWidgetHostHWND instance again as that would be a futile
590 bool legacy_window_destroyed_
;
593 bool has_snapped_to_boundary_
;
595 TouchEditingClient
* touch_editing_client_
;
597 scoped_ptr
<OverscrollController
> overscroll_controller_
;
599 // The last scroll offset of the view.
600 gfx::Vector2dF last_scroll_offset_
;
604 std::vector
<ui::LatencyInfo
> software_latency_info_
;
606 scoped_ptr
<aura::client::ScopedTooltipDisabler
> tooltip_disabler_
;
608 base::WeakPtrFactory
<RenderWidgetHostViewAura
> weak_ptr_factory_
;
610 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura
);
613 } // namespace content
615 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_