Add a FrameHostMsg_BeginNavigation IPC
[chromium-blink-merge.git] / content / browser / renderer_host / render_widget_host_view_aura.h
blob05f5493bf610edc22dac5a21bed77ec4683a7936
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 struct ViewHostMsg_TextInputState_Params;
40 namespace aura {
41 class WindowTracker;
42 namespace client {
43 class ScopedTooltipDisabler;
47 namespace cc {
48 class CopyOutputRequest;
49 class CopyOutputResult;
50 class DelegatedFrameData;
53 namespace gfx {
54 class Canvas;
55 class Display;
58 namespace gpu {
59 struct Mailbox;
62 namespace ui {
63 class CompositorLock;
64 class InputMethod;
65 class LocatedEvent;
66 class Texture;
69 namespace content {
70 #if defined(OS_WIN)
71 class LegacyRenderWidgetHostHWND;
72 #endif
74 class OverscrollController;
75 class RenderFrameHostImpl;
76 class RenderWidgetHostImpl;
77 class RenderWidgetHostView;
79 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
80 class CONTENT_EXPORT RenderWidgetHostViewAura
81 : public RenderWidgetHostViewBase,
82 public DelegatedFrameHostClient,
83 public ui::TextInputClient,
84 public gfx::DisplayObserver,
85 public aura::WindowTreeHostObserver,
86 public aura::WindowDelegate,
87 public aura::client::ActivationDelegate,
88 public aura::client::ActivationChangeObserver,
89 public aura::client::FocusChangeObserver,
90 public aura::client::CursorClientObserver,
91 public base::SupportsWeakPtr<RenderWidgetHostViewAura> {
92 public:
93 // Displays and controls touch editing elements such as selection handles.
94 class TouchEditingClient {
95 public:
96 TouchEditingClient() {}
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(const gfx::Rect& anchor,
107 const gfx::Rect& focus) = 0;
109 // Notifies the client that the current text input type as changed.
110 virtual void OnTextInputTypeChanged(ui::TextInputType type) = 0;
112 // Notifies the client that an input event is about to be sent to the
113 // renderer. Returns true if the client wants to stop event propagation.
114 virtual bool HandleInputEvent(const ui::Event* event) = 0;
116 // Notifies the client that a gesture event ack was received.
117 virtual void GestureEventAck(int gesture_event_type) = 0;
119 // This is called when the view is destroyed, so that the client can
120 // perform any necessary clean-up.
121 virtual void OnViewDestroyed() = 0;
123 protected:
124 virtual ~TouchEditingClient() {}
127 void set_touch_editing_client(TouchEditingClient* client) {
128 touch_editing_client_ = client;
131 explicit RenderWidgetHostViewAura(RenderWidgetHost* host);
133 // RenderWidgetHostView implementation.
134 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE;
135 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE;
136 virtual void SetSize(const gfx::Size& size) OVERRIDE;
137 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE;
138 virtual gfx::NativeView GetNativeView() const OVERRIDE;
139 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE;
140 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE;
141 virtual ui::TextInputClient* GetTextInputClient() OVERRIDE;
142 virtual bool HasFocus() const OVERRIDE;
143 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE;
144 virtual void Show() OVERRIDE;
145 virtual void Hide() OVERRIDE;
146 virtual bool IsShowing() OVERRIDE;
147 virtual gfx::Rect GetViewBounds() const OVERRIDE;
148 virtual void SetBackgroundOpaque(bool opaque) OVERRIDE;
149 virtual gfx::Size GetVisibleViewportSize() const OVERRIDE;
150 virtual void SetInsets(const gfx::Insets& insets) OVERRIDE;
152 // Overridden from RenderWidgetHostViewBase:
153 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view,
154 const gfx::Rect& pos) OVERRIDE;
155 virtual void InitAsFullscreen(
156 RenderWidgetHostView* reference_host_view) OVERRIDE;
157 virtual void WasShown() OVERRIDE;
158 virtual void WasHidden() OVERRIDE;
159 virtual void MovePluginWindows(
160 const std::vector<WebPluginGeometry>& moves) OVERRIDE;
161 virtual void Focus() OVERRIDE;
162 virtual void Blur() OVERRIDE;
163 virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE;
164 virtual void SetIsLoading(bool is_loading) OVERRIDE;
165 virtual void TextInputStateChanged(
166 const ViewHostMsg_TextInputState_Params& params) OVERRIDE;
167 virtual void ImeCancelComposition() OVERRIDE;
168 virtual void ImeCompositionRangeChanged(
169 const gfx::Range& range,
170 const std::vector<gfx::Rect>& character_bounds) OVERRIDE;
171 virtual void RenderProcessGone(base::TerminationStatus status,
172 int error_code) OVERRIDE;
173 virtual void Destroy() OVERRIDE;
174 virtual void SetTooltipText(const base::string16& tooltip_text) OVERRIDE;
175 virtual void SelectionChanged(const base::string16& text,
176 size_t offset,
177 const gfx::Range& range) OVERRIDE;
178 virtual gfx::Size GetRequestedRendererSize() const OVERRIDE;
179 virtual void SelectionBoundsChanged(
180 const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE;
181 virtual void ScrollOffsetChanged() OVERRIDE;
182 virtual void CopyFromCompositingSurface(
183 const gfx::Rect& src_subrect,
184 const gfx::Size& dst_size,
185 const base::Callback<void(bool, const SkBitmap&)>& callback,
186 const SkColorType color_type) OVERRIDE;
187 virtual void CopyFromCompositingSurfaceToVideoFrame(
188 const gfx::Rect& src_subrect,
189 const scoped_refptr<media::VideoFrame>& target,
190 const base::Callback<void(bool)>& callback) OVERRIDE;
191 virtual bool CanCopyToVideoFrame() const OVERRIDE;
192 virtual bool CanSubscribeFrame() const OVERRIDE;
193 virtual void BeginFrameSubscription(
194 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) OVERRIDE;
195 virtual void EndFrameSubscription() OVERRIDE;
196 virtual void AcceleratedSurfaceInitialized(int host_id,
197 int route_id) OVERRIDE;
198 virtual void AcceleratedSurfaceBuffersSwapped(
199 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params_in_pixel,
200 int gpu_host_id) OVERRIDE;
201 virtual void AcceleratedSurfacePostSubBuffer(
202 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params_in_pixel,
203 int gpu_host_id) OVERRIDE;
204 virtual void AcceleratedSurfaceSuspend() OVERRIDE;
205 virtual void AcceleratedSurfaceRelease() OVERRIDE;
206 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE;
207 virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE;
208 virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE;
209 virtual void WheelEventAck(const blink::WebMouseWheelEvent& event,
210 InputEventAckState ack_result) OVERRIDE;
211 virtual void GestureEventAck(const blink::WebGestureEvent& event,
212 InputEventAckState ack_result) OVERRIDE;
213 virtual void ProcessAckedTouchEvent(
214 const TouchEventWithLatencyInfo& touch,
215 InputEventAckState ack_result) OVERRIDE;
216 virtual scoped_ptr<SyntheticGestureTarget> CreateSyntheticGestureTarget()
217 OVERRIDE;
218 virtual InputEventAckState FilterInputEvent(
219 const blink::WebInputEvent& input_event) OVERRIDE;
220 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE;
221 virtual void CreateBrowserAccessibilityManagerIfNeeded() OVERRIDE;
222 virtual bool LockMouse() OVERRIDE;
223 virtual void UnlockMouse() OVERRIDE;
224 virtual void OnSwapCompositorFrame(
225 uint32 output_surface_id,
226 scoped_ptr<cc::CompositorFrame> frame) OVERRIDE;
228 #if defined(OS_WIN)
229 virtual void SetParentNativeViewAccessible(
230 gfx::NativeViewAccessible accessible_parent) OVERRIDE;
231 virtual gfx::NativeViewId GetParentForWindowlessPlugin() const OVERRIDE;
232 #endif
234 // Overridden from ui::TextInputClient:
235 virtual void SetCompositionText(
236 const ui::CompositionText& composition) OVERRIDE;
237 virtual void ConfirmCompositionText() OVERRIDE;
238 virtual void ClearCompositionText() OVERRIDE;
239 virtual void InsertText(const base::string16& text) OVERRIDE;
240 virtual void InsertChar(base::char16 ch, int flags) OVERRIDE;
241 virtual gfx::NativeWindow GetAttachedWindow() const OVERRIDE;
242 virtual ui::TextInputType GetTextInputType() const OVERRIDE;
243 virtual ui::TextInputMode GetTextInputMode() const OVERRIDE;
244 virtual bool CanComposeInline() const OVERRIDE;
245 virtual gfx::Rect GetCaretBounds() const OVERRIDE;
246 virtual bool GetCompositionCharacterBounds(uint32 index,
247 gfx::Rect* rect) const OVERRIDE;
248 virtual bool HasCompositionText() const OVERRIDE;
249 virtual bool GetTextRange(gfx::Range* range) const OVERRIDE;
250 virtual bool GetCompositionTextRange(gfx::Range* range) const OVERRIDE;
251 virtual bool GetSelectionRange(gfx::Range* range) const OVERRIDE;
252 virtual bool SetSelectionRange(const gfx::Range& range) OVERRIDE;
253 virtual bool DeleteRange(const gfx::Range& range) OVERRIDE;
254 virtual bool GetTextFromRange(const gfx::Range& range,
255 base::string16* text) const OVERRIDE;
256 virtual void OnInputMethodChanged() OVERRIDE;
257 virtual bool ChangeTextDirectionAndLayoutAlignment(
258 base::i18n::TextDirection direction) OVERRIDE;
259 virtual void ExtendSelectionAndDelete(size_t before, size_t after) OVERRIDE;
260 virtual void EnsureCaretInRect(const gfx::Rect& rect) OVERRIDE;
261 virtual void OnCandidateWindowShown() OVERRIDE;
262 virtual void OnCandidateWindowUpdated() OVERRIDE;
263 virtual void OnCandidateWindowHidden() OVERRIDE;
264 virtual bool IsEditingCommandEnabled(int command_id) OVERRIDE;
265 virtual void ExecuteEditingCommand(int command_id) OVERRIDE;
267 // Overridden from gfx::DisplayObserver:
268 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE;
269 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE;
270 virtual void OnDisplayMetricsChanged(const gfx::Display& display,
271 uint32_t metrics) OVERRIDE;
273 // Overridden from aura::WindowDelegate:
274 virtual gfx::Size GetMinimumSize() const OVERRIDE;
275 virtual gfx::Size GetMaximumSize() const OVERRIDE;
276 virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
277 const gfx::Rect& new_bounds) OVERRIDE;
278 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE;
279 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE;
280 virtual bool ShouldDescendIntoChildForEventHandling(
281 aura::Window* child,
282 const gfx::Point& location) OVERRIDE;
283 virtual bool CanFocus() OVERRIDE;
284 virtual void OnCaptureLost() OVERRIDE;
285 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
286 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
287 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
288 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
289 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE;
290 virtual bool HasHitTestMask() const OVERRIDE;
291 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE;
293 // Overridden from ui::EventHandler:
294 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE;
295 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE;
296 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
297 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE;
298 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
300 // Overridden from aura::client::ActivationDelegate:
301 virtual bool ShouldActivate() const OVERRIDE;
303 // Overridden from aura::client::ActivationChangeObserver:
304 virtual void OnWindowActivated(aura::Window* gained_activation,
305 aura::Window* lost_activation) OVERRIDE;
307 // Overridden from aura::client::CursorClientObserver:
308 virtual void OnCursorVisibilityChanged(bool is_visible) OVERRIDE;
310 // Overridden from aura::client::FocusChangeObserver:
311 virtual void OnWindowFocused(aura::Window* gained_focus,
312 aura::Window* lost_focus) OVERRIDE;
314 // Overridden from aura::WindowTreeHostObserver:
315 virtual void OnHostMoved(const aura::WindowTreeHost* host,
316 const gfx::Point& new_origin) OVERRIDE;
318 #if defined(OS_WIN)
319 // Sets the cutout rects from constrained windows. These are rectangles that
320 // windowed NPAPI plugins shouldn't paint in. Overwrites any previous cutout
321 // rects.
322 void UpdateConstrainedWindowRects(const std::vector<gfx::Rect>& rects);
324 // Updates the cursor clip region. Used for mouse locking.
325 void UpdateMouseLockRegion();
327 // Notification that the LegacyRenderWidgetHostHWND was destroyed.
328 void OnLegacyWindowDestroyed();
329 #endif
331 // Method to indicate if this instance is shutting down or closing.
332 // TODO(shrikant): Discuss around to see if it makes sense to add this method
333 // as part of RenderWidgetHostView.
334 bool IsClosing() const { return in_shutdown_; }
336 // Sets whether the overscroll controller should be enabled for this page.
337 void SetOverscrollControllerEnabled(bool enabled);
339 void SnapToPhysicalPixelBoundary();
341 OverscrollController* overscroll_controller() const {
342 return overscroll_controller_.get();
345 protected:
346 virtual ~RenderWidgetHostViewAura();
348 // Exposed for tests.
349 aura::Window* window() { return window_; }
350 virtual SkColorType PreferredReadbackFormat() OVERRIDE;
351 virtual DelegatedFrameHost* GetDelegatedFrameHost() const OVERRIDE;
353 private:
354 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText);
355 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState);
356 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
357 TouchEventPositionsArentRounded);
358 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventSyncAsync);
359 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SwapNotifiesWindow);
360 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
361 SkippedDelegatedFrames);
362 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, OutputSurfaceIdChange);
363 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
364 DiscardDelegatedFrames);
365 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
366 DiscardDelegatedFramesWithLocking);
367 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SoftwareDPIChange);
368 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
369 UpdateCursorIfOverSelf);
370 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraCopyRequestTest,
371 DestroyedAfterCopyRequest);
372 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
373 VisibleViewportTest);
374 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
375 OverscrollResetsOnBlur);
377 class WindowObserver;
378 friend class WindowObserver;
380 void UpdateCursorIfOverSelf();
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 // Returns whether the widget needs an input grab to work properly.
394 bool NeedsInputGrab();
396 // Confirm existing composition text in the webpage and ask the input method
397 // to cancel its ongoing composition session.
398 void FinishImeCompositionSession();
400 // This method computes movementX/Y and keeps track of mouse location for
401 // mouse lock on all mouse move events.
402 void ModifyEventMovementAndCoords(blink::WebMouseEvent* event);
404 // Sends an IPC to the renderer process to communicate whether or not
405 // the mouse cursor is visible anywhere on the screen.
406 void NotifyRendererOfCursorVisibilityState(bool is_visible);
408 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty
409 // SchedulePaint() is invoked for |rect|.
410 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip);
412 // Helper method to determine if, in mouse locked mode, the cursor should be
413 // moved to center.
414 bool ShouldMoveToCenter();
416 // Called after |window_| is parented to a WindowEventDispatcher.
417 void AddedToRootWindow();
419 // Called prior to removing |window_| from a WindowEventDispatcher.
420 void RemovingFromRootWindow();
422 // DelegatedFrameHostClient implementation.
423 virtual ui::Compositor* GetCompositor() const OVERRIDE;
424 virtual ui::Layer* GetLayer() OVERRIDE;
425 virtual RenderWidgetHostImpl* GetHost() OVERRIDE;
426 virtual void SchedulePaintInRect(
427 const gfx::Rect& damage_rect_in_dip) OVERRIDE;
428 virtual bool IsVisible() OVERRIDE;
429 virtual scoped_ptr<ResizeLock> CreateResizeLock(
430 bool defer_compositor_lock) OVERRIDE;
431 virtual gfx::Size DesiredFrameSize() OVERRIDE;
432 virtual float CurrentDeviceScaleFactor() OVERRIDE;
433 virtual gfx::Size ConvertViewSizeToPixel(const gfx::Size& size) OVERRIDE;
435 // Detaches |this| from the input method object.
436 void DetachFromInputMethod();
438 // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method
439 // calls our keybindings handler against the event and send matched
440 // edit commands to renderer instead.
441 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event);
443 // Dismisses a Web Popup on a mouse or touch press outside the popup and its
444 // parent.
445 void ApplyEventFilterForPopupExit(ui::LocatedEvent* event);
447 // Converts |rect| from window coordinate to screen coordinate.
448 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const;
450 // Converts |rect| from screen coordinate to window coordinate.
451 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const;
453 // Helper function to set keyboard focus to the main window.
454 void SetKeyboardFocus();
456 RenderFrameHostImpl* GetFocusedFrame();
458 // The model object.
459 RenderWidgetHostImpl* host_;
461 aura::Window* window_;
463 scoped_ptr<DelegatedFrameHost> delegated_frame_host_;
465 scoped_ptr<WindowObserver> window_observer_;
467 // Are we in the process of closing? Tracked so fullscreen views can avoid
468 // sending a second shutdown request to the host when they lose the focus
469 // after requesting shutdown for another reason (e.g. Escape key).
470 bool in_shutdown_;
472 // True if in the process of handling a window bounds changed notification.
473 bool in_bounds_changed_;
475 // Is this a fullscreen view?
476 bool is_fullscreen_;
478 // Our parent host view, if this is a popup. NULL otherwise.
479 RenderWidgetHostViewAura* popup_parent_host_view_;
481 // Our child popup host. NULL if we do not have a child popup.
482 RenderWidgetHostViewAura* popup_child_host_view_;
484 class EventFilterForPopupExit;
485 friend class EventFilterForPopupExit;
486 scoped_ptr<ui::EventHandler> event_filter_for_popup_exit_;
488 // True when content is being loaded. Used to show an hourglass cursor.
489 bool is_loading_;
491 // The cursor for the page. This is passed up from the renderer.
492 WebCursor current_cursor_;
494 // The touch-event. Its touch-points are updated as necessary. A new
495 // touch-point is added from an ET_TOUCH_PRESSED event, and a touch-point is
496 // removed from the list on an ET_TOUCH_RELEASED event.
497 blink::WebTouchEvent touch_event_;
499 // The current text input type.
500 ui::TextInputType text_input_type_;
501 // The current text input mode corresponding to HTML5 inputmode attribute.
502 ui::TextInputMode text_input_mode_;
503 bool can_compose_inline_;
505 // Rectangles for the selection anchor and focus.
506 gfx::Rect selection_anchor_rect_;
507 gfx::Rect selection_focus_rect_;
509 // The current composition character bounds.
510 std::vector<gfx::Rect> composition_character_bounds_;
512 // Indicates if there is onging composition text.
513 bool has_composition_text_;
515 // Whether return characters should be passed on to the RenderWidgetHostImpl.
516 bool accept_return_character_;
518 // Current tooltip text.
519 base::string16 tooltip_;
521 // The size and scale of the last software compositing frame that was swapped.
522 gfx::Size last_swapped_software_frame_size_;
523 float last_swapped_software_frame_scale_factor_;
525 // If non-NULL we're in OnPaint() and this is the supplied canvas.
526 gfx::Canvas* paint_canvas_;
528 // Used to record the last position of the mouse.
529 // While the mouse is locked, they store the last known position just as mouse
530 // lock was entered.
531 // Relative to the upper-left corner of the view.
532 gfx::Point unlocked_mouse_position_;
533 // Relative to the upper-left corner of the screen.
534 gfx::Point unlocked_global_mouse_position_;
535 // Last cursor position relative to screen. Used to compute movementX/Y.
536 gfx::Point global_mouse_position_;
537 // In mouse locked mode, we syntheticaly move the mouse cursor to the center
538 // of the window when it reaches the window borders to avoid it going outside.
539 // This flag is used to differentiate between these synthetic mouse move
540 // events vs. normal mouse move events.
541 bool synthetic_move_sent_;
543 // Used to track the state of the window we're created from. Only used when
544 // created fullscreen.
545 scoped_ptr<aura::WindowTracker> host_tracker_;
547 // Used to track the last cursor visibility update that was sent to the
548 // renderer via NotifyRendererOfCursorVisibilityState().
549 enum CursorVisibilityState {
550 UNKNOWN,
551 VISIBLE,
552 NOT_VISIBLE,
554 CursorVisibilityState cursor_visibility_state_in_renderer_;
556 #if defined(OS_WIN)
557 // The list of rectangles from constrained windows over this view. Windowed
558 // NPAPI plugins shouldn't draw over them.
559 std::vector<gfx::Rect> constrained_rects_;
561 typedef std::map<HWND, WebPluginGeometry> PluginWindowMoves;
562 // Contains information about each windowed plugin's clip and cutout rects (
563 // from the renderer). This is needed because when the transient windoiws
564 // over this view changes, we need this information in order to create a new
565 // region for the HWND.
566 PluginWindowMoves plugin_window_moves_;
568 // The LegacyRenderWidgetHostHWND class provides a dummy HWND which is used
569 // for accessibility, as the container for windowless plugins like
570 // Flash/Silverlight, etc and for legacy drivers for trackpoints/trackpads,
571 // etc.
572 // The LegacyRenderWidgetHostHWND instance is created during the first call
573 // to RenderWidgetHostViewAura::InternalSetBounds. The instance is destroyed
574 // when the LegacyRenderWidgetHostHWND hwnd is destroyed.
575 content::LegacyRenderWidgetHostHWND* legacy_render_widget_host_HWND_;
577 // Set to true if the legacy_render_widget_host_HWND_ instance was destroyed
578 // by Windows. This could happen if the browser window was destroyed by
579 // DestroyWindow for e.g. This flag helps ensure that we don't try to create
580 // the LegacyRenderWidgetHostHWND instance again as that would be a futile
581 // exercise.
582 bool legacy_window_destroyed_;
583 #endif
585 TouchEditingClient* touch_editing_client_;
587 scoped_ptr<OverscrollController> overscroll_controller_;
589 gfx::Insets insets_;
591 std::vector<ui::LatencyInfo> software_latency_info_;
593 scoped_ptr<aura::client::ScopedTooltipDisabler> tooltip_disabler_;
595 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_;
597 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);
600 } // namespace content
602 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_