DevTools: cut host and port from webSocketDebuggerUrl in addition to ws:// prefix
[chromium-blink-merge.git] / content / browser / renderer_host / render_widget_host_view_aura.h
blobe0f76f1d4a5f7476a553a10b91f40861e6561ba4
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/base/touch/touch_editing_controller.h"
35 #include "ui/events/gestures/motion_event_aura.h"
36 #include "ui/gfx/display_observer.h"
37 #include "ui/gfx/geometry/insets.h"
38 #include "ui/gfx/geometry/rect.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 BeginFrameObserverProxyClient,
85 public ui::TextInputClient,
86 public gfx::DisplayObserver,
87 public aura::WindowTreeHostObserver,
88 public aura::WindowDelegate,
89 public aura::client::ActivationDelegate,
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 UpdateCursor(const WebCursor& cursor) override;
171 void SetIsLoading(bool is_loading) override;
172 void TextInputTypeChanged(ui::TextInputType type,
173 ui::TextInputMode input_mode,
174 bool can_compose_inline,
175 int flags) override;
176 void ImeCancelComposition() override;
177 void ImeCompositionRangeChanged(
178 const gfx::Range& range,
179 const std::vector<gfx::Rect>& character_bounds) override;
180 void RenderProcessGone(base::TerminationStatus status,
181 int error_code) override;
182 void Destroy() override;
183 void SetTooltipText(const base::string16& tooltip_text) override;
184 void SelectionChanged(const base::string16& text,
185 size_t offset,
186 const gfx::Range& range) override;
187 gfx::Size GetRequestedRendererSize() const override;
188 void SelectionBoundsChanged(
189 const ViewHostMsg_SelectionBounds_Params& params) override;
190 void CopyFromCompositingSurface(
191 const gfx::Rect& src_subrect,
192 const gfx::Size& dst_size,
193 ReadbackRequestCallback& callback,
194 const SkColorType preferred_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;
229 uint32_t GetSurfaceIdNamespace() override;
231 #if defined(OS_WIN)
232 void SetParentNativeViewAccessible(
233 gfx::NativeViewAccessible accessible_parent) override;
234 gfx::NativeViewId GetParentForWindowlessPlugin() const override;
235 #endif
237 // Overridden from ui::TextInputClient:
238 void SetCompositionText(const ui::CompositionText& composition) override;
239 void ConfirmCompositionText() override;
240 void ClearCompositionText() override;
241 void InsertText(const base::string16& text) override;
242 void InsertChar(base::char16 ch, int flags) 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 bool IsEditCommandEnabled(int command_id) override;
264 void SetEditCommandForNextKeyEvent(int command_id) override;
266 // Overridden from gfx::DisplayObserver:
267 void OnDisplayAdded(const gfx::Display& new_display) override;
268 void OnDisplayRemoved(const gfx::Display& old_display) override;
269 void OnDisplayMetricsChanged(const gfx::Display& display,
270 uint32_t metrics) override;
272 // Overridden from aura::WindowDelegate:
273 gfx::Size GetMinimumSize() const override;
274 gfx::Size GetMaximumSize() const override;
275 void OnBoundsChanged(const gfx::Rect& old_bounds,
276 const gfx::Rect& new_bounds) override;
277 gfx::NativeCursor GetCursor(const gfx::Point& point) override;
278 int GetNonClientComponent(const gfx::Point& point) const override;
279 bool ShouldDescendIntoChildForEventHandling(
280 aura::Window* child,
281 const gfx::Point& location) override;
282 bool CanFocus() override;
283 void OnCaptureLost() override;
284 void OnPaint(const ui::PaintContext& context) override;
285 void OnDeviceScaleFactorChanged(float device_scale_factor) override;
286 void OnWindowDestroying(aura::Window* window) override;
287 void OnWindowDestroyed(aura::Window* window) override;
288 void OnWindowTargetVisibilityChanged(bool visible) override;
289 bool HasHitTestMask() const override;
290 void GetHitTestMask(gfx::Path* mask) const override;
292 // Overridden from ui::EventHandler:
293 void OnKeyEvent(ui::KeyEvent* event) override;
294 void OnMouseEvent(ui::MouseEvent* event) override;
295 void OnScrollEvent(ui::ScrollEvent* event) override;
296 void OnTouchEvent(ui::TouchEvent* event) override;
297 void OnGestureEvent(ui::GestureEvent* event) override;
299 // Overridden from aura::client::ActivationDelegate:
300 bool ShouldActivate() const override;
302 // Overridden from aura::client::CursorClientObserver:
303 void OnCursorVisibilityChanged(bool is_visible) override;
305 // Overridden from aura::client::FocusChangeObserver:
306 void OnWindowFocused(aura::Window* gained_focus,
307 aura::Window* lost_focus) override;
309 // Overridden from aura::WindowTreeHostObserver:
310 void OnHostMoved(const aura::WindowTreeHost* host,
311 const gfx::Point& new_origin) override;
313 void OnTextInputStateChanged(const ViewHostMsg_TextInputState_Params& params);
315 #if defined(OS_WIN)
316 // Sets the cutout rects from constrained windows. These are rectangles that
317 // windowed NPAPI plugins shouldn't paint in. Overwrites any previous cutout
318 // rects.
319 void UpdateConstrainedWindowRects(const std::vector<gfx::Rect>& rects);
321 // Updates the cursor clip region. Used for mouse locking.
322 void UpdateMouseLockRegion();
324 // Notification that the LegacyRenderWidgetHostHWND was destroyed.
325 void OnLegacyWindowDestroyed();
326 #endif
328 void DisambiguationPopupRendered(const SkBitmap& result,
329 ReadbackResponse response);
331 void HideDisambiguationPopup();
333 void ProcessDisambiguationGesture(ui::GestureEvent* event);
335 void ProcessDisambiguationMouse(ui::MouseEvent* event);
337 // Method to indicate if this instance is shutting down or closing.
338 // TODO(shrikant): Discuss around to see if it makes sense to add this method
339 // as part of RenderWidgetHostView.
340 bool IsClosing() const { return in_shutdown_; }
342 // Sets whether the overscroll controller should be enabled for this page.
343 void SetOverscrollControllerEnabled(bool enabled);
345 void SnapToPhysicalPixelBoundary();
347 OverscrollController* overscroll_controller() const {
348 return overscroll_controller_.get();
351 // Called when the context menu is about to be displayed.
352 void OnShowContextMenu();
354 protected:
355 ~RenderWidgetHostViewAura() override;
357 // Exposed for tests.
358 aura::Window* window() { return window_; }
360 DelegatedFrameHost* GetDelegatedFrameHost() const {
361 return delegated_frame_host_.get();
363 const ui::MotionEventAura& pointer_state() const { return pointer_state_; }
365 private:
366 friend class RenderWidgetHostViewAuraCopyRequestTest;
367 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
368 PopupRetainsCaptureAfterMouseRelease);
369 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText);
370 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState);
371 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
372 TouchEventPositionsArentRounded);
373 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventSyncAsync);
374 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, Resize);
375 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SwapNotifiesWindow);
376 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, RecreateLayers);
377 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
378 SkippedDelegatedFrames);
379 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, OutputSurfaceIdChange);
380 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
381 DiscardDelegatedFrames);
382 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
383 DiscardDelegatedFramesWithLocking);
384 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SoftwareDPIChange);
385 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
386 UpdateCursorIfOverSelf);
387 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
388 VisibleViewportTest);
389 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
390 OverscrollResetsOnBlur);
391 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
392 FinishCompositionByMouse);
393 FRIEND_TEST_ALL_PREFIXES(WebContentsViewAuraTest,
394 WebContentsViewReparent);
396 class WindowObserver;
397 friend class WindowObserver;
399 class WindowAncestorObserver;
400 friend class WindowAncestorObserver;
402 void UpdateCursorIfOverSelf();
404 // Tracks whether SnapToPhysicalPixelBoundary() has been called.
405 bool has_snapped_to_boundary() { return has_snapped_to_boundary_; }
406 void ResetHasSnappedToBoundary() { has_snapped_to_boundary_ = false; }
408 // Set the bounds of the window and handle size changes. Assumes the caller
409 // has already adjusted the origin of |rect| to conform to whatever coordinate
410 // space is required by the aura::Window.
411 void InternalSetBounds(const gfx::Rect& rect);
413 #if defined(OS_WIN)
414 bool UsesNativeWindowFrame() const;
415 #endif
417 ui::InputMethod* GetInputMethod() const;
419 // Sends shutdown request.
420 void Shutdown();
422 // Returns whether the widget needs an input grab to work properly.
423 bool NeedsInputGrab();
425 // Returns whether the widget needs to grab mouse capture to work properly.
426 bool NeedsMouseCapture();
428 // Confirm existing composition text in the webpage and ask the input method
429 // to cancel its ongoing composition session.
430 void FinishImeCompositionSession();
432 // This method computes movementX/Y and keeps track of mouse location for
433 // mouse lock on all mouse move events.
434 void ModifyEventMovementAndCoords(blink::WebMouseEvent* event);
436 // Sends an IPC to the renderer process to communicate whether or not
437 // the mouse cursor is visible anywhere on the screen.
438 void NotifyRendererOfCursorVisibilityState(bool is_visible);
440 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty
441 // SchedulePaint() is invoked for |rect|.
442 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip);
444 // Helper method to determine if, in mouse locked mode, the cursor should be
445 // moved to center.
446 bool ShouldMoveToCenter();
448 // Called after |window_| is parented to a WindowEventDispatcher.
449 void AddedToRootWindow();
451 // Called prior to removing |window_| from a WindowEventDispatcher.
452 void RemovingFromRootWindow();
454 // DelegatedFrameHostClient implementation.
455 ui::Layer* DelegatedFrameHostGetLayer() const override;
456 bool DelegatedFrameHostIsVisible() const override;
457 gfx::Size DelegatedFrameHostDesiredSizeInDIP() const override;
458 bool DelegatedFrameCanCreateResizeLock() const override;
459 scoped_ptr<ResizeLock> DelegatedFrameHostCreateResizeLock(
460 bool defer_compositor_lock) override;
461 void DelegatedFrameHostResizeLockWasReleased() override;
462 void DelegatedFrameHostSendCompositorSwapAck(
463 int output_surface_id,
464 const cc::CompositorFrameAck& ack) override;
465 void DelegatedFrameHostSendReclaimCompositorResources(
466 int output_surface_id,
467 const cc::CompositorFrameAck& ack) override;
468 void DelegatedFrameHostOnLostCompositorResources() override;
469 void DelegatedFrameHostUpdateVSyncParameters(
470 const base::TimeTicks& timebase,
471 const base::TimeDelta& interval) override;
473 // BeginFrameObserverProxyClient implementation.
474 void SendBeginFrame(const cc::BeginFrameArgs& args) 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 // Called when RenderWidget wants to start BeginFrame scheduling or stop.
498 void OnSetNeedsBeginFrames(bool needs_begin_frames);
500 RenderFrameHostImpl* GetFocusedFrame();
502 // Returns true if the |event| passed in can be forwarded to the renderer.
503 bool CanRendererHandleEvent(const ui::MouseEvent* event,
504 bool mouse_locked,
505 bool selection_popup);
507 // Called when the parent window bounds change.
508 void HandleParentBoundsChanged();
510 // Called when the parent window hierarchy for our window changes.
511 void ParentHierarchyChanged();
513 // The model object.
514 RenderWidgetHostImpl* host_;
516 aura::Window* window_;
518 scoped_ptr<DelegatedFrameHost> delegated_frame_host_;
520 scoped_ptr<WindowObserver> window_observer_;
522 // Tracks the ancestors of the RWHVA window for window location changes.
523 scoped_ptr<WindowAncestorObserver> ancestor_window_observer_;
525 // Are we in the process of closing? Tracked so fullscreen views can avoid
526 // sending a second shutdown request to the host when they lose the focus
527 // after requesting shutdown for another reason (e.g. Escape key).
528 bool in_shutdown_;
530 // True if in the process of handling a window bounds changed notification.
531 bool in_bounds_changed_;
533 // Is this a fullscreen view?
534 bool is_fullscreen_;
536 // Our parent host view, if this is a popup. NULL otherwise.
537 RenderWidgetHostViewAura* popup_parent_host_view_;
539 // Our child popup host. NULL if we do not have a child popup.
540 RenderWidgetHostViewAura* popup_child_host_view_;
542 class EventFilterForPopupExit;
543 friend class EventFilterForPopupExit;
544 scoped_ptr<ui::EventHandler> event_filter_for_popup_exit_;
546 // True when content is being loaded. Used to show an hourglass cursor.
547 bool is_loading_;
549 // The cursor for the page. This is passed up from the renderer.
550 WebCursor current_cursor_;
552 // Stores the current state of the active pointers targeting this
553 // object.
554 ui::MotionEventAura pointer_state_;
556 // The current text input type.
557 ui::TextInputType text_input_type_;
558 // The current text input mode corresponding to HTML5 inputmode attribute.
559 ui::TextInputMode text_input_mode_;
560 // The current text input flags.
561 int text_input_flags_;
562 bool can_compose_inline_;
564 // Bounds for the selection.
565 ui::SelectionBound selection_anchor_;
566 ui::SelectionBound selection_focus_;
568 // The current composition character bounds.
569 std::vector<gfx::Rect> composition_character_bounds_;
571 // Indicates if there is onging composition text.
572 bool has_composition_text_;
574 // Whether return characters should be passed on to the RenderWidgetHostImpl.
575 bool accept_return_character_;
577 // Current tooltip text.
578 base::string16 tooltip_;
580 // The size and scale of the last software compositing frame that was swapped.
581 gfx::Size last_swapped_software_frame_size_;
582 float last_swapped_software_frame_scale_factor_;
584 // If non-NULL we're in OnPaint() and this is the supplied canvas.
585 gfx::Canvas* paint_canvas_;
587 // Used to record the last position of the mouse.
588 // While the mouse is locked, they store the last known position just as mouse
589 // lock was entered.
590 // Relative to the upper-left corner of the view.
591 gfx::Point unlocked_mouse_position_;
592 // Relative to the upper-left corner of the screen.
593 gfx::Point unlocked_global_mouse_position_;
594 // Last cursor position relative to screen. Used to compute movementX/Y.
595 gfx::Point global_mouse_position_;
596 // In mouse locked mode, we synthetically move the mouse cursor to the center
597 // of the window when it reaches the window borders to avoid it going outside.
598 // This flag is used to differentiate between these synthetic mouse move
599 // events vs. normal mouse move events.
600 bool synthetic_move_sent_;
602 // Used to track the state of the window we're created from. Only used when
603 // created fullscreen.
604 scoped_ptr<aura::WindowTracker> host_tracker_;
606 // Used to track the last cursor visibility update that was sent to the
607 // renderer via NotifyRendererOfCursorVisibilityState().
608 enum CursorVisibilityState {
609 UNKNOWN,
610 VISIBLE,
611 NOT_VISIBLE,
613 CursorVisibilityState cursor_visibility_state_in_renderer_;
615 #if defined(OS_WIN)
616 // The list of rectangles from constrained windows over this view. Windowed
617 // NPAPI plugins shouldn't draw over them.
618 std::vector<gfx::Rect> constrained_rects_;
620 typedef std::map<HWND, WebPluginGeometry> PluginWindowMoves;
621 // Contains information about each windowed plugin's clip and cutout rects (
622 // from the renderer). This is needed because when the transient windows
623 // over this view changes, we need this information in order to create a new
624 // region for the HWND.
625 PluginWindowMoves plugin_window_moves_;
627 // The LegacyRenderWidgetHostHWND class provides a dummy HWND which is used
628 // for accessibility, as the container for windowless plugins like
629 // Flash/Silverlight, etc and for legacy drivers for trackpoints/trackpads,
630 // etc.
631 // The LegacyRenderWidgetHostHWND instance is created during the first call
632 // to RenderWidgetHostViewAura::InternalSetBounds. The instance is destroyed
633 // when the LegacyRenderWidgetHostHWND hwnd is destroyed.
634 content::LegacyRenderWidgetHostHWND* legacy_render_widget_host_HWND_;
636 // Set to true if the legacy_render_widget_host_HWND_ instance was destroyed
637 // by Windows. This could happen if the browser window was destroyed by
638 // DestroyWindow for e.g. This flag helps ensure that we don't try to create
639 // the LegacyRenderWidgetHostHWND instance again as that would be a futile
640 // exercise.
641 bool legacy_window_destroyed_;
643 // Set to true when a context menu is being displayed. Reset to false when
644 // a mouse leave is received in this context.
645 bool showing_context_menu_;
646 #endif
648 bool has_snapped_to_boundary_;
650 TouchEditingClient* touch_editing_client_;
652 scoped_ptr<OverscrollController> overscroll_controller_;
654 // The last scroll offset of the view.
655 gfx::Vector2dF last_scroll_offset_;
657 gfx::Insets insets_;
659 std::vector<ui::LatencyInfo> software_latency_info_;
661 scoped_ptr<aura::client::ScopedTooltipDisabler> tooltip_disabler_;
663 // True when this view acts as a platform view hack for a
664 // RenderWidgetHostViewGuest.
665 bool is_guest_view_hack_;
667 gfx::Rect disambiguation_target_rect_;
669 // The last scroll offset when we start to render the link disambiguation
670 // view, so we can ensure the window hasn't moved between copying from the
671 // compositing surface and showing the disambiguation popup.
672 gfx::Vector2dF disambiguation_scroll_offset_;
674 BeginFrameObserverProxy begin_frame_observer_proxy_;
676 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_;
677 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);
680 } // namespace content
682 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_