Home | History | Annotate | Download | only in renderer_host
      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 SkBitmap::Config config) 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 void CreateBrowserAccessibilityManagerIfNeeded() OVERRIDE;
    222   virtual bool LockMouse() OVERRIDE;
    223   virtual void UnlockMouse() OVERRIDE;
    224   virtual void OnSwapCompositorFrame(
    225       uint32 output_surface_id,
    226       scoped_ptr<cc::CompositorFrame> frame) OVERRIDE;
    227 
    228 #if defined(OS_WIN)
    229   virtual void SetParentNativeViewAccessible(
    230       gfx::NativeViewAccessible accessible_parent) OVERRIDE;
    231   virtual gfx::NativeViewId GetParentForWindowlessPlugin() const OVERRIDE;
    232 #endif
    233 
    234   // Overridden from ui::TextInputClient:
    235   virtual void SetCompositionText(
    236       const ui::CompositionText& composition) OVERRIDE;
    237   virtual void ConfirmCompositionText() OVERRIDE;
    238   virtual void ClearCompositionText() OVERRIDE;
    239   virtual void InsertText(const base::string16& text) OVERRIDE;
    240   virtual void InsertChar(base::char16 ch, int flags) OVERRIDE;
    241   virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE;
    242   virtual ui::TextInputType GetTextInputType() const OVERRIDE;
    243   virtual ui::TextInputMode GetTextInputMode() const OVERRIDE;
    244   virtual bool CanComposeInline() const OVERRIDE;
    245   virtual gfx::Rect GetCaretBounds() const OVERRIDE;
    246   virtual bool GetCompositionCharacterBounds(uint32 index,
    247                                              gfx::Rect* rect) const OVERRIDE;
    248   virtual bool HasCompositionText() const OVERRIDE;
    249   virtual bool GetTextRange(gfx::Range* range) const OVERRIDE;
    250   virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE;
    251   virtual bool GetSelectionRange(gfx::Range* range) const OVERRIDE;
    252   virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE;
    253   virtual bool DeleteRange(const gfx::Range& range) OVERRIDE;
    254   virtual bool GetTextFromRange(const gfx::Range& range,
    255                                 base::string16* text) const OVERRIDE;
    256   virtual void OnInputMethodChanged() OVERRIDE;
    257   virtual bool ChangeTextDirectionAndLayoutAlignment(
    258       base::i18n::TextDirection direction) OVERRIDE;
    259   virtual void ExtendSelectionAndDelete(size_t before, size_t after) OVERRIDE;
    260   virtual void EnsureCaretInRect(const gfx::Rect& rect) OVERRIDE;
    261   virtual void OnCandidateWindowShown() OVERRIDE;
    262   virtual void OnCandidateWindowUpdated() OVERRIDE;
    263   virtual void OnCandidateWindowHidden() OVERRIDE;
    264   virtual bool IsEditingCommandEnabled(int command_id) OVERRIDE;
    265   virtual void ExecuteEditingCommand(int command_id) OVERRIDE;
    266 
    267   // Overridden from gfx::DisplayObserver:
    268   virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE;
    269   virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE;
    270   virtual void OnDisplayMetricsChanged(const gfx::Display& display,
    271                                        uint32_t metrics) OVERRIDE;
    272 
    273   // Overridden from aura::WindowDelegate:
    274   virtual gfx::Size GetMinimumSize() const OVERRIDE;
    275   virtual gfx::Size GetMaximumSize() const OVERRIDE;
    276   virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
    277                                const gfx::Rect& new_bounds) OVERRIDE;
    278   virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE;
    279   virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE;
    280   virtual bool ShouldDescendIntoChildForEventHandling(
    281       aura::Window* child,
    282       const gfx::Point& location) OVERRIDE;
    283   virtual bool CanFocus() OVERRIDE;
    284   virtual void OnCaptureLost() OVERRIDE;
    285   virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
    286   virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
    287   virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
    288   virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
    289   virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE;
    290   virtual bool HasHitTestMask() const OVERRIDE;
    291   virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE;
    292 
    293   // Overridden from ui::EventHandler:
    294   virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
    295   virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
    296   virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
    297   virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
    298   virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
    299 
    300   // Overridden from aura::client::ActivationDelegate:
    301   virtual bool ShouldActivate() const OVERRIDE;
    302 
    303   // Overridden from aura::client::ActivationChangeObserver:
    304   virtual void OnWindowActivated(aura::Window* gained_activation,
    305                                  aura::Window* lost_activation) OVERRIDE;
    306 
    307   // Overridden from aura::client::CursorClientObserver:
    308   virtual void OnCursorVisibilityChanged(bool is_visible) OVERRIDE;
    309 
    310   // Overridden from aura::client::FocusChangeObserver:
    311   virtual void OnWindowFocused(aura::Window* gained_focus,
    312                                aura::Window* lost_focus) OVERRIDE;
    313 
    314   // Overridden from aura::WindowTreeHostObserver:
    315   virtual void OnHostMoved(const aura::WindowTreeHost* host,
    316                            const gfx::Point& new_origin) OVERRIDE;
    317 
    318 #if defined(OS_WIN)
    319   // Sets the cutout rects from constrained windows. These are rectangles that
    320   // windowed NPAPI plugins shouldn't paint in. Overwrites any previous cutout
    321   // rects.
    322   void UpdateConstrainedWindowRects(const std::vector<gfx::Rect>& rects);
    323 
    324   // Updates the cursor clip region. Used for mouse locking.
    325   void UpdateMouseLockRegion();
    326 #endif
    327 
    328   // Method to indicate if this instance is shutting down or closing.
    329   // TODO(shrikant): Discuss around to see if it makes sense to add this method
    330   // as part of RenderWidgetHostView.
    331   bool IsClosing() const { return in_shutdown_; }
    332 
    333   // Sets whether the overscroll controller should be enabled for this page.
    334   void SetOverscrollControllerEnabled(bool enabled);
    335 
    336   OverscrollController* overscroll_controller() const {
    337     return overscroll_controller_.get();
    338   }
    339 
    340  protected:
    341   virtual ~RenderWidgetHostViewAura();
    342 
    343   // Exposed for tests.
    344   aura::Window* window() { return window_; }
    345   virtual SkBitmap::Config PreferredReadbackFormat() OVERRIDE;
    346   virtual DelegatedFrameHost* GetDelegatedFrameHost() const OVERRIDE;
    347 
    348  private:
    349   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText);
    350   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState);
    351   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
    352                            TouchEventPositionsArentRounded);
    353   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventSyncAsync);
    354   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SwapNotifiesWindow);
    355   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
    356                            SkippedDelegatedFrames);
    357   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, OutputSurfaceIdChange);
    358   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
    359                            DiscardDelegatedFrames);
    360   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
    361                            DiscardDelegatedFramesWithLocking);
    362   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SoftwareDPIChange);
    363   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
    364                            UpdateCursorIfOverSelf);
    365   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraCopyRequestTest,
    366                            DestroyedAfterCopyRequest);
    367   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
    368                            VisibleViewportTest);
    369   FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
    370                            OverscrollResetsOnBlur);
    371 
    372   class WindowObserver;
    373   friend class WindowObserver;
    374 
    375   void UpdateCursorIfOverSelf();
    376 
    377   void SnapToPhysicalPixelBoundary();
    378 
    379   // Set the bounds of the window and handle size changes.  Assumes the caller
    380   // has already adjusted the origin of |rect| to conform to whatever coordinate
    381   // space is required by the aura::Window.
    382   void InternalSetBounds(const gfx::Rect& rect);
    383 
    384 #if defined(OS_WIN)
    385   bool UsesNativeWindowFrame() const;
    386 #endif
    387 
    388   ui::InputMethod* GetInputMethod() const;
    389 
    390   // Returns whether the widget needs an input grab to work properly.
    391   bool NeedsInputGrab();
    392 
    393   // Confirm existing composition text in the webpage and ask the input method
    394   // to cancel its ongoing composition session.
    395   void FinishImeCompositionSession();
    396 
    397   // This method computes movementX/Y and keeps track of mouse location for
    398   // mouse lock on all mouse move events.
    399   void ModifyEventMovementAndCoords(blink::WebMouseEvent* event);
    400 
    401   // Sends an IPC to the renderer process to communicate whether or not
    402   // the mouse cursor is visible anywhere on the screen.
    403   void NotifyRendererOfCursorVisibilityState(bool is_visible);
    404 
    405   // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty
    406   // SchedulePaint() is invoked for |rect|.
    407   void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip);
    408 
    409   // Helper method to determine if, in mouse locked mode, the cursor should be
    410   // moved to center.
    411   bool ShouldMoveToCenter();
    412 
    413   // Called after |window_| is parented to a WindowEventDispatcher.
    414   void AddedToRootWindow();
    415 
    416   // Called prior to removing |window_| from a WindowEventDispatcher.
    417   void RemovingFromRootWindow();
    418 
    419   // DelegatedFrameHostClient implementation.
    420   virtual ui::Compositor* GetCompositor() const OVERRIDE;
    421   virtual ui::Layer* GetLayer() OVERRIDE;
    422   virtual RenderWidgetHostImpl* GetHost() OVERRIDE;
    423   virtual void SchedulePaintInRect(
    424       const gfx::Rect& damage_rect_in_dip) OVERRIDE;
    425   virtual bool IsVisible() OVERRIDE;
    426   virtual scoped_ptr<ResizeLock> CreateResizeLock(
    427       bool defer_compositor_lock) OVERRIDE;
    428   virtual gfx::Size DesiredFrameSize() OVERRIDE;
    429   virtual float CurrentDeviceScaleFactor() OVERRIDE;
    430   virtual gfx::Size ConvertViewSizeToPixel(const gfx::Size& size) OVERRIDE;
    431 
    432   // Detaches |this| from the input method object.
    433   void DetachFromInputMethod();
    434 
    435   // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method
    436   // calls our keybindings handler against the event and send matched
    437   // edit commands to renderer instead.
    438   void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event);
    439 
    440   // Dismisses a Web Popup on a mouse or touch press outside the popup and its
    441   // parent.
    442   void ApplyEventFilterForPopupExit(ui::LocatedEvent* event);
    443 
    444   // Converts |rect| from window coordinate to screen coordinate.
    445   gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const;
    446 
    447   // Converts |rect| from screen coordinate to window coordinate.
    448   gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const;
    449 
    450   // Helper function to set keyboard focus to the main window.
    451   void SetKeyboardFocus();
    452 
    453   RenderFrameHostImpl* GetFocusedFrame();
    454 
    455   // The model object.
    456   RenderWidgetHostImpl* host_;
    457 
    458   aura::Window* window_;
    459 
    460   scoped_ptr<DelegatedFrameHost> delegated_frame_host_;
    461 
    462   scoped_ptr<WindowObserver> window_observer_;
    463 
    464   // Are we in the process of closing?  Tracked so fullscreen views can avoid
    465   // sending a second shutdown request to the host when they lose the focus
    466   // after requesting shutdown for another reason (e.g. Escape key).
    467   bool in_shutdown_;
    468 
    469   // True if in the process of handling a window bounds changed notification.
    470   bool in_bounds_changed_;
    471 
    472   // Is this a fullscreen view?
    473   bool is_fullscreen_;
    474 
    475   // Our parent host view, if this is a popup.  NULL otherwise.
    476   RenderWidgetHostViewAura* popup_parent_host_view_;
    477 
    478   // Our child popup host. NULL if we do not have a child popup.
    479   RenderWidgetHostViewAura* popup_child_host_view_;
    480 
    481   class EventFilterForPopupExit;
    482   friend class EventFilterForPopupExit;
    483   scoped_ptr<ui::EventHandler> event_filter_for_popup_exit_;
    484 
    485   // True when content is being loaded. Used to show an hourglass cursor.
    486   bool is_loading_;
    487 
    488   // The cursor for the page. This is passed up from the renderer.
    489   WebCursor current_cursor_;
    490 
    491   // The touch-event. Its touch-points are updated as necessary. A new
    492   // touch-point is added from an ET_TOUCH_PRESSED event, and a touch-point is
    493   // removed from the list on an ET_TOUCH_RELEASED event.
    494   blink::WebTouchEvent touch_event_;
    495 
    496   // The current text input type.
    497   ui::TextInputType text_input_type_;
    498   // The current text input mode corresponding to HTML5 inputmode attribute.
    499   ui::TextInputMode text_input_mode_;
    500   bool can_compose_inline_;
    501 
    502   // Rectangles for the selection anchor and focus.
    503   gfx::Rect selection_anchor_rect_;
    504   gfx::Rect selection_focus_rect_;
    505 
    506   // The current composition character bounds.
    507   std::vector<gfx::Rect> composition_character_bounds_;
    508 
    509   // Indicates if there is onging composition text.
    510   bool has_composition_text_;
    511 
    512   // Whether return characters should be passed on to the RenderWidgetHostImpl.
    513   bool accept_return_character_;
    514 
    515   // Current tooltip text.
    516   base::string16 tooltip_;
    517 
    518   // The size and scale of the last software compositing frame that was swapped.
    519   gfx::Size last_swapped_software_frame_size_;
    520   float last_swapped_software_frame_scale_factor_;
    521 
    522   // If non-NULL we're in OnPaint() and this is the supplied canvas.
    523   gfx::Canvas* paint_canvas_;
    524 
    525   // Used to record the last position of the mouse.
    526   // While the mouse is locked, they store the last known position just as mouse
    527   // lock was entered.
    528   // Relative to the upper-left corner of the view.
    529   gfx::Point unlocked_mouse_position_;
    530   // Relative to the upper-left corner of the screen.
    531   gfx::Point unlocked_global_mouse_position_;
    532   // Last cursor position relative to screen. Used to compute movementX/Y.
    533   gfx::Point global_mouse_position_;
    534   // In mouse locked mode, we syntheticaly move the mouse cursor to the center
    535   // of the window when it reaches the window borders to avoid it going outside.
    536   // This flag is used to differentiate between these synthetic mouse move
    537   // events vs. normal mouse move events.
    538   bool synthetic_move_sent_;
    539 
    540   // Used to track the state of the window we're created from. Only used when
    541   // created fullscreen.
    542   scoped_ptr<aura::WindowTracker> host_tracker_;
    543 
    544   // Used to track the last cursor visibility update that was sent to the
    545   // renderer via NotifyRendererOfCursorVisibilityState().
    546   enum CursorVisibilityState {
    547     UNKNOWN,
    548     VISIBLE,
    549     NOT_VISIBLE,
    550   };
    551   CursorVisibilityState cursor_visibility_state_in_renderer_;
    552 
    553 #if defined(OS_WIN)
    554   // The list of rectangles from constrained windows over this view. Windowed
    555   // NPAPI plugins shouldn't draw over them.
    556   std::vector<gfx::Rect> constrained_rects_;
    557 
    558   typedef std::map<HWND, WebPluginGeometry> PluginWindowMoves;
    559   // Contains information about each windowed plugin's clip and cutout rects (
    560   // from the renderer). This is needed because when the transient windoiws
    561   // over this view changes, we need this information in order to create a new
    562   // region for the HWND.
    563   PluginWindowMoves plugin_window_moves_;
    564 #endif
    565 
    566   TouchEditingClient* touch_editing_client_;
    567 
    568   scoped_ptr<OverscrollController> overscroll_controller_;
    569 
    570   gfx::Insets insets_;
    571 
    572   std::vector<ui::LatencyInfo> software_latency_info_;
    573 
    574   scoped_ptr<aura::client::ScopedTooltipDisabler> tooltip_disabler_;
    575 
    576   base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_;
    577 
    578 #if defined(OS_WIN)
    579   // The LegacyRenderWidgetHostHWND class provides a dummy HWND which is used
    580   // for accessibility, as the container for windowless plugins like
    581   // Flash/Silverlight, etc and for legacy drivers for trackpoints/trackpads,
    582   // etc.
    583   scoped_ptr<content::LegacyRenderWidgetHostHWND>
    584       legacy_render_widget_host_HWND_;
    585 #endif
    586   DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);
    587 };
    588 
    589 }  // namespace content
    590 
    591 #endif  // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_
    592