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