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