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