Simplify ChildProcessLauncher
[chromium-blink-merge.git] / content / browser / renderer_host / render_widget_host_view_aura.h
blobd3e72e276c095cad708097abc5a6c84aad00f730
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/base/touch/selection_bound.h"
33 #include "ui/base/touch/touch_editing_controller.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_change_observer.h"
39 #include "ui/wm/public/activation_delegate.h"
41 namespace aura {
42 class WindowTracker;
43 namespace client {
44 class ScopedTooltipDisabler;
48 namespace cc {
49 class CopyOutputRequest;
50 class CopyOutputResult;
51 class DelegatedFrameData;
54 namespace gfx {
55 class Canvas;
56 class Display;
59 namespace gpu {
60 struct Mailbox;
63 namespace ui {
64 class CompositorLock;
65 class InputMethod;
66 class LocatedEvent;
67 class Texture;
70 namespace content {
71 #if defined(OS_WIN)
72 class LegacyRenderWidgetHostHWND;
73 #endif
75 class OverscrollController;
76 class RenderFrameHostImpl;
77 class RenderWidgetHostImpl;
78 class RenderWidgetHostView;
80 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
81 class CONTENT_EXPORT RenderWidgetHostViewAura
82 : public RenderWidgetHostViewBase,
83 public DelegatedFrameHostClient,
84 public ui::TextInputClient,
85 public gfx::DisplayObserver,
86 public aura::WindowTreeHostObserver,
87 public aura::WindowDelegate,
88 public aura::client::ActivationDelegate,
89 public aura::client::ActivationChangeObserver,
90 public aura::client::FocusChangeObserver,
91 public aura::client::CursorClientObserver {
92 public:
93 // Displays and controls touch editing elements such as selection handles.
94 class TouchEditingClient {
95 public:
96 TouchEditingClient() {}
98 // Tells the client to start showing touch editing handles.
99 virtual void StartTouchEditing() = 0;
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;
105 // Notifies the client that the selection bounds need to be updated.
106 virtual void OnSelectionOrCursorChanged(
107 const ui::SelectionBound& anchor,
108 const ui::SelectionBound& focus) = 0;
110 // Notifies the client that the current text input type as changed.
111 virtual void OnTextInputTypeChanged(ui::TextInputType type) = 0;
113 // Notifies the client that an input event is about to be sent to the
114 // renderer. Returns true if the client wants to stop event propagation.
115 virtual bool HandleInputEvent(const ui::Event* event) = 0;
117 // Notifies the client that a gesture event ack was received.
118 virtual void GestureEventAck(int gesture_event_type) = 0;
120 // Notifies the client that the fling has ended, so it can activate touch
121 // editing if needed.
122 virtual void DidStopFlinging() = 0;
124 // This is called when the view is destroyed, so that the client can
125 // perform any necessary clean-up.
126 virtual void OnViewDestroyed() = 0;
128 protected:
129 virtual ~TouchEditingClient() {}
132 void set_touch_editing_client(TouchEditingClient* client) {
133 touch_editing_client_ = client;
136 // When |is_guest_view_hack| is true, this view isn't really the view for
137 // the |widget|, a RenderWidgetHostViewGuest is.
139 // TODO(lazyboy): Remove |is_guest_view_hack| once BrowserPlugin has migrated
140 // to use RWHVChildFrame (http://crbug.com/330264).
141 RenderWidgetHostViewAura(RenderWidgetHost* host, bool is_guest_view_hack);
143 // RenderWidgetHostView implementation.
144 bool OnMessageReceived(const IPC::Message& msg) override;
145 void InitAsChild(gfx::NativeView parent_view) override;
146 RenderWidgetHost* GetRenderWidgetHost() const override;
147 void SetSize(const gfx::Size& size) override;
148 void SetBounds(const gfx::Rect& rect) override;
149 gfx::Vector2dF GetLastScrollOffset() const override;
150 gfx::NativeView GetNativeView() const override;
151 gfx::NativeViewId GetNativeViewId() const override;
152 gfx::NativeViewAccessible GetNativeViewAccessible() override;
153 ui::TextInputClient* GetTextInputClient() override;
154 bool HasFocus() const override;
155 bool IsSurfaceAvailableForCopy() const override;
156 void Show() override;
157 void Hide() override;
158 bool IsShowing() override;
159 gfx::Rect GetViewBounds() const override;
160 void SetBackgroundColor(SkColor color) override;
161 gfx::Size GetVisibleViewportSize() const override;
162 void SetInsets(const gfx::Insets& insets) override;
164 // Overridden from RenderWidgetHostViewBase:
165 void InitAsPopup(RenderWidgetHostView* parent_host_view,
166 const gfx::Rect& pos) override;
167 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override;
168 void MovePluginWindows(const std::vector<WebPluginGeometry>& moves) override;
169 void Focus() override;
170 void Blur() override;
171 void UpdateCursor(const WebCursor& cursor) override;
172 void SetIsLoading(bool is_loading) override;
173 void TextInputTypeChanged(ui::TextInputType type,
174 ui::TextInputMode input_mode,
175 bool can_compose_inline,
176 int flags) override;
177 void ImeCancelComposition() override;
178 void ImeCompositionRangeChanged(
179 const gfx::Range& range,
180 const std::vector<gfx::Rect>& character_bounds) override;
181 void RenderProcessGone(base::TerminationStatus status,
182 int error_code) override;
183 void Destroy() override;
184 void SetTooltipText(const base::string16& tooltip_text) override;
185 void SelectionChanged(const base::string16& text,
186 size_t offset,
187 const gfx::Range& range) override;
188 gfx::Size GetRequestedRendererSize() const override;
189 void SelectionBoundsChanged(
190 const ViewHostMsg_SelectionBounds_Params& params) override;
191 void CopyFromCompositingSurface(const gfx::Rect& src_subrect,
192 const gfx::Size& dst_size,
193 ReadbackRequestCallback& callback,
194 const SkColorType color_type) override;
195 void CopyFromCompositingSurfaceToVideoFrame(
196 const gfx::Rect& src_subrect,
197 const scoped_refptr<media::VideoFrame>& target,
198 const base::Callback<void(bool)>& callback) override;
199 bool CanCopyToVideoFrame() const override;
200 bool CanSubscribeFrame() const override;
201 void BeginFrameSubscription(
202 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) override;
203 void EndFrameSubscription() override;
204 bool HasAcceleratedSurface(const gfx::Size& desired_size) override;
205 void GetScreenInfo(blink::WebScreenInfo* results) override;
206 gfx::Rect GetBoundsInRootWindow() override;
207 void WheelEventAck(const blink::WebMouseWheelEvent& event,
208 InputEventAckState ack_result) override;
209 void GestureEventAck(const blink::WebGestureEvent& event,
210 InputEventAckState ack_result) override;
211 void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch,
212 InputEventAckState ack_result) override;
213 scoped_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget() override;
214 InputEventAckState FilterInputEvent(
215 const blink::WebInputEvent& input_event) override;
216 gfx::GLSurfaceHandle GetCompositingSurface() override;
217 BrowserAccessibilityManager* CreateBrowserAccessibilityManager(
218 BrowserAccessibilityDelegate* delegate) override;
219 gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() override;
220 gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() override;
221 void ShowDisambiguationPopup(const gfx::Rect& rect_pixels,
222 const SkBitmap& zoomed_bitmap) override;
223 bool LockMouse() override;
224 void UnlockMouse() override;
225 void OnSwapCompositorFrame(uint32 output_surface_id,
226 scoped_ptr<cc::CompositorFrame> frame) override;
227 void DidStopFlinging() override;
228 void OnDidNavigateMainFrameToNewPage() override;
230 #if defined(OS_WIN)
231 virtual void SetParentNativeViewAccessible(
232 gfx::NativeViewAccessible accessible_parent) override;
233 virtual gfx::NativeViewId GetParentForWindowlessPlugin() const override;
234 #endif
236 // Overridden from ui::TextInputClient:
237 void SetCompositionText(const ui::CompositionText& composition) override;
238 void ConfirmCompositionText() override;
239 void ClearCompositionText() override;
240 void InsertText(const base::string16& text) override;
241 void InsertChar(base::char16 ch, int flags) override;
242 gfx::NativeWindow GetAttachedWindow() const override;
243 ui::TextInputType GetTextInputType() const override;
244 ui::TextInputMode GetTextInputMode() const override;
245 int GetTextInputFlags() const override;
246 bool CanComposeInline() const override;
247 gfx::Rect GetCaretBounds() const override;
248 bool GetCompositionCharacterBounds(uint32 index,
249 gfx::Rect* rect) const override;
250 bool HasCompositionText() const override;
251 bool GetTextRange(gfx::Range* range) const override;
252 bool GetCompositionTextRange(gfx::Range* range) const override;
253 bool GetSelectionRange(gfx::Range* range) const override;
254 bool SetSelectionRange(const gfx::Range& range) override;
255 bool DeleteRange(const gfx::Range& range) override;
256 bool GetTextFromRange(const gfx::Range& range,
257 base::string16* text) const override;
258 void OnInputMethodChanged() override;
259 bool ChangeTextDirectionAndLayoutAlignment(
260 base::i18n::TextDirection direction) override;
261 void ExtendSelectionAndDelete(size_t before, size_t after) override;
262 void EnsureCaretInRect(const gfx::Rect& rect) override;
263 void OnCandidateWindowShown() override;
264 void OnCandidateWindowUpdated() override;
265 void OnCandidateWindowHidden() override;
266 bool IsEditCommandEnabled(int command_id) override;
267 void SetEditCommandForNextKeyEvent(int command_id) override;
269 // Overridden from gfx::DisplayObserver:
270 void OnDisplayAdded(const gfx::Display& new_display) override;
271 void OnDisplayRemoved(const gfx::Display& old_display) override;
272 void OnDisplayMetricsChanged(const gfx::Display& display,
273 uint32_t metrics) override;
275 // Overridden from aura::WindowDelegate:
276 gfx::Size GetMinimumSize() const override;
277 gfx::Size GetMaximumSize() const override;
278 void OnBoundsChanged(const gfx::Rect& old_bounds,
279 const gfx::Rect& new_bounds) override;
280 ui::TextInputClient* GetFocusedTextInputClient() override;
281 gfx::NativeCursor GetCursor(const gfx::Point& point) override;
282 int GetNonClientComponent(const gfx::Point& point) const override;
283 bool ShouldDescendIntoChildForEventHandling(
284 aura::Window* child,
285 const gfx::Point& location) override;
286 bool CanFocus() override;
287 void OnCaptureLost() override;
288 void OnPaint(gfx::Canvas* canvas) override;
289 void OnDeviceScaleFactorChanged(float device_scale_factor) override;
290 void OnWindowDestroying(aura::Window* window) override;
291 void OnWindowDestroyed(aura::Window* window) override;
292 void OnWindowTargetVisibilityChanged(bool visible) override;
293 bool HasHitTestMask() const override;
294 void GetHitTestMask(gfx::Path* mask) const override;
296 // Overridden from ui::EventHandler:
297 void OnKeyEvent(ui::KeyEvent* event) override;
298 void OnMouseEvent(ui::MouseEvent* event) override;
299 void OnScrollEvent(ui::ScrollEvent* event) override;
300 void OnTouchEvent(ui::TouchEvent* event) override;
301 void OnGestureEvent(ui::GestureEvent* event) override;
303 // Overridden from aura::client::ActivationDelegate:
304 bool ShouldActivate() const override;
306 // Overridden from aura::client::ActivationChangeObserver:
307 void OnWindowActivated(aura::Window* gained_activation,
308 aura::Window* lost_activation) override;
310 // Overridden from aura::client::CursorClientObserver:
311 void OnCursorVisibilityChanged(bool is_visible) override;
313 // Overridden from aura::client::FocusChangeObserver:
314 void OnWindowFocused(aura::Window* gained_focus,
315 aura::Window* lost_focus) override;
317 // Overridden from aura::WindowTreeHostObserver:
318 void OnHostMoved(const aura::WindowTreeHost* host,
319 const gfx::Point& new_origin) override;
321 void OnTextInputStateChanged(const ViewHostMsg_TextInputState_Params& params);
323 #if defined(OS_WIN)
324 // Sets the cutout rects from constrained windows. These are rectangles that
325 // windowed NPAPI plugins shouldn't paint in. Overwrites any previous cutout
326 // rects.
327 void UpdateConstrainedWindowRects(const std::vector<gfx::Rect>& rects);
329 // Updates the cursor clip region. Used for mouse locking.
330 void UpdateMouseLockRegion();
332 // Notification that the LegacyRenderWidgetHostHWND was destroyed.
333 void OnLegacyWindowDestroyed();
334 #endif
336 void DisambiguationPopupRendered(const SkBitmap& result,
337 ReadbackResponse response);
339 void HideDisambiguationPopup();
341 void ProcessDisambiguationGesture(ui::GestureEvent* event);
343 void ProcessDisambiguationMouse(ui::MouseEvent* event);
345 // Method to indicate if this instance is shutting down or closing.
346 // TODO(shrikant): Discuss around to see if it makes sense to add this method
347 // as part of RenderWidgetHostView.
348 bool IsClosing() const { return in_shutdown_; }
350 // Sets whether the overscroll controller should be enabled for this page.
351 void SetOverscrollControllerEnabled(bool enabled);
353 void SnapToPhysicalPixelBoundary();
355 OverscrollController* overscroll_controller() const {
356 return overscroll_controller_.get();
359 protected:
360 ~RenderWidgetHostViewAura() override;
362 // Exposed for tests.
363 aura::Window* window() { return window_; }
364 SkColorType PreferredReadbackFormat() override;
365 DelegatedFrameHost* GetDelegatedFrameHost() const {
366 return delegated_frame_host_.get();
368 const ui::MotionEventAura& pointer_state() const { return pointer_state_; }
370 private:
371 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
372 PopupRetainsCaptureAfterMouseRelease);
373 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText);
374 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState);
375 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
376 TouchEventPositionsArentRounded);
377 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventSyncAsync);
378 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, Resize);
379 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SwapNotifiesWindow);
380 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, RecreateLayers);
381 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
382 SkippedDelegatedFrames);
383 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, OutputSurfaceIdChange);
384 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
385 DiscardDelegatedFrames);
386 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
387 DiscardDelegatedFramesWithLocking);
388 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SoftwareDPIChange);
389 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
390 UpdateCursorIfOverSelf);
391 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraCopyRequestTest,
392 DestroyedAfterCopyRequest);
393 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
394 VisibleViewportTest);
395 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
396 OverscrollResetsOnBlur);
397 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
398 FinishCompositionByMouse);
399 FRIEND_TEST_ALL_PREFIXES(WebContentsViewAuraTest,
400 WebContentsViewReparent);
402 class WindowObserver;
403 friend class WindowObserver;
405 void UpdateCursorIfOverSelf();
407 // Tracks whether SnapToPhysicalPixelBoundary() has been called.
408 bool has_snapped_to_boundary() { return has_snapped_to_boundary_; }
409 void ResetHasSnappedToBoundary() { has_snapped_to_boundary_ = false; }
411 // Set the bounds of the window and handle size changes. Assumes the caller
412 // has already adjusted the origin of |rect| to conform to whatever coordinate
413 // space is required by the aura::Window.
414 void InternalSetBounds(const gfx::Rect& rect);
416 #if defined(OS_WIN)
417 bool UsesNativeWindowFrame() const;
418 #endif
420 ui::InputMethod* GetInputMethod() const;
422 // Sends shutdown request.
423 void Shutdown();
425 // Returns whether the widget needs an input grab to work properly.
426 bool NeedsInputGrab();
428 // Returns whether the widget needs to grab mouse capture to work properly.
429 bool NeedsMouseCapture();
431 // Confirm existing composition text in the webpage and ask the input method
432 // to cancel its ongoing composition session.
433 void FinishImeCompositionSession();
435 // This method computes movementX/Y and keeps track of mouse location for
436 // mouse lock on all mouse move events.
437 void ModifyEventMovementAndCoords(blink::WebMouseEvent* event);
439 // Sends an IPC to the renderer process to communicate whether or not
440 // the mouse cursor is visible anywhere on the screen.
441 void NotifyRendererOfCursorVisibilityState(bool is_visible);
443 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty
444 // SchedulePaint() is invoked for |rect|.
445 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip);
447 // Helper method to determine if, in mouse locked mode, the cursor should be
448 // moved to center.
449 bool ShouldMoveToCenter();
451 // Called after |window_| is parented to a WindowEventDispatcher.
452 void AddedToRootWindow();
454 // Called prior to removing |window_| from a WindowEventDispatcher.
455 void RemovingFromRootWindow();
457 // DelegatedFrameHostClient implementation.
458 ui::Layer* DelegatedFrameHostGetLayer() const override;
459 bool DelegatedFrameHostIsVisible() const override;
460 gfx::Size DelegatedFrameHostDesiredSizeInDIP() const override;
461 bool DelegatedFrameCanCreateResizeLock() const override;
462 scoped_ptr<ResizeLock> DelegatedFrameHostCreateResizeLock(
463 bool defer_compositor_lock) override;
464 void DelegatedFrameHostResizeLockWasReleased() override;
465 void DelegatedFrameHostSendCompositorSwapAck(
466 int output_surface_id,
467 const cc::CompositorFrameAck& ack) override;
468 void DelegatedFrameHostSendReclaimCompositorResources(
469 int output_surface_id,
470 const cc::CompositorFrameAck& ack) override;
471 void DelegatedFrameHostOnLostCompositorResources() override;
472 void DelegatedFrameHostUpdateVSyncParameters(
473 const base::TimeTicks& timebase,
474 const base::TimeDelta& interval) override;
476 // Detaches |this| from the input method object.
477 void DetachFromInputMethod();
479 // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method
480 // calls our keybindings handler against the event and send matched
481 // edit commands to renderer instead.
482 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event);
484 // Dismisses a Web Popup on a mouse or touch press outside the popup and its
485 // parent.
486 void ApplyEventFilterForPopupExit(ui::LocatedEvent* event);
488 // Converts |rect| from window coordinate to screen coordinate.
489 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const;
491 // Converts |rect| from screen coordinate to window coordinate.
492 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const;
494 // Helper function to set keyboard focus to the main window.
495 void SetKeyboardFocus();
497 RenderFrameHostImpl* GetFocusedFrame();
499 // The model object.
500 RenderWidgetHostImpl* host_;
502 aura::Window* window_;
504 scoped_ptr<DelegatedFrameHost> delegated_frame_host_;
506 scoped_ptr<WindowObserver> window_observer_;
508 // Are we in the process of closing? Tracked so fullscreen views can avoid
509 // sending a second shutdown request to the host when they lose the focus
510 // after requesting shutdown for another reason (e.g. Escape key).
511 bool in_shutdown_;
513 // True if in the process of handling a window bounds changed notification.
514 bool in_bounds_changed_;
516 // Is this a fullscreen view?
517 bool is_fullscreen_;
519 // Our parent host view, if this is a popup. NULL otherwise.
520 RenderWidgetHostViewAura* popup_parent_host_view_;
522 // Our child popup host. NULL if we do not have a child popup.
523 RenderWidgetHostViewAura* popup_child_host_view_;
525 class EventFilterForPopupExit;
526 friend class EventFilterForPopupExit;
527 scoped_ptr<ui::EventHandler> event_filter_for_popup_exit_;
529 // True when content is being loaded. Used to show an hourglass cursor.
530 bool is_loading_;
532 // The cursor for the page. This is passed up from the renderer.
533 WebCursor current_cursor_;
535 // Stores the current state of the active pointers targeting this
536 // object.
537 ui::MotionEventAura pointer_state_;
539 // The current text input type.
540 ui::TextInputType text_input_type_;
541 // The current text input mode corresponding to HTML5 inputmode attribute.
542 ui::TextInputMode text_input_mode_;
543 // The current text input flags.
544 int text_input_flags_;
545 bool can_compose_inline_;
547 // Bounds for the selection.
548 ui::SelectionBound selection_anchor_;
549 ui::SelectionBound selection_focus_;
551 // The current composition character bounds.
552 std::vector<gfx::Rect> composition_character_bounds_;
554 // Indicates if there is onging composition text.
555 bool has_composition_text_;
557 // Whether return characters should be passed on to the RenderWidgetHostImpl.
558 bool accept_return_character_;
560 // Current tooltip text.
561 base::string16 tooltip_;
563 // The size and scale of the last software compositing frame that was swapped.
564 gfx::Size last_swapped_software_frame_size_;
565 float last_swapped_software_frame_scale_factor_;
567 // If non-NULL we're in OnPaint() and this is the supplied canvas.
568 gfx::Canvas* paint_canvas_;
570 // Used to record the last position of the mouse.
571 // While the mouse is locked, they store the last known position just as mouse
572 // lock was entered.
573 // Relative to the upper-left corner of the view.
574 gfx::Point unlocked_mouse_position_;
575 // Relative to the upper-left corner of the screen.
576 gfx::Point unlocked_global_mouse_position_;
577 // Last cursor position relative to screen. Used to compute movementX/Y.
578 gfx::Point global_mouse_position_;
579 // In mouse locked mode, we synthetically move the mouse cursor to the center
580 // of the window when it reaches the window borders to avoid it going outside.
581 // This flag is used to differentiate between these synthetic mouse move
582 // events vs. normal mouse move events.
583 bool synthetic_move_sent_;
585 // Used to track the state of the window we're created from. Only used when
586 // created fullscreen.
587 scoped_ptr<aura::WindowTracker> host_tracker_;
589 // Used to track the last cursor visibility update that was sent to the
590 // renderer via NotifyRendererOfCursorVisibilityState().
591 enum CursorVisibilityState {
592 UNKNOWN,
593 VISIBLE,
594 NOT_VISIBLE,
596 CursorVisibilityState cursor_visibility_state_in_renderer_;
598 #if defined(OS_WIN)
599 // The list of rectangles from constrained windows over this view. Windowed
600 // NPAPI plugins shouldn't draw over them.
601 std::vector<gfx::Rect> constrained_rects_;
603 typedef std::map<HWND, WebPluginGeometry> PluginWindowMoves;
604 // Contains information about each windowed plugin's clip and cutout rects (
605 // from the renderer). This is needed because when the transient windows
606 // over this view changes, we need this information in order to create a new
607 // region for the HWND.
608 PluginWindowMoves plugin_window_moves_;
610 // The LegacyRenderWidgetHostHWND class provides a dummy HWND which is used
611 // for accessibility, as the container for windowless plugins like
612 // Flash/Silverlight, etc and for legacy drivers for trackpoints/trackpads,
613 // etc.
614 // The LegacyRenderWidgetHostHWND instance is created during the first call
615 // to RenderWidgetHostViewAura::InternalSetBounds. The instance is destroyed
616 // when the LegacyRenderWidgetHostHWND hwnd is destroyed.
617 content::LegacyRenderWidgetHostHWND* legacy_render_widget_host_HWND_;
619 // Set to true if the legacy_render_widget_host_HWND_ instance was destroyed
620 // by Windows. This could happen if the browser window was destroyed by
621 // DestroyWindow for e.g. This flag helps ensure that we don't try to create
622 // the LegacyRenderWidgetHostHWND instance again as that would be a futile
623 // exercise.
624 bool legacy_window_destroyed_;
625 #endif
627 bool has_snapped_to_boundary_;
629 TouchEditingClient* touch_editing_client_;
631 scoped_ptr<OverscrollController> overscroll_controller_;
633 // The last scroll offset of the view.
634 gfx::Vector2dF last_scroll_offset_;
636 gfx::Insets insets_;
638 std::vector<ui::LatencyInfo> software_latency_info_;
640 scoped_ptr<aura::client::ScopedTooltipDisabler> tooltip_disabler_;
642 // True when this view acts as a platform view hack for a
643 // RenderWidgetHostViewGuest.
644 bool is_guest_view_hack_;
646 gfx::Rect disambiguation_target_rect_;
648 // The last scroll offset when we start to render the link disambiguation
649 // view, so we can ensure the window hasn't moved between copying from the
650 // compositing surface and showing the disambiguation popup.
651 gfx::Vector2dF disambiguation_scroll_offset_;
653 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_;
654 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);
657 } // namespace content
659 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_