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::NativeView
GetNativeView() const OVERRIDE
;
139 virtual gfx::NativeViewId
GetNativeViewId() const OVERRIDE
;
140 virtual gfx::NativeViewAccessible
GetNativeViewAccessible() OVERRIDE
;
141 virtual ui::TextInputClient
* GetTextInputClient() OVERRIDE
;
142 virtual bool HasFocus() const OVERRIDE
;
143 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE
;
144 virtual void Show() OVERRIDE
;
145 virtual void Hide() OVERRIDE
;
146 virtual bool IsShowing() OVERRIDE
;
147 virtual gfx::Rect
GetViewBounds() const OVERRIDE
;
148 virtual void SetBackgroundOpaque(bool opaque
) OVERRIDE
;
149 virtual gfx::Size
GetVisibleViewportSize() const OVERRIDE
;
150 virtual void SetInsets(const gfx::Insets
& insets
) OVERRIDE
;
152 // Overridden from RenderWidgetHostViewBase:
153 virtual void InitAsPopup(RenderWidgetHostView
* parent_host_view
,
154 const gfx::Rect
& pos
) OVERRIDE
;
155 virtual void InitAsFullscreen(
156 RenderWidgetHostView
* reference_host_view
) OVERRIDE
;
157 virtual void WasShown() OVERRIDE
;
158 virtual void WasHidden() OVERRIDE
;
159 virtual void MovePluginWindows(
160 const std::vector
<WebPluginGeometry
>& moves
) OVERRIDE
;
161 virtual void Focus() OVERRIDE
;
162 virtual void Blur() OVERRIDE
;
163 virtual void UpdateCursor(const WebCursor
& cursor
) OVERRIDE
;
164 virtual void SetIsLoading(bool is_loading
) OVERRIDE
;
165 virtual void TextInputStateChanged(
166 const ViewHostMsg_TextInputState_Params
& params
) OVERRIDE
;
167 virtual void ImeCancelComposition() OVERRIDE
;
168 virtual void ImeCompositionRangeChanged(
169 const gfx::Range
& range
,
170 const std::vector
<gfx::Rect
>& character_bounds
) OVERRIDE
;
171 virtual void RenderProcessGone(base::TerminationStatus status
,
172 int error_code
) OVERRIDE
;
173 virtual void Destroy() OVERRIDE
;
174 virtual void SetTooltipText(const base::string16
& tooltip_text
) OVERRIDE
;
175 virtual void SelectionChanged(const base::string16
& text
,
177 const gfx::Range
& range
) OVERRIDE
;
178 virtual gfx::Size
GetRequestedRendererSize() const OVERRIDE
;
179 virtual void SelectionBoundsChanged(
180 const ViewHostMsg_SelectionBounds_Params
& params
) OVERRIDE
;
181 virtual void CopyFromCompositingSurface(
182 const gfx::Rect
& src_subrect
,
183 const gfx::Size
& dst_size
,
184 const base::Callback
<void(bool, const SkBitmap
&)>& callback
,
185 const SkColorType color_type
) OVERRIDE
;
186 virtual void CopyFromCompositingSurfaceToVideoFrame(
187 const gfx::Rect
& src_subrect
,
188 const scoped_refptr
<media::VideoFrame
>& target
,
189 const base::Callback
<void(bool)>& callback
) OVERRIDE
;
190 virtual bool CanCopyToVideoFrame() const OVERRIDE
;
191 virtual bool CanSubscribeFrame() const OVERRIDE
;
192 virtual void BeginFrameSubscription(
193 scoped_ptr
<RenderWidgetHostViewFrameSubscriber
> subscriber
) OVERRIDE
;
194 virtual void EndFrameSubscription() OVERRIDE
;
195 virtual void AcceleratedSurfaceInitialized(int host_id
,
196 int route_id
) OVERRIDE
;
197 virtual void AcceleratedSurfaceBuffersSwapped(
198 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params
& params_in_pixel
,
199 int gpu_host_id
) OVERRIDE
;
200 virtual void AcceleratedSurfacePostSubBuffer(
201 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params
& params_in_pixel
,
202 int gpu_host_id
) OVERRIDE
;
203 virtual void AcceleratedSurfaceSuspend() OVERRIDE
;
204 virtual void AcceleratedSurfaceRelease() OVERRIDE
;
205 virtual bool HasAcceleratedSurface(const gfx::Size
& desired_size
) OVERRIDE
;
206 virtual void GetScreenInfo(blink::WebScreenInfo
* results
) OVERRIDE
;
207 virtual gfx::Rect
GetBoundsInRootWindow() OVERRIDE
;
208 virtual void WheelEventAck(const blink::WebMouseWheelEvent
& event
,
209 InputEventAckState ack_result
) OVERRIDE
;
210 virtual void GestureEventAck(const blink::WebGestureEvent
& event
,
211 InputEventAckState ack_result
) OVERRIDE
;
212 virtual void ProcessAckedTouchEvent(
213 const TouchEventWithLatencyInfo
& touch
,
214 InputEventAckState ack_result
) OVERRIDE
;
215 virtual scoped_ptr
<SyntheticGestureTarget
> CreateSyntheticGestureTarget()
217 virtual InputEventAckState
FilterInputEvent(
218 const blink::WebInputEvent
& input_event
) OVERRIDE
;
219 virtual gfx::GLSurfaceHandle
GetCompositingSurface() OVERRIDE
;
220 virtual BrowserAccessibilityManager
* CreateBrowserAccessibilityManager(
221 BrowserAccessibilityDelegate
* delegate
) OVERRIDE
;
222 virtual gfx::AcceleratedWidget
AccessibilityGetAcceleratedWidget() OVERRIDE
;
223 virtual gfx::NativeViewAccessible
AccessibilityGetNativeViewAccessible()
225 virtual bool LockMouse() OVERRIDE
;
226 virtual void UnlockMouse() OVERRIDE
;
227 virtual void OnSwapCompositorFrame(
228 uint32 output_surface_id
,
229 scoped_ptr
<cc::CompositorFrame
> frame
) OVERRIDE
;
232 virtual void SetParentNativeViewAccessible(
233 gfx::NativeViewAccessible accessible_parent
) OVERRIDE
;
234 virtual gfx::NativeViewId
GetParentForWindowlessPlugin() const OVERRIDE
;
237 // Overridden from ui::TextInputClient:
238 virtual void SetCompositionText(
239 const ui::CompositionText
& composition
) OVERRIDE
;
240 virtual void ConfirmCompositionText() OVERRIDE
;
241 virtual void ClearCompositionText() OVERRIDE
;
242 virtual void InsertText(const base::string16
& text
) OVERRIDE
;
243 virtual void InsertChar(base::char16 ch
, int flags
) OVERRIDE
;
244 virtual gfx::NativeWindow
GetAttachedWindow() const OVERRIDE
;
245 virtual ui::TextInputType
GetTextInputType() const OVERRIDE
;
246 virtual ui::TextInputMode
GetTextInputMode() const OVERRIDE
;
247 virtual bool CanComposeInline() const OVERRIDE
;
248 virtual gfx::Rect
GetCaretBounds() const OVERRIDE
;
249 virtual bool GetCompositionCharacterBounds(uint32 index
,
250 gfx::Rect
* rect
) const OVERRIDE
;
251 virtual bool HasCompositionText() const OVERRIDE
;
252 virtual bool GetTextRange(gfx::Range
* range
) const OVERRIDE
;
253 virtual bool GetCompositionTextRange(gfx::Range
* range
) const OVERRIDE
;
254 virtual bool GetSelectionRange(gfx::Range
* range
) const OVERRIDE
;
255 virtual bool SetSelectionRange(const gfx::Range
& range
) OVERRIDE
;
256 virtual bool DeleteRange(const gfx::Range
& range
) OVERRIDE
;
257 virtual bool GetTextFromRange(const gfx::Range
& range
,
258 base::string16
* text
) const OVERRIDE
;
259 virtual void OnInputMethodChanged() OVERRIDE
;
260 virtual bool ChangeTextDirectionAndLayoutAlignment(
261 base::i18n::TextDirection direction
) OVERRIDE
;
262 virtual void ExtendSelectionAndDelete(size_t before
, size_t after
) OVERRIDE
;
263 virtual void EnsureCaretInRect(const gfx::Rect
& rect
) OVERRIDE
;
264 virtual void OnCandidateWindowShown() OVERRIDE
;
265 virtual void OnCandidateWindowUpdated() OVERRIDE
;
266 virtual void OnCandidateWindowHidden() OVERRIDE
;
267 virtual bool IsEditingCommandEnabled(int command_id
) OVERRIDE
;
268 virtual void ExecuteEditingCommand(int command_id
) OVERRIDE
;
270 // Overridden from gfx::DisplayObserver:
271 virtual void OnDisplayAdded(const gfx::Display
& new_display
) OVERRIDE
;
272 virtual void OnDisplayRemoved(const gfx::Display
& old_display
) OVERRIDE
;
273 virtual void OnDisplayMetricsChanged(const gfx::Display
& display
,
274 uint32_t metrics
) OVERRIDE
;
276 // Overridden from aura::WindowDelegate:
277 virtual gfx::Size
GetMinimumSize() const OVERRIDE
;
278 virtual gfx::Size
GetMaximumSize() const OVERRIDE
;
279 virtual void OnBoundsChanged(const gfx::Rect
& old_bounds
,
280 const gfx::Rect
& new_bounds
) OVERRIDE
;
281 virtual gfx::NativeCursor
GetCursor(const gfx::Point
& point
) OVERRIDE
;
282 virtual int GetNonClientComponent(const gfx::Point
& point
) const OVERRIDE
;
283 virtual bool ShouldDescendIntoChildForEventHandling(
285 const gfx::Point
& location
) OVERRIDE
;
286 virtual bool CanFocus() OVERRIDE
;
287 virtual void OnCaptureLost() OVERRIDE
;
288 virtual void OnPaint(gfx::Canvas
* canvas
) OVERRIDE
;
289 virtual void OnDeviceScaleFactorChanged(float device_scale_factor
) OVERRIDE
;
290 virtual void OnWindowDestroying(aura::Window
* window
) OVERRIDE
;
291 virtual void OnWindowDestroyed(aura::Window
* window
) OVERRIDE
;
292 virtual void OnWindowTargetVisibilityChanged(bool visible
) OVERRIDE
;
293 virtual bool HasHitTestMask() const OVERRIDE
;
294 virtual void GetHitTestMask(gfx::Path
* mask
) const OVERRIDE
;
296 // Overridden from ui::EventHandler:
297 virtual void OnKeyEvent(ui::KeyEvent
* event
) OVERRIDE
;
298 virtual void OnMouseEvent(ui::MouseEvent
* event
) OVERRIDE
;
299 virtual void OnScrollEvent(ui::ScrollEvent
* event
) OVERRIDE
;
300 virtual void OnTouchEvent(ui::TouchEvent
* event
) OVERRIDE
;
301 virtual void OnGestureEvent(ui::GestureEvent
* event
) OVERRIDE
;
303 // Overridden from aura::client::ActivationDelegate:
304 virtual bool ShouldActivate() const OVERRIDE
;
306 // Overridden from aura::client::ActivationChangeObserver:
307 virtual void OnWindowActivated(aura::Window
* gained_activation
,
308 aura::Window
* lost_activation
) OVERRIDE
;
310 // Overridden from aura::client::CursorClientObserver:
311 virtual void OnCursorVisibilityChanged(bool is_visible
) OVERRIDE
;
313 // Overridden from aura::client::FocusChangeObserver:
314 virtual void OnWindowFocused(aura::Window
* gained_focus
,
315 aura::Window
* lost_focus
) OVERRIDE
;
317 // Overridden from aura::WindowTreeHostObserver:
318 virtual void OnHostMoved(const aura::WindowTreeHost
* host
,
319 const gfx::Point
& new_origin
) OVERRIDE
;
322 // Sets the cutout rects from constrained windows. These are rectangles that
323 // windowed NPAPI plugins shouldn't paint in. Overwrites any previous cutout
325 void UpdateConstrainedWindowRects(const std::vector
<gfx::Rect
>& rects
);
327 // Updates the cursor clip region. Used for mouse locking.
328 void UpdateMouseLockRegion();
330 // Notification that the LegacyRenderWidgetHostHWND was destroyed.
331 void OnLegacyWindowDestroyed();
334 // Method to indicate if this instance is shutting down or closing.
335 // TODO(shrikant): Discuss around to see if it makes sense to add this method
336 // as part of RenderWidgetHostView.
337 bool IsClosing() const { return in_shutdown_
; }
339 // Sets whether the overscroll controller should be enabled for this page.
340 void SetOverscrollControllerEnabled(bool enabled
);
342 void SnapToPhysicalPixelBoundary();
344 OverscrollController
* overscroll_controller() const {
345 return overscroll_controller_
.get();
349 virtual ~RenderWidgetHostViewAura();
351 // Exposed for tests.
352 aura::Window
* window() { return window_
; }
353 virtual SkColorType
PreferredReadbackFormat() OVERRIDE
;
354 virtual DelegatedFrameHost
* GetDelegatedFrameHost() const OVERRIDE
;
357 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, SetCompositionText
);
358 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, TouchEventState
);
359 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
360 TouchEventPositionsArentRounded
);
361 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, TouchEventSyncAsync
);
362 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, SwapNotifiesWindow
);
363 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
364 SkippedDelegatedFrames
);
365 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, OutputSurfaceIdChange
);
366 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
367 DiscardDelegatedFrames
);
368 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
369 DiscardDelegatedFramesWithLocking
);
370 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, SoftwareDPIChange
);
371 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
372 UpdateCursorIfOverSelf
);
373 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraCopyRequestTest
,
374 DestroyedAfterCopyRequest
);
375 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
376 VisibleViewportTest
);
377 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
378 OverscrollResetsOnBlur
);
379 FRIEND_TEST_ALL_PREFIXES(WebContentsViewAuraTest
,
380 WebContentsViewReparent
);
382 class WindowObserver
;
383 friend class WindowObserver
;
385 void UpdateCursorIfOverSelf();
387 // Tracks whether SnapToPhysicalPixelBoundary() has been called.
388 bool has_snapped_to_boundary() { return has_snapped_to_boundary_
; }
389 void ResetHasSnappedToBoundary() { has_snapped_to_boundary_
= false; }
391 // Set the bounds of the window and handle size changes. Assumes the caller
392 // has already adjusted the origin of |rect| to conform to whatever coordinate
393 // space is required by the aura::Window.
394 void InternalSetBounds(const gfx::Rect
& rect
);
397 bool UsesNativeWindowFrame() const;
400 ui::InputMethod
* GetInputMethod() const;
402 // Returns whether the widget needs an input grab to work properly.
403 bool NeedsInputGrab();
405 // Confirm existing composition text in the webpage and ask the input method
406 // to cancel its ongoing composition session.
407 void FinishImeCompositionSession();
409 // This method computes movementX/Y and keeps track of mouse location for
410 // mouse lock on all mouse move events.
411 void ModifyEventMovementAndCoords(blink::WebMouseEvent
* event
);
413 // Sends an IPC to the renderer process to communicate whether or not
414 // the mouse cursor is visible anywhere on the screen.
415 void NotifyRendererOfCursorVisibilityState(bool is_visible
);
417 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty
418 // SchedulePaint() is invoked for |rect|.
419 void SchedulePaintIfNotInClip(const gfx::Rect
& rect
, const gfx::Rect
& clip
);
421 // Helper method to determine if, in mouse locked mode, the cursor should be
423 bool ShouldMoveToCenter();
425 // Called after |window_| is parented to a WindowEventDispatcher.
426 void AddedToRootWindow();
428 // Called prior to removing |window_| from a WindowEventDispatcher.
429 void RemovingFromRootWindow();
431 // DelegatedFrameHostClient implementation.
432 virtual ui::Compositor
* GetCompositor() const OVERRIDE
;
433 virtual ui::Layer
* GetLayer() OVERRIDE
;
434 virtual RenderWidgetHostImpl
* GetHost() OVERRIDE
;
435 virtual bool IsVisible() OVERRIDE
;
436 virtual scoped_ptr
<ResizeLock
> CreateResizeLock(
437 bool defer_compositor_lock
) OVERRIDE
;
438 virtual gfx::Size
DesiredFrameSize() OVERRIDE
;
439 virtual float CurrentDeviceScaleFactor() OVERRIDE
;
440 virtual gfx::Size
ConvertViewSizeToPixel(const gfx::Size
& size
) OVERRIDE
;
442 // Detaches |this| from the input method object.
443 void DetachFromInputMethod();
445 // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method
446 // calls our keybindings handler against the event and send matched
447 // edit commands to renderer instead.
448 void ForwardKeyboardEvent(const NativeWebKeyboardEvent
& event
);
450 // Dismisses a Web Popup on a mouse or touch press outside the popup and its
452 void ApplyEventFilterForPopupExit(ui::LocatedEvent
* event
);
454 // Converts |rect| from window coordinate to screen coordinate.
455 gfx::Rect
ConvertRectToScreen(const gfx::Rect
& rect
) const;
457 // Converts |rect| from screen coordinate to window coordinate.
458 gfx::Rect
ConvertRectFromScreen(const gfx::Rect
& rect
) const;
460 // Helper function to set keyboard focus to the main window.
461 void SetKeyboardFocus();
463 RenderFrameHostImpl
* GetFocusedFrame();
466 RenderWidgetHostImpl
* host_
;
468 aura::Window
* window_
;
470 scoped_ptr
<DelegatedFrameHost
> delegated_frame_host_
;
472 scoped_ptr
<WindowObserver
> window_observer_
;
474 // Are we in the process of closing? Tracked so fullscreen views can avoid
475 // sending a second shutdown request to the host when they lose the focus
476 // after requesting shutdown for another reason (e.g. Escape key).
479 // True if in the process of handling a window bounds changed notification.
480 bool in_bounds_changed_
;
482 // Is this a fullscreen view?
485 // Our parent host view, if this is a popup. NULL otherwise.
486 RenderWidgetHostViewAura
* popup_parent_host_view_
;
488 // Our child popup host. NULL if we do not have a child popup.
489 RenderWidgetHostViewAura
* popup_child_host_view_
;
491 class EventFilterForPopupExit
;
492 friend class EventFilterForPopupExit
;
493 scoped_ptr
<ui::EventHandler
> event_filter_for_popup_exit_
;
495 // True when content is being loaded. Used to show an hourglass cursor.
498 // The cursor for the page. This is passed up from the renderer.
499 WebCursor current_cursor_
;
501 // The touch-event. Its touch-points are updated as necessary. A new
502 // touch-point is added from an ET_TOUCH_PRESSED event, and a touch-point is
503 // removed from the list on an ET_TOUCH_RELEASED event.
504 blink::WebTouchEvent touch_event_
;
506 // The current text input type.
507 ui::TextInputType text_input_type_
;
508 // The current text input mode corresponding to HTML5 inputmode attribute.
509 ui::TextInputMode text_input_mode_
;
510 bool can_compose_inline_
;
512 // Rectangles for the selection anchor and focus.
513 gfx::Rect selection_anchor_rect_
;
514 gfx::Rect selection_focus_rect_
;
516 // The current composition character bounds.
517 std::vector
<gfx::Rect
> composition_character_bounds_
;
519 // Indicates if there is onging composition text.
520 bool has_composition_text_
;
522 // Whether return characters should be passed on to the RenderWidgetHostImpl.
523 bool accept_return_character_
;
525 // Current tooltip text.
526 base::string16 tooltip_
;
528 // The size and scale of the last software compositing frame that was swapped.
529 gfx::Size last_swapped_software_frame_size_
;
530 float last_swapped_software_frame_scale_factor_
;
532 // If non-NULL we're in OnPaint() and this is the supplied canvas.
533 gfx::Canvas
* paint_canvas_
;
535 // Used to record the last position of the mouse.
536 // While the mouse is locked, they store the last known position just as mouse
538 // Relative to the upper-left corner of the view.
539 gfx::Point unlocked_mouse_position_
;
540 // Relative to the upper-left corner of the screen.
541 gfx::Point unlocked_global_mouse_position_
;
542 // Last cursor position relative to screen. Used to compute movementX/Y.
543 gfx::Point global_mouse_position_
;
544 // In mouse locked mode, we syntheticaly move the mouse cursor to the center
545 // of the window when it reaches the window borders to avoid it going outside.
546 // This flag is used to differentiate between these synthetic mouse move
547 // events vs. normal mouse move events.
548 bool synthetic_move_sent_
;
550 // Used to track the state of the window we're created from. Only used when
551 // created fullscreen.
552 scoped_ptr
<aura::WindowTracker
> host_tracker_
;
554 // Used to track the last cursor visibility update that was sent to the
555 // renderer via NotifyRendererOfCursorVisibilityState().
556 enum CursorVisibilityState
{
561 CursorVisibilityState cursor_visibility_state_in_renderer_
;
564 // The list of rectangles from constrained windows over this view. Windowed
565 // NPAPI plugins shouldn't draw over them.
566 std::vector
<gfx::Rect
> constrained_rects_
;
568 typedef std::map
<HWND
, WebPluginGeometry
> PluginWindowMoves
;
569 // Contains information about each windowed plugin's clip and cutout rects (
570 // from the renderer). This is needed because when the transient windoiws
571 // over this view changes, we need this information in order to create a new
572 // region for the HWND.
573 PluginWindowMoves plugin_window_moves_
;
575 // The LegacyRenderWidgetHostHWND class provides a dummy HWND which is used
576 // for accessibility, as the container for windowless plugins like
577 // Flash/Silverlight, etc and for legacy drivers for trackpoints/trackpads,
579 // The LegacyRenderWidgetHostHWND instance is created during the first call
580 // to RenderWidgetHostViewAura::InternalSetBounds. The instance is destroyed
581 // when the LegacyRenderWidgetHostHWND hwnd is destroyed.
582 content::LegacyRenderWidgetHostHWND
* legacy_render_widget_host_HWND_
;
584 // Set to true if the legacy_render_widget_host_HWND_ instance was destroyed
585 // by Windows. This could happen if the browser window was destroyed by
586 // DestroyWindow for e.g. This flag helps ensure that we don't try to create
587 // the LegacyRenderWidgetHostHWND instance again as that would be a futile
589 bool legacy_window_destroyed_
;
592 bool has_snapped_to_boundary_
;
594 TouchEditingClient
* touch_editing_client_
;
596 scoped_ptr
<OverscrollController
> overscroll_controller_
;
600 std::vector
<ui::LatencyInfo
> software_latency_info_
;
602 scoped_ptr
<aura::client::ScopedTooltipDisabler
> tooltip_disabler_
;
604 base::WeakPtrFactory
<RenderWidgetHostViewAura
> weak_ptr_factory_
;
606 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura
);
609 } // namespace content
611 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_