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/base/touch/selection_bound.h"
33 #include "ui/base/touch/touch_editing_controller.h"
34 #include "ui/events/gestures/motion_event_aura.h"
35 #include "ui/gfx/display_observer.h"
36 #include "ui/gfx/geometry/insets.h"
37 #include "ui/gfx/geometry/rect.h"
38 #include "ui/wm/public/activation_delegate.h"
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::FocusChangeObserver
,
89 public aura::client::CursorClientObserver
{
91 // Displays and controls touch editing elements such as selection handles.
92 class TouchEditingClient
{
94 TouchEditingClient() {}
96 // Tells the client to start showing touch editing handles.
97 virtual void StartTouchEditing() = 0;
99 // Notifies the client that touch editing is no longer needed. |quick|
100 // determines whether the handles should fade out quickly or slowly.
101 virtual void EndTouchEditing(bool quick
) = 0;
103 // Notifies the client that the selection bounds need to be updated.
104 virtual void OnSelectionOrCursorChanged(
105 const ui::SelectionBound
& anchor
,
106 const ui::SelectionBound
& focus
) = 0;
108 // Notifies the client that the current text input type as changed.
109 virtual void OnTextInputTypeChanged(ui::TextInputType type
) = 0;
111 // Notifies the client that an input event is about to be sent to the
112 // renderer. Returns true if the client wants to stop event propagation.
113 virtual bool HandleInputEvent(const ui::Event
* event
) = 0;
115 // Notifies the client that a gesture event ack was received.
116 virtual void GestureEventAck(int gesture_event_type
) = 0;
118 // Notifies the client that the fling has ended, so it can activate touch
119 // editing if needed.
120 virtual void DidStopFlinging() = 0;
122 // This is called when the view is destroyed, so that the client can
123 // perform any necessary clean-up.
124 virtual void OnViewDestroyed() = 0;
127 virtual ~TouchEditingClient() {}
130 void set_touch_editing_client(TouchEditingClient
* client
) {
131 touch_editing_client_
= client
;
134 // When |is_guest_view_hack| is true, this view isn't really the view for
135 // the |widget|, a RenderWidgetHostViewGuest is.
137 // TODO(lazyboy): Remove |is_guest_view_hack| once BrowserPlugin has migrated
138 // to use RWHVChildFrame (http://crbug.com/330264).
139 RenderWidgetHostViewAura(RenderWidgetHost
* host
, bool is_guest_view_hack
);
141 // RenderWidgetHostView implementation.
142 bool OnMessageReceived(const IPC::Message
& msg
) override
;
143 void InitAsChild(gfx::NativeView parent_view
) override
;
144 RenderWidgetHost
* GetRenderWidgetHost() const override
;
145 void SetSize(const gfx::Size
& size
) override
;
146 void SetBounds(const gfx::Rect
& rect
) override
;
147 gfx::Vector2dF
GetLastScrollOffset() const override
;
148 gfx::NativeView
GetNativeView() const override
;
149 gfx::NativeViewId
GetNativeViewId() const override
;
150 gfx::NativeViewAccessible
GetNativeViewAccessible() override
;
151 ui::TextInputClient
* GetTextInputClient() override
;
152 bool HasFocus() const override
;
153 bool IsSurfaceAvailableForCopy() const override
;
154 void Show() override
;
155 void Hide() override
;
156 bool IsShowing() override
;
157 gfx::Rect
GetViewBounds() const override
;
158 void SetBackgroundColor(SkColor color
) override
;
159 gfx::Size
GetVisibleViewportSize() const override
;
160 void SetInsets(const gfx::Insets
& insets
) override
;
162 // Overridden from RenderWidgetHostViewBase:
163 void InitAsPopup(RenderWidgetHostView
* parent_host_view
,
164 const gfx::Rect
& pos
) override
;
165 void InitAsFullscreen(RenderWidgetHostView
* reference_host_view
) override
;
166 void MovePluginWindows(const std::vector
<WebPluginGeometry
>& moves
) override
;
167 void Focus() override
;
168 void Blur() override
;
169 void UpdateCursor(const WebCursor
& cursor
) override
;
170 void SetIsLoading(bool is_loading
) override
;
171 void TextInputTypeChanged(ui::TextInputType type
,
172 ui::TextInputMode input_mode
,
173 bool can_compose_inline
,
175 void ImeCancelComposition() override
;
176 void ImeCompositionRangeChanged(
177 const gfx::Range
& range
,
178 const std::vector
<gfx::Rect
>& character_bounds
) override
;
179 void RenderProcessGone(base::TerminationStatus status
,
180 int error_code
) override
;
181 void Destroy() override
;
182 void SetTooltipText(const base::string16
& tooltip_text
) override
;
183 void SelectionChanged(const base::string16
& text
,
185 const gfx::Range
& range
) override
;
186 gfx::Size
GetRequestedRendererSize() const override
;
187 void SelectionBoundsChanged(
188 const ViewHostMsg_SelectionBounds_Params
& params
) override
;
189 void CopyFromCompositingSurface(const gfx::Rect
& src_subrect
,
190 const gfx::Size
& dst_size
,
191 ReadbackRequestCallback
& callback
,
192 const SkColorType color_type
) override
;
193 void CopyFromCompositingSurfaceToVideoFrame(
194 const gfx::Rect
& src_subrect
,
195 const scoped_refptr
<media::VideoFrame
>& target
,
196 const base::Callback
<void(bool)>& callback
) override
;
197 bool CanCopyToVideoFrame() const override
;
198 bool CanSubscribeFrame() const override
;
199 void BeginFrameSubscription(
200 scoped_ptr
<RenderWidgetHostViewFrameSubscriber
> subscriber
) override
;
201 void EndFrameSubscription() override
;
202 bool HasAcceleratedSurface(const gfx::Size
& desired_size
) override
;
203 void GetScreenInfo(blink::WebScreenInfo
* results
) override
;
204 gfx::Rect
GetBoundsInRootWindow() override
;
205 void WheelEventAck(const blink::WebMouseWheelEvent
& event
,
206 InputEventAckState ack_result
) override
;
207 void GestureEventAck(const blink::WebGestureEvent
& event
,
208 InputEventAckState ack_result
) override
;
209 void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo
& touch
,
210 InputEventAckState ack_result
) override
;
211 scoped_ptr
<SyntheticGestureTarget
> CreateSyntheticGestureTarget() override
;
212 InputEventAckState
FilterInputEvent(
213 const blink::WebInputEvent
& input_event
) override
;
214 gfx::GLSurfaceHandle
GetCompositingSurface() override
;
215 BrowserAccessibilityManager
* CreateBrowserAccessibilityManager(
216 BrowserAccessibilityDelegate
* delegate
) override
;
217 gfx::AcceleratedWidget
AccessibilityGetAcceleratedWidget() override
;
218 gfx::NativeViewAccessible
AccessibilityGetNativeViewAccessible() override
;
219 void ShowDisambiguationPopup(const gfx::Rect
& rect_pixels
,
220 const SkBitmap
& zoomed_bitmap
) override
;
221 bool LockMouse() override
;
222 void UnlockMouse() override
;
223 void OnSwapCompositorFrame(uint32 output_surface_id
,
224 scoped_ptr
<cc::CompositorFrame
> frame
) override
;
225 void DidStopFlinging() override
;
226 void OnDidNavigateMainFrameToNewPage() override
;
229 virtual void SetParentNativeViewAccessible(
230 gfx::NativeViewAccessible accessible_parent
) override
;
231 virtual gfx::NativeViewId
GetParentForWindowlessPlugin() const override
;
234 // Overridden from ui::TextInputClient:
235 void SetCompositionText(const ui::CompositionText
& composition
) override
;
236 void ConfirmCompositionText() override
;
237 void ClearCompositionText() override
;
238 void InsertText(const base::string16
& text
) override
;
239 void InsertChar(base::char16 ch
, int flags
) override
;
240 gfx::NativeWindow
GetAttachedWindow() const override
;
241 ui::TextInputType
GetTextInputType() const override
;
242 ui::TextInputMode
GetTextInputMode() const override
;
243 int GetTextInputFlags() const override
;
244 bool CanComposeInline() const override
;
245 gfx::Rect
GetCaretBounds() const override
;
246 bool GetCompositionCharacterBounds(uint32 index
,
247 gfx::Rect
* rect
) const override
;
248 bool HasCompositionText() const override
;
249 bool GetTextRange(gfx::Range
* range
) const override
;
250 bool GetCompositionTextRange(gfx::Range
* range
) const override
;
251 bool GetSelectionRange(gfx::Range
* range
) const override
;
252 bool SetSelectionRange(const gfx::Range
& range
) override
;
253 bool DeleteRange(const gfx::Range
& range
) override
;
254 bool GetTextFromRange(const gfx::Range
& range
,
255 base::string16
* text
) const override
;
256 void OnInputMethodChanged() override
;
257 bool ChangeTextDirectionAndLayoutAlignment(
258 base::i18n::TextDirection direction
) override
;
259 void ExtendSelectionAndDelete(size_t before
, size_t after
) override
;
260 void EnsureCaretInRect(const gfx::Rect
& rect
) override
;
261 void OnCandidateWindowShown() override
;
262 void OnCandidateWindowUpdated() override
;
263 void OnCandidateWindowHidden() override
;
264 bool IsEditCommandEnabled(int command_id
) override
;
265 void SetEditCommandForNextKeyEvent(int command_id
) override
;
267 // Overridden from gfx::DisplayObserver:
268 void OnDisplayAdded(const gfx::Display
& new_display
) override
;
269 void OnDisplayRemoved(const gfx::Display
& old_display
) override
;
270 void OnDisplayMetricsChanged(const gfx::Display
& display
,
271 uint32_t metrics
) override
;
273 // Overridden from aura::WindowDelegate:
274 gfx::Size
GetMinimumSize() const override
;
275 gfx::Size
GetMaximumSize() const override
;
276 void OnBoundsChanged(const gfx::Rect
& old_bounds
,
277 const gfx::Rect
& new_bounds
) override
;
278 ui::TextInputClient
* GetFocusedTextInputClient() override
;
279 gfx::NativeCursor
GetCursor(const gfx::Point
& point
) override
;
280 int GetNonClientComponent(const gfx::Point
& point
) const override
;
281 bool ShouldDescendIntoChildForEventHandling(
283 const gfx::Point
& location
) override
;
284 bool CanFocus() override
;
285 void OnCaptureLost() override
;
286 void OnPaint(const ui::PaintContext
& context
) override
;
287 void OnDeviceScaleFactorChanged(float device_scale_factor
) override
;
288 void OnWindowDestroying(aura::Window
* window
) override
;
289 void OnWindowDestroyed(aura::Window
* window
) override
;
290 void OnWindowTargetVisibilityChanged(bool visible
) override
;
291 bool HasHitTestMask() const override
;
292 void GetHitTestMask(gfx::Path
* mask
) const override
;
294 // Overridden from ui::EventHandler:
295 void OnKeyEvent(ui::KeyEvent
* event
) override
;
296 void OnMouseEvent(ui::MouseEvent
* event
) override
;
297 void OnScrollEvent(ui::ScrollEvent
* event
) override
;
298 void OnTouchEvent(ui::TouchEvent
* event
) override
;
299 void OnGestureEvent(ui::GestureEvent
* event
) override
;
301 // Overridden from aura::client::ActivationDelegate:
302 bool ShouldActivate() const override
;
304 // Overridden from aura::client::CursorClientObserver:
305 void OnCursorVisibilityChanged(bool is_visible
) override
;
307 // Overridden from aura::client::FocusChangeObserver:
308 void OnWindowFocused(aura::Window
* gained_focus
,
309 aura::Window
* lost_focus
) override
;
311 // Overridden from aura::WindowTreeHostObserver:
312 void OnHostMoved(const aura::WindowTreeHost
* host
,
313 const gfx::Point
& new_origin
) override
;
315 void OnTextInputStateChanged(const ViewHostMsg_TextInputState_Params
& params
);
318 // Sets the cutout rects from constrained windows. These are rectangles that
319 // windowed NPAPI plugins shouldn't paint in. Overwrites any previous cutout
321 void UpdateConstrainedWindowRects(const std::vector
<gfx::Rect
>& rects
);
323 // Updates the cursor clip region. Used for mouse locking.
324 void UpdateMouseLockRegion();
326 // Notification that the LegacyRenderWidgetHostHWND was destroyed.
327 void OnLegacyWindowDestroyed();
330 void DisambiguationPopupRendered(const SkBitmap
& result
,
331 ReadbackResponse response
);
333 void HideDisambiguationPopup();
335 void ProcessDisambiguationGesture(ui::GestureEvent
* event
);
337 void ProcessDisambiguationMouse(ui::MouseEvent
* event
);
339 // Method to indicate if this instance is shutting down or closing.
340 // TODO(shrikant): Discuss around to see if it makes sense to add this method
341 // as part of RenderWidgetHostView.
342 bool IsClosing() const { return in_shutdown_
; }
344 // Sets whether the overscroll controller should be enabled for this page.
345 void SetOverscrollControllerEnabled(bool enabled
);
347 void SnapToPhysicalPixelBoundary();
349 OverscrollController
* overscroll_controller() const {
350 return overscroll_controller_
.get();
353 // Called when the context menu is about to be displayed.
354 void OnShowContextMenu();
357 ~RenderWidgetHostViewAura() override
;
359 // Exposed for tests.
360 aura::Window
* window() { return window_
; }
361 SkColorType
PreferredReadbackFormat() override
;
362 DelegatedFrameHost
* GetDelegatedFrameHost() const {
363 return delegated_frame_host_
.get();
365 const ui::MotionEventAura
& pointer_state() const { return pointer_state_
; }
368 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
369 PopupRetainsCaptureAfterMouseRelease
);
370 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, SetCompositionText
);
371 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, TouchEventState
);
372 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
373 TouchEventPositionsArentRounded
);
374 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, TouchEventSyncAsync
);
375 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, Resize
);
376 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, SwapNotifiesWindow
);
377 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, RecreateLayers
);
378 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
379 SkippedDelegatedFrames
);
380 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, OutputSurfaceIdChange
);
381 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
382 DiscardDelegatedFrames
);
383 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
384 DiscardDelegatedFramesWithLocking
);
385 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
, SoftwareDPIChange
);
386 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
387 UpdateCursorIfOverSelf
);
388 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraCopyRequestTest
,
389 DedupeFrameSubscriberRequests
);
390 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraCopyRequestTest
,
391 DestroyedAfterCopyRequest
);
392 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
393 VisibleViewportTest
);
394 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
395 OverscrollResetsOnBlur
);
396 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest
,
397 FinishCompositionByMouse
);
398 FRIEND_TEST_ALL_PREFIXES(WebContentsViewAuraTest
,
399 WebContentsViewReparent
);
401 class WindowObserver
;
402 friend class WindowObserver
;
404 void UpdateCursorIfOverSelf();
406 // Tracks whether SnapToPhysicalPixelBoundary() has been called.
407 bool has_snapped_to_boundary() { return has_snapped_to_boundary_
; }
408 void ResetHasSnappedToBoundary() { has_snapped_to_boundary_
= false; }
410 // Set the bounds of the window and handle size changes. Assumes the caller
411 // has already adjusted the origin of |rect| to conform to whatever coordinate
412 // space is required by the aura::Window.
413 void InternalSetBounds(const gfx::Rect
& rect
);
416 bool UsesNativeWindowFrame() const;
419 ui::InputMethod
* GetInputMethod() const;
421 // Sends shutdown request.
424 // Returns whether the widget needs an input grab to work properly.
425 bool NeedsInputGrab();
427 // Returns whether the widget needs to grab mouse capture to work properly.
428 bool NeedsMouseCapture();
430 // Confirm existing composition text in the webpage and ask the input method
431 // to cancel its ongoing composition session.
432 void FinishImeCompositionSession();
434 // This method computes movementX/Y and keeps track of mouse location for
435 // mouse lock on all mouse move events.
436 void ModifyEventMovementAndCoords(blink::WebMouseEvent
* event
);
438 // Sends an IPC to the renderer process to communicate whether or not
439 // the mouse cursor is visible anywhere on the screen.
440 void NotifyRendererOfCursorVisibilityState(bool is_visible
);
442 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty
443 // SchedulePaint() is invoked for |rect|.
444 void SchedulePaintIfNotInClip(const gfx::Rect
& rect
, const gfx::Rect
& clip
);
446 // Helper method to determine if, in mouse locked mode, the cursor should be
448 bool ShouldMoveToCenter();
450 // Called after |window_| is parented to a WindowEventDispatcher.
451 void AddedToRootWindow();
453 // Called prior to removing |window_| from a WindowEventDispatcher.
454 void RemovingFromRootWindow();
456 // DelegatedFrameHostClient implementation.
457 ui::Layer
* DelegatedFrameHostGetLayer() const override
;
458 bool DelegatedFrameHostIsVisible() const override
;
459 gfx::Size
DelegatedFrameHostDesiredSizeInDIP() const override
;
460 bool DelegatedFrameCanCreateResizeLock() const override
;
461 scoped_ptr
<ResizeLock
> DelegatedFrameHostCreateResizeLock(
462 bool defer_compositor_lock
) override
;
463 void DelegatedFrameHostResizeLockWasReleased() override
;
464 void DelegatedFrameHostSendCompositorSwapAck(
465 int output_surface_id
,
466 const cc::CompositorFrameAck
& ack
) override
;
467 void DelegatedFrameHostSendReclaimCompositorResources(
468 int output_surface_id
,
469 const cc::CompositorFrameAck
& ack
) override
;
470 void DelegatedFrameHostOnLostCompositorResources() override
;
471 void DelegatedFrameHostUpdateVSyncParameters(
472 const base::TimeTicks
& timebase
,
473 const base::TimeDelta
& interval
) override
;
475 // Detaches |this| from the input method object.
476 void DetachFromInputMethod();
478 // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method
479 // calls our keybindings handler against the event and send matched
480 // edit commands to renderer instead.
481 void ForwardKeyboardEvent(const NativeWebKeyboardEvent
& event
);
483 // Dismisses a Web Popup on a mouse or touch press outside the popup and its
485 void ApplyEventFilterForPopupExit(ui::LocatedEvent
* event
);
487 // Converts |rect| from window coordinate to screen coordinate.
488 gfx::Rect
ConvertRectToScreen(const gfx::Rect
& rect
) const;
490 // Converts |rect| from screen coordinate to window coordinate.
491 gfx::Rect
ConvertRectFromScreen(const gfx::Rect
& rect
) const;
493 // Helper function to set keyboard focus to the main window.
494 void SetKeyboardFocus();
496 RenderFrameHostImpl
* GetFocusedFrame();
498 // Returns true if the |event| passed in can be forwarded to the renderer.
499 bool CanRendererHandleEvent(const ui::MouseEvent
* event
,
501 bool selection_popup
);
504 RenderWidgetHostImpl
* host_
;
506 aura::Window
* window_
;
508 scoped_ptr
<DelegatedFrameHost
> delegated_frame_host_
;
510 scoped_ptr
<WindowObserver
> window_observer_
;
512 // Are we in the process of closing? Tracked so fullscreen views can avoid
513 // sending a second shutdown request to the host when they lose the focus
514 // after requesting shutdown for another reason (e.g. Escape key).
517 // True if in the process of handling a window bounds changed notification.
518 bool in_bounds_changed_
;
520 // Is this a fullscreen view?
523 // Our parent host view, if this is a popup. NULL otherwise.
524 RenderWidgetHostViewAura
* popup_parent_host_view_
;
526 // Our child popup host. NULL if we do not have a child popup.
527 RenderWidgetHostViewAura
* popup_child_host_view_
;
529 class EventFilterForPopupExit
;
530 friend class EventFilterForPopupExit
;
531 scoped_ptr
<ui::EventHandler
> event_filter_for_popup_exit_
;
533 // True when content is being loaded. Used to show an hourglass cursor.
536 // The cursor for the page. This is passed up from the renderer.
537 WebCursor current_cursor_
;
539 // Stores the current state of the active pointers targeting this
541 ui::MotionEventAura pointer_state_
;
543 // The current text input type.
544 ui::TextInputType text_input_type_
;
545 // The current text input mode corresponding to HTML5 inputmode attribute.
546 ui::TextInputMode text_input_mode_
;
547 // The current text input flags.
548 int text_input_flags_
;
549 bool can_compose_inline_
;
551 // Bounds for the selection.
552 ui::SelectionBound selection_anchor_
;
553 ui::SelectionBound selection_focus_
;
555 // The current composition character bounds.
556 std::vector
<gfx::Rect
> composition_character_bounds_
;
558 // Indicates if there is onging composition text.
559 bool has_composition_text_
;
561 // Whether return characters should be passed on to the RenderWidgetHostImpl.
562 bool accept_return_character_
;
564 // Current tooltip text.
565 base::string16 tooltip_
;
567 // The size and scale of the last software compositing frame that was swapped.
568 gfx::Size last_swapped_software_frame_size_
;
569 float last_swapped_software_frame_scale_factor_
;
571 // If non-NULL we're in OnPaint() and this is the supplied canvas.
572 gfx::Canvas
* paint_canvas_
;
574 // Used to record the last position of the mouse.
575 // While the mouse is locked, they store the last known position just as mouse
577 // Relative to the upper-left corner of the view.
578 gfx::Point unlocked_mouse_position_
;
579 // Relative to the upper-left corner of the screen.
580 gfx::Point unlocked_global_mouse_position_
;
581 // Last cursor position relative to screen. Used to compute movementX/Y.
582 gfx::Point global_mouse_position_
;
583 // In mouse locked mode, we synthetically move the mouse cursor to the center
584 // of the window when it reaches the window borders to avoid it going outside.
585 // This flag is used to differentiate between these synthetic mouse move
586 // events vs. normal mouse move events.
587 bool synthetic_move_sent_
;
589 // Used to track the state of the window we're created from. Only used when
590 // created fullscreen.
591 scoped_ptr
<aura::WindowTracker
> host_tracker_
;
593 // Used to track the last cursor visibility update that was sent to the
594 // renderer via NotifyRendererOfCursorVisibilityState().
595 enum CursorVisibilityState
{
600 CursorVisibilityState cursor_visibility_state_in_renderer_
;
603 // The list of rectangles from constrained windows over this view. Windowed
604 // NPAPI plugins shouldn't draw over them.
605 std::vector
<gfx::Rect
> constrained_rects_
;
607 typedef std::map
<HWND
, WebPluginGeometry
> PluginWindowMoves
;
608 // Contains information about each windowed plugin's clip and cutout rects (
609 // from the renderer). This is needed because when the transient windows
610 // over this view changes, we need this information in order to create a new
611 // region for the HWND.
612 PluginWindowMoves plugin_window_moves_
;
614 // The LegacyRenderWidgetHostHWND class provides a dummy HWND which is used
615 // for accessibility, as the container for windowless plugins like
616 // Flash/Silverlight, etc and for legacy drivers for trackpoints/trackpads,
618 // The LegacyRenderWidgetHostHWND instance is created during the first call
619 // to RenderWidgetHostViewAura::InternalSetBounds. The instance is destroyed
620 // when the LegacyRenderWidgetHostHWND hwnd is destroyed.
621 content::LegacyRenderWidgetHostHWND
* legacy_render_widget_host_HWND_
;
623 // Set to true if the legacy_render_widget_host_HWND_ instance was destroyed
624 // by Windows. This could happen if the browser window was destroyed by
625 // DestroyWindow for e.g. This flag helps ensure that we don't try to create
626 // the LegacyRenderWidgetHostHWND instance again as that would be a futile
628 bool legacy_window_destroyed_
;
630 // Set to true when a context menu is being displayed. Reset to false when
631 // a mouse leave is received in this context.
632 bool showing_context_menu_
;
635 bool has_snapped_to_boundary_
;
637 TouchEditingClient
* touch_editing_client_
;
639 scoped_ptr
<OverscrollController
> overscroll_controller_
;
641 // The last scroll offset of the view.
642 gfx::Vector2dF last_scroll_offset_
;
646 std::vector
<ui::LatencyInfo
> software_latency_info_
;
648 scoped_ptr
<aura::client::ScopedTooltipDisabler
> tooltip_disabler_
;
650 // True when this view acts as a platform view hack for a
651 // RenderWidgetHostViewGuest.
652 bool is_guest_view_hack_
;
654 gfx::Rect disambiguation_target_rect_
;
656 // The last scroll offset when we start to render the link disambiguation
657 // view, so we can ensure the window hasn't moved between copying from the
658 // compositing surface and showing the disambiguation popup.
659 gfx::Vector2dF disambiguation_scroll_offset_
;
661 base::WeakPtrFactory
<RenderWidgetHostViewAura
> weak_ptr_factory_
;
662 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura
);
665 } // namespace content
667 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_