Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / content / browser / renderer_host / render_widget_host_view_aura.h
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.
4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
7
8 #include <map>
9 #include <set>
10 #include <string>
11 #include <vector>
12
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"
37
38 namespace aura {
39 class WindowTracker;
40 namespace client {
41 class ScopedTooltipDisabler;
42 }
43 }
44
45 namespace cc {
46 class CopyOutputRequest;
47 class CopyOutputResult;
48 class DelegatedFrameData;
49 }
50
51 namespace gfx {
52 class Canvas;
53 class Display;
54 }
55
56 namespace gpu {
57 struct Mailbox;
58 }
59
60 namespace ui {
61 class CompositorLock;
62 class InputMethod;
63 class LocatedEvent;
64 class Texture;
65 }
66
67 namespace content {
68 #if defined(OS_WIN)
69 class LegacyRenderWidgetHostHWND;
70 #endif
71
72 class OverscrollController;
73 class RenderFrameHostImpl;
74 class RenderWidgetHostImpl;
75 class RenderWidgetHostView;
76
77 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
78 class CONTENT_EXPORT RenderWidgetHostViewAura
79     : public RenderWidgetHostViewBase,
80       public DelegatedFrameHostClient,
81       public ui::TextInputClient,
82       public gfx::DisplayObserver,
83       public aura::WindowTreeHostObserver,
84       public aura::WindowDelegate,
85       public aura::client::ActivationDelegate,
86       public aura::client::ActivationChangeObserver,
87       public aura::client::FocusChangeObserver,
88       public aura::client::CursorClientObserver,
89       public base::SupportsWeakPtr<RenderWidgetHostViewAura> {
90  public:
91   // Displays and controls touch editing elements such as selection handles.
92   class TouchEditingClient {
93    public:
94     TouchEditingClient() {}
95
96     // Tells the client to start showing touch editing handles.
97     virtual void StartTouchEditing() = 0;
98
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;
102
103     // Notifies the client that the selection bounds need to be updated.
104     virtual void OnSelectionOrCursorChanged(const gfx::Rect& anchor,
105                                             const gfx::Rect& focus) = 0;
106
107     // Notifies the client that the current text input type as changed.
108     virtual void OnTextInputTypeChanged(ui::TextInputType type) = 0;
109
110     // Notifies the client that an input event is about to be sent to the
111     // renderer. Returns true if the client wants to stop event propagation.
112     virtual bool HandleInputEvent(const ui::Event* event) = 0;
113
114     // Notifies the client that a gesture event ack was received.
115     virtual void GestureEventAck(int gesture_event_type) = 0;
116
117     // Notifies the client that the fling has ended, so it can activate touch
118     // editing if needed.
119     virtual void DidStopFlinging() = 0;
120
121     // This is called when the view is destroyed, so that the client can
122     // perform any necessary clean-up.
123     virtual void OnViewDestroyed() = 0;
124
125    protected:
126     virtual ~TouchEditingClient() {}
127   };
128
129   void set_touch_editing_client(TouchEditingClient* client) {
130     touch_editing_client_ = client;
131   }
132
133   // When |is_guest_view_hack| is true, this view isn't really the view for
134   // the |widget|, a RenderWidgetHostViewGuest is.
135   //
136   // TODO(lazyboy): Remove |is_guest_view_hack| once BrowserPlugin has migrated
137   // to use RWHVChildFrame (http://crbug.com/330264).
138   RenderWidgetHostViewAura(RenderWidgetHost* host, bool is_guest_view_hack);
139
140   // RenderWidgetHostView implementation.
141   bool OnMessageReceived(const IPC::Message& msg) override;
142   void InitAsChild(gfx::NativeView parent_view) override;
143   RenderWidgetHost* GetRenderWidgetHost() const override;
144   void SetSize(const gfx::Size& size) override;
145   void SetBounds(const gfx::Rect& rect) override;
146   gfx::Vector2dF GetLastScrollOffset() const override;
147   gfx::NativeView GetNativeView() const override;
148   gfx::NativeViewId GetNativeViewId() const override;
149   gfx::NativeViewAccessible GetNativeViewAccessible() override;
150   ui::TextInputClient* GetTextInputClient() override;
151   bool HasFocus() const override;
152   bool IsSurfaceAvailableForCopy() const override;
153   void Show() override;
154   void Hide() override;
155   bool IsShowing() override;
156   gfx::Rect GetViewBounds() const override;
157   void SetBackgroundColor(SkColor color) override;
158   gfx::Size GetVisibleViewportSize() const override;
159   void SetInsets(const gfx::Insets& insets) override;
160
161   // Overridden from RenderWidgetHostViewBase:
162   void InitAsPopup(RenderWidgetHostView* parent_host_view,
163                    const gfx::Rect& pos) override;
164   void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override;
165   void WasShown() override;
166   void WasHidden() override;
167   void MovePluginWindows(const std::vector<WebPluginGeometry>& moves) override;
168   void Focus() override;
169   void Blur() override;
170   void UpdateCursor(const WebCursor& cursor) override;
171   void SetIsLoading(bool is_loading) override;
172   void TextInputTypeChanged(ui::TextInputType type,
173                             ui::TextInputMode input_mode,
174                             bool can_compose_inline,
175                             int flags) override;
176   void ImeCancelComposition() override;
177   void ImeCompositionRangeChanged(
178       const gfx::Range& range,
179       const std::vector<gfx::Rect>& character_bounds) override;
180   void RenderProcessGone(base::TerminationStatus status,
181                          int error_code) override;
182   void Destroy() override;
183   void SetTooltipText(const base::string16& tooltip_text) override;
184   void SelectionChanged(const base::string16& text,
185                         size_t offset,
186                         const gfx::Range& range) override;
187   gfx::Size GetRequestedRendererSize() const override;
188   void SelectionBoundsChanged(
189       const ViewHostMsg_SelectionBounds_Params& params) override;
190   void CopyFromCompositingSurface(const gfx::Rect& src_subrect,
191                                   const gfx::Size& dst_size,
192                                   CopyFromCompositingSurfaceCallback& callback,
193                                   const SkColorType color_type) override;
194   void CopyFromCompositingSurfaceToVideoFrame(
195       const gfx::Rect& src_subrect,
196       const scoped_refptr<media::VideoFrame>& target,
197       const base::Callback<void(bool)>& callback) override;
198   bool CanCopyToVideoFrame() const override;
199   bool CanSubscribeFrame() const override;
200   void BeginFrameSubscription(
201       scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) override;
202   void EndFrameSubscription() override;
203   bool HasAcceleratedSurface(const gfx::Size& desired_size) override;
204   void GetScreenInfo(blink::WebScreenInfo* results) override;
205   gfx::Rect GetBoundsInRootWindow() override;
206   void WheelEventAck(const blink::WebMouseWheelEvent& event,
207                      InputEventAckState ack_result) override;
208   void GestureEventAck(const blink::WebGestureEvent& event,
209                        InputEventAckState ack_result) override;
210   void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch,
211                               InputEventAckState ack_result) override;
212   scoped_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget() override;
213   InputEventAckState FilterInputEvent(
214       const blink::WebInputEvent& input_event) override;
215   gfx::GLSurfaceHandle GetCompositingSurface() override;
216   BrowserAccessibilityManager* CreateBrowserAccessibilityManager(
217       BrowserAccessibilityDelegate* delegate) override;
218   gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() override;
219   gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() override;
220   void ShowDisambiguationPopup(const gfx::Rect& rect_pixels,
221                                const SkBitmap& zoomed_bitmap) override;
222   bool LockMouse() override;
223   void UnlockMouse() override;
224   void OnSwapCompositorFrame(uint32 output_surface_id,
225                              scoped_ptr<cc::CompositorFrame> frame) override;
226   void DidStopFlinging() override;
227
228 #if defined(OS_WIN)
229   void SetLegacyRenderWidgetHostHWND(LegacyRenderWidgetHostHWND* legacy_hwnd);
230   virtual void SetParentNativeViewAccessible(
231       gfx::NativeViewAccessible accessible_parent) override;
232   virtual gfx::NativeViewId GetParentForWindowlessPlugin() const override;
233 #endif
234
235   // Overridden from ui::TextInputClient:
236   void SetCompositionText(const ui::CompositionText& composition) override;
237   void ConfirmCompositionText() override;
238   void ClearCompositionText() override;
239   void InsertText(const base::string16& text) override;
240   void InsertChar(base::char16 ch, int flags) override;
241   gfx::NativeWindow GetAttachedWindow() const override;
242   ui::TextInputType GetTextInputType() const override;
243   ui::TextInputMode GetTextInputMode() const override;
244   int GetTextInputFlags() const override;
245   bool CanComposeInline() const override;
246   gfx::Rect GetCaretBounds() const override;
247   bool GetCompositionCharacterBounds(uint32 index,
248                                      gfx::Rect* rect) const override;
249   bool HasCompositionText() const override;
250   bool GetTextRange(gfx::Range* range) const override;
251   bool GetCompositionTextRange(gfx::Range* range) const override;
252   bool GetSelectionRange(gfx::Range* range) const override;
253   bool SetSelectionRange(const gfx::Range& range) override;
254   bool DeleteRange(const gfx::Range& range) override;
255   bool GetTextFromRange(const gfx::Range& range,
256                         base::string16* text) const override;
257   void OnInputMethodChanged() override;
258   bool ChangeTextDirectionAndLayoutAlignment(
259       base::i18n::TextDirection direction) override;
260   void ExtendSelectionAndDelete(size_t before, size_t after) override;
261   void EnsureCaretInRect(const gfx::Rect& rect) override;
262   void OnCandidateWindowShown() override;
263   void OnCandidateWindowUpdated() override;
264   void OnCandidateWindowHidden() override;
265   bool IsEditingCommandEnabled(int command_id) override;
266   void ExecuteEditingCommand(int command_id) override;
267
268   // Overridden from gfx::DisplayObserver:
269   void OnDisplayAdded(const gfx::Display& new_display) override;
270   void OnDisplayRemoved(const gfx::Display& old_display) override;
271   void OnDisplayMetricsChanged(const gfx::Display& display,
272                                uint32_t metrics) override;
273
274   // Overridden from aura::WindowDelegate:
275   gfx::Size GetMinimumSize() const override;
276   gfx::Size GetMaximumSize() const override;
277   void OnBoundsChanged(const gfx::Rect& old_bounds,
278                        const gfx::Rect& new_bounds) override;
279   gfx::NativeCursor GetCursor(const gfx::Point& point) override;
280   int GetNonClientComponent(const gfx::Point& point) const override;
281   bool ShouldDescendIntoChildForEventHandling(
282       aura::Window* child,
283       const gfx::Point& location) override;
284   bool CanFocus() override;
285   void OnCaptureLost() override;
286   void OnPaint(gfx::Canvas* canvas) 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;
293
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;
300
301   // Overridden from aura::client::ActivationDelegate:
302   bool ShouldActivate() const override;
303
304   // Overridden from aura::client::ActivationChangeObserver:
305   void OnWindowActivated(aura::Window* gained_activation,
306                          aura::Window* lost_activation) override;
307
308   // Overridden from aura::client::CursorClientObserver:
309   void OnCursorVisibilityChanged(bool is_visible) override;
310
311   // Overridden from aura::client::FocusChangeObserver:
312   void OnWindowFocused(aura::Window* gained_focus,
313                        aura::Window* lost_focus) override;
314
315   // Overridden from aura::WindowTreeHostObserver:
316   void OnHostMoved(const aura::WindowTreeHost* host,
317                    const gfx::Point& new_origin) override;
318
319   void OnTextInputStateChanged(const ViewHostMsg_TextInputState_Params& params);
320
321 #if defined(OS_WIN)
322   // Sets the cutout rects from constrained windows. These are rectangles that
323   // windowed NPAPI plugins shouldn't paint in. Overwrites any previous cutout
324   // rects.
325   void UpdateConstrainedWindowRects(const std::vector<gfx::Rect>& rects);
326
327   // Updates the cursor clip region. Used for mouse locking.
328   void UpdateMouseLockRegion();
329 #endif
330
331   void DisambiguationPopupRendered(bool success, const SkBitmap& result);
332
333   void HideDisambiguationPopup();
334
335   void ProcessDisambiguationGesture(ui::GestureEvent* event);
336
337   void ProcessDisambiguationMouse(ui::MouseEvent* event);
338
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_; }
343
344   // Sets whether the overscroll controller should be enabled for this page.
345   void SetOverscrollControllerEnabled(bool enabled);
346
347   void SnapToPhysicalPixelBoundary();
348
349   OverscrollController* overscroll_controller() const {
350     return overscroll_controller_.get();
351   }
352
353  protected:
354   ~RenderWidgetHostViewAura() override;
355
356   // Exposed for tests.
357   aura::Window* window() { return window_; }
358   SkColorType PreferredReadbackFormat() override;
359   DelegatedFrameHost* GetDelegatedFrameHost() const override;
360
361  private:
362   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
363                            PopupRetainsCaptureAfterMouseRelease);
364   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText);
365   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState);
366   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
367                            TouchEventPositionsArentRounded);
368   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventSyncAsync);
369   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SwapNotifiesWindow);
370   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, RecreateLayers);
371   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
372                            SkippedDelegatedFrames);
373   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, OutputSurfaceIdChange);
374   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
375                            DiscardDelegatedFrames);
376   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
377                            DiscardDelegatedFramesWithLocking);
378   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SoftwareDPIChange);
379   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
380                            UpdateCursorIfOverSelf);
381   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraCopyRequestTest,
382                            DestroyedAfterCopyRequest);
383   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
384                            VisibleViewportTest);
385   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
386                            OverscrollResetsOnBlur);
387   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
388                            FinishCompositionByMouse);
389   FRIEND_TEST_ALL_PREFIXES(WebContentsViewAuraTest,
390                            WebContentsViewReparent);
391
392   class WindowObserver;
393   friend class WindowObserver;
394
395   void UpdateCursorIfOverSelf();
396
397   // Tracks whether SnapToPhysicalPixelBoundary() has been called.
398   bool has_snapped_to_boundary() { return has_snapped_to_boundary_; }
399   void ResetHasSnappedToBoundary() { has_snapped_to_boundary_ = false; }
400
401   // Set the bounds of the window and handle size changes.  Assumes the caller
402   // has already adjusted the origin of |rect| to conform to whatever coordinate
403   // space is required by the aura::Window.
404   void InternalSetBounds(const gfx::Rect& rect);
405
406 #if defined(OS_WIN)
407   bool UsesNativeWindowFrame() const;
408 #endif
409
410   ui::InputMethod* GetInputMethod() const;
411
412   // Sends shutdown request.
413   void Shutdown();
414
415   // Returns whether the widget needs an input grab to work properly.
416   bool NeedsInputGrab();
417
418   // Returns whether the widget needs to grab mouse capture to work properly.
419   bool NeedsMouseCapture();
420
421   // Confirm existing composition text in the webpage and ask the input method
422   // to cancel its ongoing composition session.
423   void FinishImeCompositionSession();
424
425   // This method computes movementX/Y and keeps track of mouse location for
426   // mouse lock on all mouse move events.
427   void ModifyEventMovementAndCoords(blink::WebMouseEvent* event);
428
429   // Sends an IPC to the renderer process to communicate whether or not
430   // the mouse cursor is visible anywhere on the screen.
431   void NotifyRendererOfCursorVisibilityState(bool is_visible);
432
433   // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty
434   // SchedulePaint() is invoked for |rect|.
435   void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip);
436
437   // Helper method to determine if, in mouse locked mode, the cursor should be
438   // moved to center.
439   bool ShouldMoveToCenter();
440
441   // Called after |window_| is parented to a WindowEventDispatcher.
442   void AddedToRootWindow();
443
444   // Called prior to removing |window_| from a WindowEventDispatcher.
445   void RemovingFromRootWindow();
446
447   // DelegatedFrameHostClient implementation.
448   ui::Compositor* GetCompositor() const override;
449   ui::Layer* GetLayer() override;
450   RenderWidgetHostImpl* GetHost() override;
451   bool IsVisible() override;
452   scoped_ptr<ResizeLock> CreateResizeLock(bool defer_compositor_lock) override;
453   gfx::Size DesiredFrameSize() override;
454   float CurrentDeviceScaleFactor() override;
455   gfx::Size ConvertViewSizeToPixel(const gfx::Size& size) override;
456
457   // Detaches |this| from the input method object.
458   void DetachFromInputMethod();
459
460   // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method
461   // calls our keybindings handler against the event and send matched
462   // edit commands to renderer instead.
463   void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event);
464
465   // Dismisses a Web Popup on a mouse or touch press outside the popup and its
466   // parent.
467   void ApplyEventFilterForPopupExit(ui::LocatedEvent* event);
468
469   // Converts |rect| from window coordinate to screen coordinate.
470   gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const;
471
472   // Converts |rect| from screen coordinate to window coordinate.
473   gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const;
474
475   // Helper function to set keyboard focus to the main window.
476   void SetKeyboardFocus();
477
478   RenderFrameHostImpl* GetFocusedFrame();
479
480   // The model object.
481   RenderWidgetHostImpl* host_;
482
483   aura::Window* window_;
484
485   scoped_ptr<DelegatedFrameHost> delegated_frame_host_;
486
487   scoped_ptr<WindowObserver> window_observer_;
488
489   // Are we in the process of closing?  Tracked so fullscreen views can avoid
490   // sending a second shutdown request to the host when they lose the focus
491   // after requesting shutdown for another reason (e.g. Escape key).
492   bool in_shutdown_;
493
494   // True if in the process of handling a window bounds changed notification.
495   bool in_bounds_changed_;
496
497   // Is this a fullscreen view?
498   bool is_fullscreen_;
499
500   // Our parent host view, if this is a popup.  NULL otherwise.
501   RenderWidgetHostViewAura* popup_parent_host_view_;
502
503   // Our child popup host. NULL if we do not have a child popup.
504   RenderWidgetHostViewAura* popup_child_host_view_;
505
506   class EventFilterForPopupExit;
507   friend class EventFilterForPopupExit;
508   scoped_ptr<ui::EventHandler> event_filter_for_popup_exit_;
509
510   // True when content is being loaded. Used to show an hourglass cursor.
511   bool is_loading_;
512
513   // The cursor for the page. This is passed up from the renderer.
514   WebCursor current_cursor_;
515
516   // The touch-event. Its touch-points are updated as necessary. A new
517   // touch-point is added from an ET_TOUCH_PRESSED event, and a touch-point is
518   // removed from the list on an ET_TOUCH_RELEASED event.
519   blink::WebTouchEvent touch_event_;
520
521   // The current text input type.
522   ui::TextInputType text_input_type_;
523   // The current text input mode corresponding to HTML5 inputmode attribute.
524   ui::TextInputMode text_input_mode_;
525   // The current text input flags.
526   int text_input_flags_;
527   bool can_compose_inline_;
528
529   // Rectangles for the selection anchor and focus.
530   gfx::Rect selection_anchor_rect_;
531   gfx::Rect selection_focus_rect_;
532
533   // The current composition character bounds.
534   std::vector<gfx::Rect> composition_character_bounds_;
535
536   // Indicates if there is onging composition text.
537   bool has_composition_text_;
538
539   // Whether return characters should be passed on to the RenderWidgetHostImpl.
540   bool accept_return_character_;
541
542   // Current tooltip text.
543   base::string16 tooltip_;
544
545   // The size and scale of the last software compositing frame that was swapped.
546   gfx::Size last_swapped_software_frame_size_;
547   float last_swapped_software_frame_scale_factor_;
548
549   // If non-NULL we're in OnPaint() and this is the supplied canvas.
550   gfx::Canvas* paint_canvas_;
551
552   // Used to record the last position of the mouse.
553   // While the mouse is locked, they store the last known position just as mouse
554   // lock was entered.
555   // Relative to the upper-left corner of the view.
556   gfx::Point unlocked_mouse_position_;
557   // Relative to the upper-left corner of the screen.
558   gfx::Point unlocked_global_mouse_position_;
559   // Last cursor position relative to screen. Used to compute movementX/Y.
560   gfx::Point global_mouse_position_;
561   // In mouse locked mode, we synthetically move the mouse cursor to the center
562   // of the window when it reaches the window borders to avoid it going outside.
563   // This flag is used to differentiate between these synthetic mouse move
564   // events vs. normal mouse move events.
565   bool synthetic_move_sent_;
566
567   // Used to track the state of the window we're created from. Only used when
568   // created fullscreen.
569   scoped_ptr<aura::WindowTracker> host_tracker_;
570
571   // Used to track the last cursor visibility update that was sent to the
572   // renderer via NotifyRendererOfCursorVisibilityState().
573   enum CursorVisibilityState {
574     UNKNOWN,
575     VISIBLE,
576     NOT_VISIBLE,
577   };
578   CursorVisibilityState cursor_visibility_state_in_renderer_;
579
580 #if defined(OS_WIN)
581   // The list of rectangles from constrained windows over this view. Windowed
582   // NPAPI plugins shouldn't draw over them.
583   std::vector<gfx::Rect> constrained_rects_;
584
585   typedef std::map<HWND, WebPluginGeometry> PluginWindowMoves;
586   // Contains information about each windowed plugin's clip and cutout rects (
587   // from the renderer). This is needed because when the transient windows
588   // over this view changes, we need this information in order to create a new
589   // region for the HWND.
590   PluginWindowMoves plugin_window_moves_;
591
592   // The LegacyRenderWidgetHostHWND class provides a dummy HWND which is used
593   // for accessibility, as the container for windowless plugins like
594   // Flash/Silverlight, etc and for legacy drivers for trackpoints/trackpads,
595   // etc.
596   content::LegacyRenderWidgetHostHWND* legacy_render_widget_host_HWND_;
597 #endif
598
599   bool has_snapped_to_boundary_;
600
601   TouchEditingClient* touch_editing_client_;
602
603   scoped_ptr<OverscrollController> overscroll_controller_;
604
605   // The last scroll offset of the view.
606   gfx::Vector2dF last_scroll_offset_;
607
608   gfx::Insets insets_;
609
610   std::vector<ui::LatencyInfo> software_latency_info_;
611
612   scoped_ptr<aura::client::ScopedTooltipDisabler> tooltip_disabler_;
613
614   // True when this view acts as a platform view hack for a
615   // RenderWidgetHostViewGuest.
616   bool is_guest_view_hack_;
617
618   base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_;
619
620   gfx::Rect disambiguation_target_rect_;
621
622   // The last scroll offset when we start to render the link disambiguation
623   // view, so we can ensure the window hasn't moved between copying from the
624   // compositing surface and showing the disambiguation popup.
625   gfx::Vector2dF disambiguation_scroll_offset_;
626
627   DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);
628 };
629
630 }  // namespace content
631
632 #endif  // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_