Upstream version 7.36.149.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 RenderFrameHostImpl;
73 class RenderWidgetHostImpl;
74 class RenderWidgetHostView;
75
76 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
77 class CONTENT_EXPORT RenderWidgetHostViewAura
78     : public RenderWidgetHostViewBase,
79       public DelegatedFrameHostClient,
80       public ui::TextInputClient,
81       public gfx::DisplayObserver,
82       public aura::WindowTreeHostObserver,
83       public aura::WindowDelegate,
84       public aura::client::ActivationDelegate,
85       public aura::client::ActivationChangeObserver,
86       public aura::client::FocusChangeObserver,
87       public aura::client::CursorClientObserver,
88       public base::SupportsWeakPtr<RenderWidgetHostViewAura> {
89  public:
90   // Displays and controls touch editing elements such as selection handles.
91   class TouchEditingClient {
92    public:
93     TouchEditingClient() {}
94
95     // Tells the client to start showing touch editing handles.
96     virtual void StartTouchEditing() = 0;
97
98     // Notifies the client that touch editing is no longer needed. |quick|
99     // determines whether the handles should fade out quickly or slowly.
100     virtual void EndTouchEditing(bool quick) = 0;
101
102     // Notifies the client that the selection bounds need to be updated.
103     virtual void OnSelectionOrCursorChanged(const gfx::Rect& anchor,
104                                             const gfx::Rect& focus) = 0;
105
106     // Notifies the client that the current text input type as changed.
107     virtual void OnTextInputTypeChanged(ui::TextInputType type) = 0;
108
109     // Notifies the client that an input event is about to be sent to the
110     // renderer. Returns true if the client wants to stop event propagation.
111     virtual bool HandleInputEvent(const ui::Event* event) = 0;
112
113     // Notifies the client that a gesture event ack was received.
114     virtual void GestureEventAck(int gesture_event_type) = 0;
115
116     // This is called when the view is destroyed, so that the client can
117     // perform any necessary clean-up.
118     virtual void OnViewDestroyed() = 0;
119
120    protected:
121     virtual ~TouchEditingClient() {}
122   };
123
124   void set_touch_editing_client(TouchEditingClient* client) {
125     touch_editing_client_ = client;
126   }
127
128   explicit RenderWidgetHostViewAura(RenderWidgetHost* host);
129
130   // RenderWidgetHostView implementation.
131   virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
132   virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE;
133   virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE;
134   virtual void SetSize(const gfx::Size& size) OVERRIDE;
135   virtual void SetBounds(const gfx::Rect& rect) OVERRIDE;
136   virtual gfx::NativeView GetNativeView() const OVERRIDE;
137   virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE;
138   virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE;
139   virtual ui::TextInputClient* GetTextInputClient() OVERRIDE;
140   virtual bool HasFocus() const OVERRIDE;
141   virtual bool IsSurfaceAvailableForCopy() const OVERRIDE;
142   virtual void Show() OVERRIDE;
143   virtual void Hide() OVERRIDE;
144   virtual bool IsShowing() OVERRIDE;
145   virtual gfx::Rect GetViewBounds() const OVERRIDE;
146   virtual void SetBackground(const SkBitmap& background) OVERRIDE;
147   virtual gfx::Size GetVisibleViewportSize() const OVERRIDE;
148   virtual void SetInsets(const gfx::Insets& insets) OVERRIDE;
149
150   // Overridden from RenderWidgetHostViewBase:
151   virtual void InitAsPopup(RenderWidgetHostView* parent_host_view,
152                            const gfx::Rect& pos) OVERRIDE;
153   virtual void InitAsFullscreen(
154       RenderWidgetHostView* reference_host_view) OVERRIDE;
155   virtual void WasShown() OVERRIDE;
156   virtual void WasHidden() OVERRIDE;
157   virtual void MovePluginWindows(
158       const std::vector<WebPluginGeometry>& moves) OVERRIDE;
159   virtual void Focus() OVERRIDE;
160   virtual void Blur() OVERRIDE;
161   virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE;
162   virtual void SetIsLoading(bool is_loading) OVERRIDE;
163   virtual void TextInputTypeChanged(ui::TextInputType type,
164                                     ui::TextInputMode input_mode,
165                                     bool can_compose_inline) OVERRIDE;
166   virtual void ImeCancelComposition() OVERRIDE;
167   virtual void ImeCompositionRangeChanged(
168       const gfx::Range& range,
169       const std::vector<gfx::Rect>& character_bounds) OVERRIDE;
170   virtual void RenderProcessGone(base::TerminationStatus status,
171                                  int error_code) OVERRIDE;
172   virtual void Destroy() OVERRIDE;
173   virtual void SetTooltipText(const base::string16& tooltip_text) OVERRIDE;
174   virtual void SelectionChanged(const base::string16& text,
175                                 size_t offset,
176                                 const gfx::Range& range) OVERRIDE;
177   virtual void SelectionBoundsChanged(
178       const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE;
179   virtual void ScrollOffsetChanged() OVERRIDE;
180   virtual void CopyFromCompositingSurface(
181       const gfx::Rect& src_subrect,
182       const gfx::Size& dst_size,
183       const base::Callback<void(bool, const SkBitmap&)>& callback,
184       const SkBitmap::Config config) OVERRIDE;
185   virtual void CopyFromCompositingSurfaceToVideoFrame(
186       const gfx::Rect& src_subrect,
187       const scoped_refptr<media::VideoFrame>& target,
188       const base::Callback<void(bool)>& callback) OVERRIDE;
189   virtual bool CanCopyToVideoFrame() const OVERRIDE;
190   virtual bool CanSubscribeFrame() const OVERRIDE;
191   virtual void BeginFrameSubscription(
192       scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) OVERRIDE;
193   virtual void EndFrameSubscription() OVERRIDE;
194   virtual void OnAcceleratedCompositingStateChange() 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 GestureEventAck(const blink::WebGestureEvent& event,
209                                InputEventAckState ack_result) OVERRIDE;
210   virtual void ProcessAckedTouchEvent(
211       const TouchEventWithLatencyInfo& touch,
212       InputEventAckState ack_result) OVERRIDE;
213   virtual scoped_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget()
214       OVERRIDE;
215   virtual void SetScrollOffsetPinning(
216       bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE;
217   virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE;
218   virtual void CreateBrowserAccessibilityManagerIfNeeded() OVERRIDE;
219   virtual bool LockMouse() OVERRIDE;
220   virtual void UnlockMouse() OVERRIDE;
221   virtual void OnSwapCompositorFrame(
222       uint32 output_surface_id,
223       scoped_ptr<cc::CompositorFrame> frame) OVERRIDE;
224
225 #if defined(OS_WIN)
226   virtual void SetParentNativeViewAccessible(
227       gfx::NativeViewAccessible accessible_parent) OVERRIDE;
228   virtual gfx::NativeViewId GetParentForWindowlessPlugin() const OVERRIDE;
229 #endif
230
231   // Overridden from ui::TextInputClient:
232   virtual void SetCompositionText(
233       const ui::CompositionText& composition) OVERRIDE;
234   virtual void ConfirmCompositionText() OVERRIDE;
235   virtual void ClearCompositionText() OVERRIDE;
236   virtual void InsertText(const base::string16& text) OVERRIDE;
237   virtual void InsertChar(base::char16 ch, int flags) OVERRIDE;
238   virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE;
239   virtual ui::TextInputType GetTextInputType() const OVERRIDE;
240   virtual ui::TextInputMode GetTextInputMode() const OVERRIDE;
241   virtual bool CanComposeInline() const OVERRIDE;
242   virtual gfx::Rect GetCaretBounds() const OVERRIDE;
243   virtual bool GetCompositionCharacterBounds(uint32 index,
244                                              gfx::Rect* rect) const OVERRIDE;
245   virtual bool HasCompositionText() const OVERRIDE;
246   virtual bool GetTextRange(gfx::Range* range) const OVERRIDE;
247   virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE;
248   virtual bool GetSelectionRange(gfx::Range* range) const OVERRIDE;
249   virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE;
250   virtual bool DeleteRange(const gfx::Range& range) OVERRIDE;
251   virtual bool GetTextFromRange(const gfx::Range& range,
252                                 base::string16* text) const OVERRIDE;
253   virtual void OnInputMethodChanged() OVERRIDE;
254   virtual bool ChangeTextDirectionAndLayoutAlignment(
255       base::i18n::TextDirection direction) OVERRIDE;
256   virtual void ExtendSelectionAndDelete(size_t before, size_t after) OVERRIDE;
257   virtual void EnsureCaretInRect(const gfx::Rect& rect) OVERRIDE;
258   virtual void OnCandidateWindowShown() OVERRIDE;
259   virtual void OnCandidateWindowUpdated() OVERRIDE;
260   virtual void OnCandidateWindowHidden() OVERRIDE;
261
262   // Overridden from gfx::DisplayObserver:
263   virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE;
264   virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE;
265   virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE;
266
267   // Overridden from aura::WindowDelegate:
268   virtual gfx::Size GetMinimumSize() const OVERRIDE;
269   virtual gfx::Size GetMaximumSize() const OVERRIDE;
270   virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
271                                const gfx::Rect& new_bounds) OVERRIDE;
272   virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE;
273   virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE;
274   virtual bool ShouldDescendIntoChildForEventHandling(
275       aura::Window* child,
276       const gfx::Point& location) OVERRIDE;
277   virtual bool CanFocus() OVERRIDE;
278   virtual void OnCaptureLost() OVERRIDE;
279   virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
280   virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
281   virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
282   virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
283   virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE;
284   virtual bool HasHitTestMask() const OVERRIDE;
285   virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE;
286
287   // Overridden from ui::EventHandler:
288   virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
289   virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
290   virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
291   virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
292   virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
293
294   // Overridden from aura::client::ActivationDelegate:
295   virtual bool ShouldActivate() const OVERRIDE;
296
297   // Overridden from aura::client::ActivationChangeObserver:
298   virtual void OnWindowActivated(aura::Window* gained_activation,
299                                  aura::Window* lost_activation) OVERRIDE;
300
301   // Overridden from aura::client::CursorClientObserver:
302   virtual void OnCursorVisibilityChanged(bool is_visible) OVERRIDE;
303
304   // Overridden from aura::client::FocusChangeObserver:
305   virtual void OnWindowFocused(aura::Window* gained_focus,
306                                aura::Window* lost_focus) OVERRIDE;
307
308   // Overridden from aura::WindowTreeHostObserver:
309   virtual void OnHostMoved(const aura::WindowTreeHost* host,
310                            const gfx::Point& new_origin) OVERRIDE;
311
312   void OnTextInputStateChanged(const ViewHostMsg_TextInputState_Params& params);
313
314 #if defined(OS_WIN)
315   // Sets the cutout rects from constrained windows. These are rectangles that
316   // windowed NPAPI plugins shouldn't paint in. Overwrites any previous cutout
317   // rects.
318   void UpdateConstrainedWindowRects(const std::vector<gfx::Rect>& rects);
319
320   // Updates the cursor clip region. Used for mouse locking.
321   void UpdateMouseLockRegion();
322 #endif
323
324   // Method to indicate if this instance is shutting down or closing.
325   // TODO(shrikant): Discuss around to see if it makes sense to add this method
326   // as part of RenderWidgetHostView.
327   bool IsClosing() const { return in_shutdown_; }
328
329  protected:
330   virtual ~RenderWidgetHostViewAura();
331
332   // Exposed for tests.
333   aura::Window* window() { return window_; }
334   virtual SkBitmap::Config PreferredReadbackFormat() OVERRIDE;
335   virtual DelegatedFrameHost* GetDelegatedFrameHost() const OVERRIDE;
336
337  private:
338   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText);
339   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState);
340   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventSyncAsync);
341   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SwapNotifiesWindow);
342   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
343                            SkippedDelegatedFrames);
344   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, OutputSurfaceIdChange);
345   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
346                            DiscardDelegatedFrames);
347   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
348                            DiscardDelegatedFramesWithLocking);
349   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SoftwareDPIChange);
350   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
351                            UpdateCursorIfOverSelf);
352   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraCopyRequestTest,
353                            DestroyedAfterCopyRequest);
354   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
355                            VisibleViewportTest);
356
357   class WindowObserver;
358   friend class WindowObserver;
359
360   void UpdateCursorIfOverSelf();
361
362   // Set the bounds of the window and handle size changes.  Assumes the caller
363   // has already adjusted the origin of |rect| to conform to whatever coordinate
364   // space is required by the aura::Window.
365   void InternalSetBounds(const gfx::Rect& rect);
366
367 #if defined(OS_WIN)
368   bool UsesNativeWindowFrame() const;
369 #endif
370
371   ui::InputMethod* GetInputMethod() const;
372
373   // Returns whether the widget needs an input grab to work properly.
374   bool NeedsInputGrab();
375
376   // Confirm existing composition text in the webpage and ask the input method
377   // to cancel its ongoing composition session.
378   void FinishImeCompositionSession();
379
380   // This method computes movementX/Y and keeps track of mouse location for
381   // mouse lock on all mouse move events.
382   void ModifyEventMovementAndCoords(blink::WebMouseEvent* event);
383
384   // Sends an IPC to the renderer process to communicate whether or not
385   // the mouse cursor is visible anywhere on the screen.
386   void NotifyRendererOfCursorVisibilityState(bool is_visible);
387
388   // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty
389   // SchedulePaint() is invoked for |rect|.
390   void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip);
391
392   // Helper method to determine if, in mouse locked mode, the cursor should be
393   // moved to center.
394   bool ShouldMoveToCenter();
395
396   // Called after |window_| is parented to a WindowEventDispatcher.
397   void AddedToRootWindow();
398
399   // Called prior to removing |window_| from a WindowEventDispatcher.
400   void RemovingFromRootWindow();
401
402   // DelegatedFrameHostClient implementation.
403   virtual ui::Compositor* GetCompositor() const OVERRIDE;
404   virtual ui::Layer* GetLayer() OVERRIDE;
405   virtual RenderWidgetHostImpl* GetHost() OVERRIDE;
406   virtual void SchedulePaintInRect(
407       const gfx::Rect& damage_rect_in_dip) OVERRIDE;
408   virtual bool IsVisible() OVERRIDE;
409   virtual scoped_ptr<ResizeLock> CreateResizeLock(
410       bool defer_compositor_lock) OVERRIDE;
411   virtual gfx::Size DesiredFrameSize() OVERRIDE;
412   virtual float CurrentDeviceScaleFactor() OVERRIDE;
413   virtual gfx::Size ConvertViewSizeToPixel(const gfx::Size& size) OVERRIDE;
414
415   // Detaches |this| from the input method object.
416   void DetachFromInputMethod();
417
418   // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method
419   // calls our keybindings handler against the event and send matched
420   // edit commands to renderer instead.
421   void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event);
422
423   // Dismisses a Web Popup on a mouse or touch press outside the popup and its
424   // parent.
425   void ApplyEventFilterForPopupExit(ui::LocatedEvent* event);
426
427   // Converts |rect| from window coordinate to screen coordinate.
428   gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const;
429
430   // Converts |rect| from screen coordinate to window coordinate.
431   gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const;
432
433   // Helper function to set keyboard focus to the main window.
434   void SetKeyboardFocus();
435
436   RenderFrameHostImpl* GetFocusedFrame();
437
438   // The model object.
439   RenderWidgetHostImpl* host_;
440
441   aura::Window* window_;
442
443   scoped_ptr<DelegatedFrameHost> delegated_frame_host_;
444
445   scoped_ptr<WindowObserver> window_observer_;
446
447   // Are we in the process of closing?  Tracked so fullscreen views can avoid
448   // sending a second shutdown request to the host when they lose the focus
449   // after requesting shutdown for another reason (e.g. Escape key).
450   bool in_shutdown_;
451
452   // True if in the process of handling a window bounds changed notification.
453   bool in_bounds_changed_;
454
455   // Is this a fullscreen view?
456   bool is_fullscreen_;
457
458   // Our parent host view, if this is a popup.  NULL otherwise.
459   RenderWidgetHostViewAura* popup_parent_host_view_;
460
461   // Our child popup host. NULL if we do not have a child popup.
462   RenderWidgetHostViewAura* popup_child_host_view_;
463
464   class EventFilterForPopupExit;
465   friend class EventFilterForPopupExit;
466   scoped_ptr<ui::EventHandler> event_filter_for_popup_exit_;
467
468   // True when content is being loaded. Used to show an hourglass cursor.
469   bool is_loading_;
470
471   // The cursor for the page. This is passed up from the renderer.
472   WebCursor current_cursor_;
473
474   // The touch-event. Its touch-points are updated as necessary. A new
475   // touch-point is added from an ET_TOUCH_PRESSED event, and a touch-point is
476   // removed from the list on an ET_TOUCH_RELEASED event.
477   blink::WebTouchEvent touch_event_;
478
479   // The current text input type.
480   ui::TextInputType text_input_type_;
481   // The current text input mode corresponding to HTML5 inputmode attribute.
482   ui::TextInputMode text_input_mode_;
483   bool can_compose_inline_;
484
485   // Rectangles for the selection anchor and focus.
486   gfx::Rect selection_anchor_rect_;
487   gfx::Rect selection_focus_rect_;
488
489   // The current composition character bounds.
490   std::vector<gfx::Rect> composition_character_bounds_;
491
492   // Indicates if there is onging composition text.
493   bool has_composition_text_;
494
495   // Whether return characters should be passed on to the RenderWidgetHostImpl.
496   bool accept_return_character_;
497
498   // Current tooltip text.
499   base::string16 tooltip_;
500
501   // The size and scale of the last software compositing frame that was swapped.
502   gfx::Size last_swapped_software_frame_size_;
503   float last_swapped_software_frame_scale_factor_;
504
505   // If non-NULL we're in OnPaint() and this is the supplied canvas.
506   gfx::Canvas* paint_canvas_;
507
508   // Used to record the last position of the mouse.
509   // While the mouse is locked, they store the last known position just as mouse
510   // lock was entered.
511   // Relative to the upper-left corner of the view.
512   gfx::Point unlocked_mouse_position_;
513   // Relative to the upper-left corner of the screen.
514   gfx::Point unlocked_global_mouse_position_;
515   // Last cursor position relative to screen. Used to compute movementX/Y.
516   gfx::Point global_mouse_position_;
517   // In mouse locked mode, we syntheticaly move the mouse cursor to the center
518   // of the window when it reaches the window borders to avoid it going outside.
519   // This flag is used to differentiate between these synthetic mouse move
520   // events vs. normal mouse move events.
521   bool synthetic_move_sent_;
522
523   // Used to track the state of the window we're created from. Only used when
524   // created fullscreen.
525   scoped_ptr<aura::WindowTracker> host_tracker_;
526
527   // Used to track the last cursor visibility update that was sent to the
528   // renderer via NotifyRendererOfCursorVisibilityState().
529   enum CursorVisibilityState {
530     UNKNOWN,
531     VISIBLE,
532     NOT_VISIBLE,
533   };
534   CursorVisibilityState cursor_visibility_state_in_renderer_;
535
536 #if defined(OS_WIN)
537   // The list of rectangles from constrained windows over this view. Windowed
538   // NPAPI plugins shouldn't draw over them.
539   std::vector<gfx::Rect> constrained_rects_;
540
541   typedef std::map<HWND, WebPluginGeometry> PluginWindowMoves;
542   // Contains information about each windowed plugin's clip and cutout rects (
543   // from the renderer). This is needed because when the transient windoiws
544   // over this view changes, we need this information in order to create a new
545   // region for the HWND.
546   PluginWindowMoves plugin_window_moves_;
547 #endif
548
549   TouchEditingClient* touch_editing_client_;
550
551   gfx::Insets insets_;
552
553   std::vector<ui::LatencyInfo> software_latency_info_;
554
555   scoped_ptr<aura::client::ScopedTooltipDisabler> tooltip_disabler_;
556
557   base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_;
558
559 #if defined(OS_WIN)
560   // The LegacyRenderWidgetHostHWND class provides a dummy HWND which is used
561   // for accessibility, as the container for windowless plugins like
562   // Flash/Silverlight, etc and for legacy drivers for trackpoints/trackpads,
563   // etc.
564   scoped_ptr<content::LegacyRenderWidgetHostHWND>
565       legacy_render_widget_host_HWND_;
566 #endif
567   DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);
568 };
569
570 }  // namespace content
571
572 #endif  // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_