Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / browser / renderer_host / render_widget_host_view_aura.h
blob4df0fe3aa95445b9e839a4e516f81304c11e4da7
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_
8 #include <map>
9 #include <set>
10 #include <string>
11 #include <vector>
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/begin_frame_observer_proxy.h"
24 #include "content/browser/renderer_host/render_widget_host_view_base.h"
25 #include "content/common/content_export.h"
26 #include "content/common/cursors/webcursor.h"
27 #include "third_party/skia/include/core/SkRegion.h"
28 #include "ui/aura/client/cursor_client_observer.h"
29 #include "ui/aura/client/focus_change_observer.h"
30 #include "ui/aura/window_delegate.h"
31 #include "ui/aura/window_tree_host_observer.h"
32 #include "ui/base/ime/text_input_client.h"
33 #include "ui/base/touch/selection_bound.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"
40 struct ViewHostMsg_TextInputState_Params;
42 namespace aura {
43 class WindowTracker;
44 namespace client {
45 class ScopedTooltipDisabler;
49 namespace cc {
50 class CopyOutputRequest;
51 class CopyOutputResult;
52 class DelegatedFrameData;
55 namespace gfx {
56 class Canvas;
57 class Display;
60 namespace gpu {
61 struct Mailbox;
64 namespace ui {
65 class CompositorLock;
66 class InputMethod;
67 class LocatedEvent;
68 class Texture;
69 class TouchSelectionController;
72 namespace content {
73 #if defined(OS_WIN)
74 class LegacyRenderWidgetHostHWND;
75 #endif
77 class OverscrollController;
78 class RenderFrameHostImpl;
79 class RenderWidgetHostImpl;
80 class RenderWidgetHostView;
81 class TouchSelectionControllerClientAura;
83 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
84 class CONTENT_EXPORT RenderWidgetHostViewAura
85 : public RenderWidgetHostViewBase,
86 public DelegatedFrameHostClient,
87 public BeginFrameObserverProxyClient,
88 public ui::TextInputClient,
89 public gfx::DisplayObserver,
90 public aura::WindowTreeHostObserver,
91 public aura::WindowDelegate,
92 public aura::client::ActivationDelegate,
93 public aura::client::FocusChangeObserver,
94 public aura::client::CursorClientObserver {
95 public:
96 // When |is_guest_view_hack| is true, this view isn't really the view for
97 // the |widget|, a RenderWidgetHostViewGuest is.
99 // TODO(lazyboy): Remove |is_guest_view_hack| once BrowserPlugin has migrated
100 // to use RWHVChildFrame (http://crbug.com/330264).
101 RenderWidgetHostViewAura(RenderWidgetHost* host, bool is_guest_view_hack);
103 // RenderWidgetHostView implementation.
104 bool OnMessageReceived(const IPC::Message& msg) override;
105 void InitAsChild(gfx::NativeView parent_view) override;
106 RenderWidgetHost* GetRenderWidgetHost() const override;
107 void SetSize(const gfx::Size& size) override;
108 void SetBounds(const gfx::Rect& rect) override;
109 gfx::Vector2dF GetLastScrollOffset() const override;
110 gfx::NativeView GetNativeView() const override;
111 gfx::NativeViewId GetNativeViewId() const override;
112 gfx::NativeViewAccessible GetNativeViewAccessible() override;
113 ui::TextInputClient* GetTextInputClient() override;
114 bool HasFocus() const override;
115 bool IsSurfaceAvailableForCopy() const override;
116 void Show() override;
117 void Hide() override;
118 bool IsShowing() override;
119 gfx::Rect GetViewBounds() const override;
120 void SetBackgroundColor(SkColor color) override;
121 gfx::Size GetVisibleViewportSize() const override;
122 void SetInsets(const gfx::Insets& insets) override;
124 // Overridden from RenderWidgetHostViewBase:
125 void InitAsPopup(RenderWidgetHostView* parent_host_view,
126 const gfx::Rect& pos) override;
127 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override;
128 void MovePluginWindows(const std::vector<WebPluginGeometry>& moves) override;
129 void Focus() override;
130 void UpdateCursor(const WebCursor& cursor) override;
131 void SetIsLoading(bool is_loading) override;
132 void TextInputStateChanged(
133 const ViewHostMsg_TextInputState_Params& params) override;
134 void ImeCancelComposition() override;
135 void ImeCompositionRangeChanged(
136 const gfx::Range& range,
137 const std::vector<gfx::Rect>& character_bounds) override;
138 void RenderProcessGone(base::TerminationStatus status,
139 int error_code) override;
140 void Destroy() override;
141 void SetTooltipText(const base::string16& tooltip_text) override;
142 void SelectionChanged(const base::string16& text,
143 size_t offset,
144 const gfx::Range& range) override;
145 gfx::Size GetRequestedRendererSize() const override;
146 void SelectionBoundsChanged(
147 const ViewHostMsg_SelectionBounds_Params& params) override;
148 void CopyFromCompositingSurface(
149 const gfx::Rect& src_subrect,
150 const gfx::Size& dst_size,
151 ReadbackRequestCallback& callback,
152 const SkColorType preferred_color_type) override;
153 void CopyFromCompositingSurfaceToVideoFrame(
154 const gfx::Rect& src_subrect,
155 const scoped_refptr<media::VideoFrame>& target,
156 const base::Callback<void(bool)>& callback) override;
157 bool CanCopyToVideoFrame() const override;
158 bool CanSubscribeFrame() const override;
159 void BeginFrameSubscription(
160 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) override;
161 void EndFrameSubscription() override;
162 bool HasAcceleratedSurface(const gfx::Size& desired_size) override;
163 void GetScreenInfo(blink::WebScreenInfo* results) override;
164 bool GetScreenColorProfile(std::vector<char>* color_profile) override;
165 gfx::Rect GetBoundsInRootWindow() override;
166 void WheelEventAck(const blink::WebMouseWheelEvent& event,
167 InputEventAckState ack_result) override;
168 void GestureEventAck(const blink::WebGestureEvent& event,
169 InputEventAckState ack_result) override;
170 void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch,
171 InputEventAckState ack_result) override;
172 scoped_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget() override;
173 InputEventAckState FilterInputEvent(
174 const blink::WebInputEvent& input_event) override;
175 gfx::GLSurfaceHandle GetCompositingSurface() override;
176 BrowserAccessibilityManager* CreateBrowserAccessibilityManager(
177 BrowserAccessibilityDelegate* delegate) override;
178 gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() override;
179 gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() override;
180 void ShowDisambiguationPopup(const gfx::Rect& rect_pixels,
181 const SkBitmap& zoomed_bitmap) override;
182 bool LockMouse() override;
183 void UnlockMouse() override;
184 void OnSwapCompositorFrame(uint32 output_surface_id,
185 scoped_ptr<cc::CompositorFrame> frame) override;
186 void ClearCompositorFrame() override;
187 void DidStopFlinging() override;
188 void OnDidNavigateMainFrameToNewPage() override;
189 uint32_t GetSurfaceIdNamespace() override;
190 uint32_t SurfaceIdNamespaceAtPoint(const gfx::Point& point,
191 gfx::Point* transformed_point) override;
192 void ProcessMouseEvent(const blink::WebMouseEvent& event) override;
193 void ProcessMouseWheelEvent(const blink::WebMouseWheelEvent& event) override;
195 #if defined(OS_WIN)
196 void SetParentNativeViewAccessible(
197 gfx::NativeViewAccessible accessible_parent) override;
198 gfx::NativeViewId GetParentForWindowlessPlugin() const override;
199 #endif
201 // Overridden from ui::TextInputClient:
202 void SetCompositionText(const ui::CompositionText& composition) override;
203 void ConfirmCompositionText() override;
204 void ClearCompositionText() override;
205 void InsertText(const base::string16& text) override;
206 void InsertChar(base::char16 ch, int flags) override;
207 ui::TextInputType GetTextInputType() const override;
208 ui::TextInputMode GetTextInputMode() const override;
209 int GetTextInputFlags() const override;
210 bool CanComposeInline() const override;
211 gfx::Rect GetCaretBounds() const override;
212 bool GetCompositionCharacterBounds(uint32 index,
213 gfx::Rect* rect) const override;
214 bool HasCompositionText() const override;
215 bool GetTextRange(gfx::Range* range) const override;
216 bool GetCompositionTextRange(gfx::Range* range) const override;
217 bool GetSelectionRange(gfx::Range* range) const override;
218 bool SetSelectionRange(const gfx::Range& range) override;
219 bool DeleteRange(const gfx::Range& range) override;
220 bool GetTextFromRange(const gfx::Range& range,
221 base::string16* text) const override;
222 void OnInputMethodChanged() override;
223 bool ChangeTextDirectionAndLayoutAlignment(
224 base::i18n::TextDirection direction) override;
225 void ExtendSelectionAndDelete(size_t before, size_t after) override;
226 void EnsureCaretInRect(const gfx::Rect& rect) override;
227 bool IsEditCommandEnabled(int command_id) override;
228 void SetEditCommandForNextKeyEvent(int command_id) override;
230 // Overridden from gfx::DisplayObserver:
231 void OnDisplayAdded(const gfx::Display& new_display) override;
232 void OnDisplayRemoved(const gfx::Display& old_display) override;
233 void OnDisplayMetricsChanged(const gfx::Display& display,
234 uint32_t metrics) override;
236 // Overridden from aura::WindowDelegate:
237 gfx::Size GetMinimumSize() const override;
238 gfx::Size GetMaximumSize() const override;
239 void OnBoundsChanged(const gfx::Rect& old_bounds,
240 const gfx::Rect& new_bounds) override;
241 gfx::NativeCursor GetCursor(const gfx::Point& point) override;
242 int GetNonClientComponent(const gfx::Point& point) const override;
243 bool ShouldDescendIntoChildForEventHandling(
244 aura::Window* child,
245 const gfx::Point& location) override;
246 bool CanFocus() override;
247 void OnCaptureLost() override;
248 void OnPaint(const ui::PaintContext& context) override;
249 void OnDeviceScaleFactorChanged(float device_scale_factor) override;
250 void OnWindowDestroying(aura::Window* window) override;
251 void OnWindowDestroyed(aura::Window* window) override;
252 void OnWindowTargetVisibilityChanged(bool visible) override;
253 bool HasHitTestMask() const override;
254 void GetHitTestMask(gfx::Path* mask) const override;
256 // Overridden from ui::EventHandler:
257 void OnKeyEvent(ui::KeyEvent* event) override;
258 void OnMouseEvent(ui::MouseEvent* event) override;
259 void OnScrollEvent(ui::ScrollEvent* event) override;
260 void OnTouchEvent(ui::TouchEvent* event) override;
261 void OnGestureEvent(ui::GestureEvent* event) override;
263 // Overridden from aura::client::ActivationDelegate:
264 bool ShouldActivate() const override;
266 // Overridden from aura::client::CursorClientObserver:
267 void OnCursorVisibilityChanged(bool is_visible) override;
269 // Overridden from aura::client::FocusChangeObserver:
270 void OnWindowFocused(aura::Window* gained_focus,
271 aura::Window* lost_focus) override;
273 // Overridden from aura::WindowTreeHostObserver:
274 void OnHostMoved(const aura::WindowTreeHost* host,
275 const gfx::Point& new_origin) override;
277 #if defined(OS_WIN)
278 // Sets the cutout rects from constrained windows. These are rectangles that
279 // windowed NPAPI plugins shouldn't paint in. Overwrites any previous cutout
280 // rects.
281 void UpdateConstrainedWindowRects(const std::vector<gfx::Rect>& rects);
283 // Updates the cursor clip region. Used for mouse locking.
284 void UpdateMouseLockRegion();
286 // Notification that the LegacyRenderWidgetHostHWND was destroyed.
287 void OnLegacyWindowDestroyed();
288 #endif
290 void DisambiguationPopupRendered(const SkBitmap& result,
291 ReadbackResponse response);
293 void HideDisambiguationPopup();
295 void ProcessDisambiguationGesture(ui::GestureEvent* event);
297 void ProcessDisambiguationMouse(ui::MouseEvent* event);
299 // Method to indicate if this instance is shutting down or closing.
300 // TODO(shrikant): Discuss around to see if it makes sense to add this method
301 // as part of RenderWidgetHostView.
302 bool IsClosing() const { return in_shutdown_; }
304 // Sets whether the overscroll controller should be enabled for this page.
305 void SetOverscrollControllerEnabled(bool enabled);
307 void SnapToPhysicalPixelBoundary();
309 ui::TouchSelectionController* selection_controller() const {
310 return selection_controller_.get();
313 TouchSelectionControllerClientAura* selection_controller_client() const {
314 return selection_controller_client_.get();
317 OverscrollController* overscroll_controller() const {
318 return overscroll_controller_.get();
321 // Called when the context menu is about to be displayed.
322 void OnShowContextMenu();
324 // Used in tests to set a mock client for touch selection controller. It will
325 // create a new touch selection controller for the new client.
326 void SetSelectionControllerClientForTest(
327 scoped_ptr<TouchSelectionControllerClientAura> client);
329 protected:
330 ~RenderWidgetHostViewAura() override;
332 // Exposed for tests.
333 aura::Window* window() { return window_; }
335 DelegatedFrameHost* GetDelegatedFrameHost() const {
336 return delegated_frame_host_.get();
338 const ui::MotionEventAura& pointer_state() const { return pointer_state_; }
340 private:
341 friend class RenderWidgetHostViewAuraCopyRequestTest;
342 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
343 PopupRetainsCaptureAfterMouseRelease);
344 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText);
345 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState);
346 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
347 TouchEventPositionsArentRounded);
348 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventSyncAsync);
349 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, Resize);
350 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SwapNotifiesWindow);
351 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, RecreateLayers);
352 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
353 SkippedDelegatedFrames);
354 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, OutputSurfaceIdChange);
355 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
356 DiscardDelegatedFrames);
357 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
358 DiscardDelegatedFramesWithLocking);
359 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SoftwareDPIChange);
360 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
361 UpdateCursorIfOverSelf);
362 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
363 VisibleViewportTest);
364 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
365 OverscrollResetsOnBlur);
366 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
367 FinishCompositionByMouse);
368 FRIEND_TEST_ALL_PREFIXES(WebContentsViewAuraTest,
369 WebContentsViewReparent);
371 class WindowObserver;
372 friend class WindowObserver;
374 class WindowAncestorObserver;
375 friend class WindowAncestorObserver;
377 void UpdateCursorIfOverSelf();
379 // Tracks whether SnapToPhysicalPixelBoundary() has been called.
380 bool has_snapped_to_boundary() { return has_snapped_to_boundary_; }
381 void ResetHasSnappedToBoundary() { has_snapped_to_boundary_ = false; }
383 // Set the bounds of the window and handle size changes. Assumes the caller
384 // has already adjusted the origin of |rect| to conform to whatever coordinate
385 // space is required by the aura::Window.
386 void InternalSetBounds(const gfx::Rect& rect);
388 #if defined(OS_WIN)
389 bool UsesNativeWindowFrame() const;
390 #endif
392 ui::InputMethod* GetInputMethod() const;
394 // Sends shutdown request.
395 void Shutdown();
397 // Returns whether the widget needs an input grab to work properly.
398 bool NeedsInputGrab();
400 // Returns whether the widget needs to grab mouse capture to work properly.
401 bool NeedsMouseCapture();
403 // Confirm existing composition text in the webpage and ask the input method
404 // to cancel its ongoing composition session.
405 void FinishImeCompositionSession();
407 // This method computes movementX/Y and keeps track of mouse location for
408 // mouse lock on all mouse move events.
409 void ModifyEventMovementAndCoords(blink::WebMouseEvent* event);
411 // Sends an IPC to the renderer process to communicate whether or not
412 // the mouse cursor is visible anywhere on the screen.
413 void NotifyRendererOfCursorVisibilityState(bool is_visible);
415 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty
416 // SchedulePaint() is invoked for |rect|.
417 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip);
419 // Helper method to determine if, in mouse locked mode, the cursor should be
420 // moved to center.
421 bool ShouldMoveToCenter();
423 // Called after |window_| is parented to a WindowEventDispatcher.
424 void AddedToRootWindow();
426 // Called prior to removing |window_| from a WindowEventDispatcher.
427 void RemovingFromRootWindow();
429 // DelegatedFrameHostClient implementation.
430 ui::Layer* DelegatedFrameHostGetLayer() const override;
431 bool DelegatedFrameHostIsVisible() const override;
432 gfx::Size DelegatedFrameHostDesiredSizeInDIP() const override;
433 bool DelegatedFrameCanCreateResizeLock() const override;
434 scoped_ptr<ResizeLock> DelegatedFrameHostCreateResizeLock(
435 bool defer_compositor_lock) override;
436 void DelegatedFrameHostResizeLockWasReleased() override;
437 void DelegatedFrameHostSendCompositorSwapAck(
438 int output_surface_id,
439 const cc::CompositorFrameAck& ack) override;
440 void DelegatedFrameHostSendReclaimCompositorResources(
441 int output_surface_id,
442 const cc::CompositorFrameAck& ack) override;
443 void DelegatedFrameHostOnLostCompositorResources() override;
444 void DelegatedFrameHostUpdateVSyncParameters(
445 const base::TimeTicks& timebase,
446 const base::TimeDelta& interval) override;
448 // BeginFrameObserverProxyClient implementation.
449 void SendBeginFrame(const cc::BeginFrameArgs& args) override;
451 // Detaches |this| from the input method object.
452 void DetachFromInputMethod();
454 // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method
455 // calls our keybindings handler against the event and send matched
456 // edit commands to renderer instead.
457 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event);
459 // Dismisses a Web Popup on a mouse or touch press outside the popup and its
460 // parent.
461 void ApplyEventFilterForPopupExit(ui::LocatedEvent* event);
463 // Converts |rect| from window coordinate to screen coordinate.
464 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const;
466 // Converts |rect| from screen coordinate to window coordinate.
467 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const;
469 // Helper function to set keyboard focus to the main window.
470 void SetKeyboardFocus();
472 // Called when RenderWidget wants to start BeginFrame scheduling or stop.
473 void OnSetNeedsBeginFrames(bool needs_begin_frames);
475 RenderFrameHostImpl* GetFocusedFrame();
477 // Returns true if the |event| passed in can be forwarded to the renderer.
478 bool CanRendererHandleEvent(const ui::MouseEvent* event,
479 bool mouse_locked,
480 bool selection_popup);
482 // Called when the parent window bounds change.
483 void HandleParentBoundsChanged();
485 // Called when the parent window hierarchy for our window changes.
486 void ParentHierarchyChanged();
488 // Helper function to be called whenever new selection information is
489 // received. It will update selection controller.
490 void SelectionUpdated(bool is_editable,
491 bool is_empty_text_form_control,
492 const ui::SelectionBound& start,
493 const ui::SelectionBound& end);
495 // Helper function to create a selection controller.
496 void CreateSelectionController();
498 // Performs gesture handling needed for touch text selection. Sets event as
499 // handled if it should not be further processed.
500 void HandleGestureForTouchSelection(ui::GestureEvent* event);
502 // The model object.
503 RenderWidgetHostImpl* const host_;
505 aura::Window* window_;
507 scoped_ptr<DelegatedFrameHost> delegated_frame_host_;
509 scoped_ptr<WindowObserver> window_observer_;
511 // Tracks the ancestors of the RWHVA window for window location changes.
512 scoped_ptr<WindowAncestorObserver> ancestor_window_observer_;
514 // Are we in the process of closing? Tracked so fullscreen views can avoid
515 // sending a second shutdown request to the host when they lose the focus
516 // after requesting shutdown for another reason (e.g. Escape key).
517 bool in_shutdown_;
519 // True if in the process of handling a window bounds changed notification.
520 bool in_bounds_changed_;
522 // Is this a fullscreen view?
523 bool is_fullscreen_;
525 // Our parent host view, if this is a popup. NULL otherwise.
526 RenderWidgetHostViewAura* popup_parent_host_view_;
528 // Our child popup host. NULL if we do not have a child popup.
529 RenderWidgetHostViewAura* popup_child_host_view_;
531 class EventFilterForPopupExit;
532 friend class EventFilterForPopupExit;
533 scoped_ptr<ui::EventHandler> event_filter_for_popup_exit_;
535 // True when content is being loaded. Used to show an hourglass cursor.
536 bool is_loading_;
538 // The cursor for the page. This is passed up from the renderer.
539 WebCursor current_cursor_;
541 // Stores the current state of the active pointers targeting this
542 // object.
543 ui::MotionEventAura pointer_state_;
545 // The current text input type.
546 ui::TextInputType text_input_type_;
547 // The current text input mode corresponding to HTML5 inputmode attribute.
548 ui::TextInputMode text_input_mode_;
549 // The current text input flags.
550 int text_input_flags_;
551 bool can_compose_inline_;
553 // Bounds for the selection.
554 ui::SelectionBound selection_anchor_;
555 ui::SelectionBound selection_focus_;
557 // The current composition character bounds.
558 std::vector<gfx::Rect> composition_character_bounds_;
560 // Indicates if there is onging composition text.
561 bool has_composition_text_;
563 // Whether return characters should be passed on to the RenderWidgetHostImpl.
564 bool accept_return_character_;
566 // Current tooltip text.
567 base::string16 tooltip_;
569 // The size and scale of the last software compositing frame that was swapped.
570 gfx::Size last_swapped_software_frame_size_;
571 float last_swapped_software_frame_scale_factor_;
573 // If non-NULL we're in OnPaint() and this is the supplied canvas.
574 gfx::Canvas* paint_canvas_;
576 // Used to record the last position of the mouse.
577 // While the mouse is locked, they store the last known position just as mouse
578 // lock was entered.
579 // Relative to the upper-left corner of the view.
580 gfx::Point unlocked_mouse_position_;
581 // Relative to the upper-left corner of the screen.
582 gfx::Point unlocked_global_mouse_position_;
583 // Last cursor position relative to screen. Used to compute movementX/Y.
584 gfx::Point global_mouse_position_;
585 // In mouse locked mode, we synthetically move the mouse cursor to the center
586 // of the window when it reaches the window borders to avoid it going outside.
587 // This flag is used to differentiate between these synthetic mouse move
588 // events vs. normal mouse move events.
589 bool synthetic_move_sent_;
591 // Used to track the state of the window we're created from. Only used when
592 // created fullscreen.
593 scoped_ptr<aura::WindowTracker> host_tracker_;
595 // Used to track the last cursor visibility update that was sent to the
596 // renderer via NotifyRendererOfCursorVisibilityState().
597 enum CursorVisibilityState {
598 UNKNOWN,
599 VISIBLE,
600 NOT_VISIBLE,
602 CursorVisibilityState cursor_visibility_state_in_renderer_;
604 #if defined(OS_WIN)
605 // The list of rectangles from constrained windows over this view. Windowed
606 // NPAPI plugins shouldn't draw over them.
607 std::vector<gfx::Rect> constrained_rects_;
609 typedef std::map<HWND, WebPluginGeometry> PluginWindowMoves;
610 // Contains information about each windowed plugin's clip and cutout rects (
611 // from the renderer). This is needed because when the transient windows
612 // over this view changes, we need this information in order to create a new
613 // region for the HWND.
614 PluginWindowMoves plugin_window_moves_;
616 // The LegacyRenderWidgetHostHWND class provides a dummy HWND which is used
617 // for accessibility, as the container for windowless plugins like
618 // Flash/Silverlight, etc and for legacy drivers for trackpoints/trackpads,
619 // etc.
620 // The LegacyRenderWidgetHostHWND instance is created during the first call
621 // to RenderWidgetHostViewAura::InternalSetBounds. The instance is destroyed
622 // when the LegacyRenderWidgetHostHWND hwnd is destroyed.
623 content::LegacyRenderWidgetHostHWND* legacy_render_widget_host_HWND_;
625 // Set to true if the legacy_render_widget_host_HWND_ instance was destroyed
626 // by Windows. This could happen if the browser window was destroyed by
627 // DestroyWindow for e.g. This flag helps ensure that we don't try to create
628 // the LegacyRenderWidgetHostHWND instance again as that would be a futile
629 // exercise.
630 bool legacy_window_destroyed_;
632 // Set to true when a context menu is being displayed. Reset to false when
633 // a mouse leave is received in this context.
634 bool showing_context_menu_;
635 #endif
637 bool has_snapped_to_boundary_;
639 scoped_ptr<TouchSelectionControllerClientAura> selection_controller_client_;
640 scoped_ptr<ui::TouchSelectionController> selection_controller_;
642 scoped_ptr<OverscrollController> overscroll_controller_;
644 // The last scroll offset of the view.
645 gfx::Vector2dF last_scroll_offset_;
647 gfx::Insets insets_;
649 std::vector<ui::LatencyInfo> software_latency_info_;
651 scoped_ptr<aura::client::ScopedTooltipDisabler> tooltip_disabler_;
653 // True when this view acts as a platform view hack for a
654 // RenderWidgetHostViewGuest.
655 bool is_guest_view_hack_;
657 gfx::Rect disambiguation_target_rect_;
659 // The last scroll offset when we start to render the link disambiguation
660 // view, so we can ensure the window hasn't moved between copying from the
661 // compositing surface and showing the disambiguation popup.
662 gfx::Vector2dF disambiguation_scroll_offset_;
664 BeginFrameObserverProxy begin_frame_observer_proxy_;
666 // This flag when set ensures that we send over a notification to blink that
667 // the current view has focus. Defaults to false.
668 bool set_focus_on_mouse_down_;
670 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_;
672 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);
675 } // namespace content
677 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_