Add ICU message format support
[chromium-blink-merge.git] / content / browser / renderer_host / render_widget_host_view_aura.h
blob56bb522e32a8b51fdff6beadbf2653a50310b4a1
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 struct ViewHostMsg_TextInputState_Params;
43 namespace aura {
44 class WindowTracker;
45 namespace client {
46 class ScopedTooltipDisabler;
50 namespace cc {
51 class CopyOutputRequest;
52 class CopyOutputResult;
53 class DelegatedFrameData;
56 namespace gfx {
57 class Canvas;
58 class Display;
61 namespace gpu {
62 struct Mailbox;
65 namespace ui {
66 class CompositorLock;
67 class InputMethod;
68 class LocatedEvent;
69 class Texture;
72 namespace content {
73 #if defined(OS_WIN)
74 class LegacyRenderWidgetHostHWND;
75 #endif
77 class OverscrollController;
78 class RenderFrameHostImpl;
79 class RenderWidgetHostImpl;
80 class RenderWidgetHostView;
82 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
83 class CONTENT_EXPORT RenderWidgetHostViewAura
84 : public RenderWidgetHostViewBase,
85 public DelegatedFrameHostClient,
86 public BeginFrameObserverProxyClient,
87 public ui::TextInputClient,
88 public gfx::DisplayObserver,
89 public aura::WindowTreeHostObserver,
90 public aura::WindowDelegate,
91 public aura::client::ActivationDelegate,
92 public aura::client::FocusChangeObserver,
93 public aura::client::CursorClientObserver {
94 public:
95 // Displays and controls touch editing elements such as selection handles.
96 class TouchEditingClient {
97 public:
98 TouchEditingClient() {}
100 // Tells the client to start showing touch editing handles.
101 virtual void StartTouchEditing() = 0;
103 // Notifies the client that touch editing is no longer needed. |quick|
104 // determines whether the handles should fade out quickly or slowly.
105 virtual void EndTouchEditing(bool quick) = 0;
107 // Notifies the client that the selection bounds need to be updated.
108 virtual void OnSelectionOrCursorChanged(
109 const ui::SelectionBound& anchor,
110 const ui::SelectionBound& focus) = 0;
112 // Notifies the client that the current text input type as changed.
113 virtual void OnTextInputTypeChanged(ui::TextInputType type) = 0;
115 // Notifies the client that an input event is about to be sent to the
116 // renderer. Returns true if the client wants to stop event propagation.
117 virtual bool HandleInputEvent(const ui::Event* event) = 0;
119 // Notifies the client that a gesture event ack was received.
120 virtual void GestureEventAck(int gesture_event_type) = 0;
122 // Notifies the client that the fling has ended, so it can activate touch
123 // editing if needed.
124 virtual void DidStopFlinging() = 0;
126 // This is called when the view is destroyed, so that the client can
127 // perform any necessary clean-up.
128 virtual void OnViewDestroyed() = 0;
130 protected:
131 virtual ~TouchEditingClient() {}
134 void set_touch_editing_client(TouchEditingClient* client) {
135 touch_editing_client_ = client;
138 // When |is_guest_view_hack| is true, this view isn't really the view for
139 // the |widget|, a RenderWidgetHostViewGuest is.
141 // TODO(lazyboy): Remove |is_guest_view_hack| once BrowserPlugin has migrated
142 // to use RWHVChildFrame (http://crbug.com/330264).
143 RenderWidgetHostViewAura(RenderWidgetHost* host, bool is_guest_view_hack);
145 // RenderWidgetHostView implementation.
146 bool OnMessageReceived(const IPC::Message& msg) override;
147 void InitAsChild(gfx::NativeView parent_view) override;
148 RenderWidgetHost* GetRenderWidgetHost() const override;
149 void SetSize(const gfx::Size& size) override;
150 void SetBounds(const gfx::Rect& rect) override;
151 gfx::Vector2dF GetLastScrollOffset() const override;
152 gfx::NativeView GetNativeView() const override;
153 gfx::NativeViewId GetNativeViewId() const override;
154 gfx::NativeViewAccessible GetNativeViewAccessible() override;
155 ui::TextInputClient* GetTextInputClient() override;
156 bool HasFocus() const override;
157 bool IsSurfaceAvailableForCopy() const override;
158 void Show() override;
159 void Hide() override;
160 bool IsShowing() override;
161 gfx::Rect GetViewBounds() const override;
162 void SetBackgroundColor(SkColor color) override;
163 gfx::Size GetVisibleViewportSize() const override;
164 void SetInsets(const gfx::Insets& insets) override;
166 // Overridden from RenderWidgetHostViewBase:
167 void InitAsPopup(RenderWidgetHostView* parent_host_view,
168 const gfx::Rect& pos) override;
169 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override;
170 void MovePluginWindows(const std::vector<WebPluginGeometry>& moves) override;
171 void Focus() override;
172 void UpdateCursor(const WebCursor& cursor) override;
173 void SetIsLoading(bool is_loading) override;
174 void TextInputStateChanged(
175 const ViewHostMsg_TextInputState_Params& params) 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 #if defined(OS_WIN)
314 // Sets the cutout rects from constrained windows. These are rectangles that
315 // windowed NPAPI plugins shouldn't paint in. Overwrites any previous cutout
316 // rects.
317 void UpdateConstrainedWindowRects(const std::vector<gfx::Rect>& rects);
319 // Updates the cursor clip region. Used for mouse locking.
320 void UpdateMouseLockRegion();
322 // Notification that the LegacyRenderWidgetHostHWND was destroyed.
323 void OnLegacyWindowDestroyed();
324 #endif
326 void DisambiguationPopupRendered(const SkBitmap& result,
327 ReadbackResponse response);
329 void HideDisambiguationPopup();
331 void ProcessDisambiguationGesture(ui::GestureEvent* event);
333 void ProcessDisambiguationMouse(ui::MouseEvent* event);
335 // Method to indicate if this instance is shutting down or closing.
336 // TODO(shrikant): Discuss around to see if it makes sense to add this method
337 // as part of RenderWidgetHostView.
338 bool IsClosing() const { return in_shutdown_; }
340 // Sets whether the overscroll controller should be enabled for this page.
341 void SetOverscrollControllerEnabled(bool enabled);
343 void SnapToPhysicalPixelBoundary();
345 OverscrollController* overscroll_controller() const {
346 return overscroll_controller_.get();
349 // Called when the context menu is about to be displayed.
350 void OnShowContextMenu();
352 protected:
353 ~RenderWidgetHostViewAura() override;
355 // Exposed for tests.
356 aura::Window* window() { return window_; }
358 DelegatedFrameHost* GetDelegatedFrameHost() const {
359 return delegated_frame_host_.get();
361 const ui::MotionEventAura& pointer_state() const { return pointer_state_; }
363 private:
364 friend class RenderWidgetHostViewAuraCopyRequestTest;
365 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
366 PopupRetainsCaptureAfterMouseRelease);
367 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText);
368 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState);
369 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
370 TouchEventPositionsArentRounded);
371 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventSyncAsync);
372 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, Resize);
373 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SwapNotifiesWindow);
374 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, RecreateLayers);
375 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
376 SkippedDelegatedFrames);
377 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, OutputSurfaceIdChange);
378 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
379 DiscardDelegatedFrames);
380 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
381 DiscardDelegatedFramesWithLocking);
382 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SoftwareDPIChange);
383 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
384 UpdateCursorIfOverSelf);
385 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
386 VisibleViewportTest);
387 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
388 OverscrollResetsOnBlur);
389 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest,
390 FinishCompositionByMouse);
391 FRIEND_TEST_ALL_PREFIXES(WebContentsViewAuraTest,
392 WebContentsViewReparent);
394 class WindowObserver;
395 friend class WindowObserver;
397 class WindowAncestorObserver;
398 friend class WindowAncestorObserver;
400 void UpdateCursorIfOverSelf();
402 // Tracks whether SnapToPhysicalPixelBoundary() has been called.
403 bool has_snapped_to_boundary() { return has_snapped_to_boundary_; }
404 void ResetHasSnappedToBoundary() { has_snapped_to_boundary_ = false; }
406 // Set the bounds of the window and handle size changes. Assumes the caller
407 // has already adjusted the origin of |rect| to conform to whatever coordinate
408 // space is required by the aura::Window.
409 void InternalSetBounds(const gfx::Rect& rect);
411 #if defined(OS_WIN)
412 bool UsesNativeWindowFrame() const;
413 #endif
415 ui::InputMethod* GetInputMethod() const;
417 // Sends shutdown request.
418 void Shutdown();
420 // Returns whether the widget needs an input grab to work properly.
421 bool NeedsInputGrab();
423 // Returns whether the widget needs to grab mouse capture to work properly.
424 bool NeedsMouseCapture();
426 // Confirm existing composition text in the webpage and ask the input method
427 // to cancel its ongoing composition session.
428 void FinishImeCompositionSession();
430 // This method computes movementX/Y and keeps track of mouse location for
431 // mouse lock on all mouse move events.
432 void ModifyEventMovementAndCoords(blink::WebMouseEvent* event);
434 // Sends an IPC to the renderer process to communicate whether or not
435 // the mouse cursor is visible anywhere on the screen.
436 void NotifyRendererOfCursorVisibilityState(bool is_visible);
438 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty
439 // SchedulePaint() is invoked for |rect|.
440 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip);
442 // Helper method to determine if, in mouse locked mode, the cursor should be
443 // moved to center.
444 bool ShouldMoveToCenter();
446 // Called after |window_| is parented to a WindowEventDispatcher.
447 void AddedToRootWindow();
449 // Called prior to removing |window_| from a WindowEventDispatcher.
450 void RemovingFromRootWindow();
452 // DelegatedFrameHostClient implementation.
453 ui::Layer* DelegatedFrameHostGetLayer() const override;
454 bool DelegatedFrameHostIsVisible() const override;
455 gfx::Size DelegatedFrameHostDesiredSizeInDIP() const override;
456 bool DelegatedFrameCanCreateResizeLock() const override;
457 scoped_ptr<ResizeLock> DelegatedFrameHostCreateResizeLock(
458 bool defer_compositor_lock) override;
459 void DelegatedFrameHostResizeLockWasReleased() override;
460 void DelegatedFrameHostSendCompositorSwapAck(
461 int output_surface_id,
462 const cc::CompositorFrameAck& ack) override;
463 void DelegatedFrameHostSendReclaimCompositorResources(
464 int output_surface_id,
465 const cc::CompositorFrameAck& ack) override;
466 void DelegatedFrameHostOnLostCompositorResources() override;
467 void DelegatedFrameHostUpdateVSyncParameters(
468 const base::TimeTicks& timebase,
469 const base::TimeDelta& interval) override;
471 // BeginFrameObserverProxyClient implementation.
472 void SendBeginFrame(const cc::BeginFrameArgs& args) override;
474 // Detaches |this| from the input method object.
475 void DetachFromInputMethod();
477 // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method
478 // calls our keybindings handler against the event and send matched
479 // edit commands to renderer instead.
480 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event);
482 // Dismisses a Web Popup on a mouse or touch press outside the popup and its
483 // parent.
484 void ApplyEventFilterForPopupExit(ui::LocatedEvent* event);
486 // Converts |rect| from window coordinate to screen coordinate.
487 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const;
489 // Converts |rect| from screen coordinate to window coordinate.
490 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const;
492 // Helper function to set keyboard focus to the main window.
493 void SetKeyboardFocus();
495 // Called when RenderWidget wants to start BeginFrame scheduling or stop.
496 void OnSetNeedsBeginFrames(bool needs_begin_frames);
498 RenderFrameHostImpl* GetFocusedFrame();
500 // Returns true if the |event| passed in can be forwarded to the renderer.
501 bool CanRendererHandleEvent(const ui::MouseEvent* event,
502 bool mouse_locked,
503 bool selection_popup);
505 // Called when the parent window bounds change.
506 void HandleParentBoundsChanged();
508 // Called when the parent window hierarchy for our window changes.
509 void ParentHierarchyChanged();
511 // The model object.
512 RenderWidgetHostImpl* host_;
514 aura::Window* window_;
516 scoped_ptr<DelegatedFrameHost> delegated_frame_host_;
518 scoped_ptr<WindowObserver> window_observer_;
520 // Tracks the ancestors of the RWHVA window for window location changes.
521 scoped_ptr<WindowAncestorObserver> ancestor_window_observer_;
523 // Are we in the process of closing? Tracked so fullscreen views can avoid
524 // sending a second shutdown request to the host when they lose the focus
525 // after requesting shutdown for another reason (e.g. Escape key).
526 bool in_shutdown_;
528 // True if in the process of handling a window bounds changed notification.
529 bool in_bounds_changed_;
531 // Is this a fullscreen view?
532 bool is_fullscreen_;
534 // Our parent host view, if this is a popup. NULL otherwise.
535 RenderWidgetHostViewAura* popup_parent_host_view_;
537 // Our child popup host. NULL if we do not have a child popup.
538 RenderWidgetHostViewAura* popup_child_host_view_;
540 class EventFilterForPopupExit;
541 friend class EventFilterForPopupExit;
542 scoped_ptr<ui::EventHandler> event_filter_for_popup_exit_;
544 // True when content is being loaded. Used to show an hourglass cursor.
545 bool is_loading_;
547 // The cursor for the page. This is passed up from the renderer.
548 WebCursor current_cursor_;
550 // Stores the current state of the active pointers targeting this
551 // object.
552 ui::MotionEventAura pointer_state_;
554 // The current text input type.
555 ui::TextInputType text_input_type_;
556 // The current text input mode corresponding to HTML5 inputmode attribute.
557 ui::TextInputMode text_input_mode_;
558 // The current text input flags.
559 int text_input_flags_;
560 bool can_compose_inline_;
562 // Bounds for the selection.
563 ui::SelectionBound selection_anchor_;
564 ui::SelectionBound selection_focus_;
566 // The current composition character bounds.
567 std::vector<gfx::Rect> composition_character_bounds_;
569 // Indicates if there is onging composition text.
570 bool has_composition_text_;
572 // Whether return characters should be passed on to the RenderWidgetHostImpl.
573 bool accept_return_character_;
575 // Current tooltip text.
576 base::string16 tooltip_;
578 // The size and scale of the last software compositing frame that was swapped.
579 gfx::Size last_swapped_software_frame_size_;
580 float last_swapped_software_frame_scale_factor_;
582 // If non-NULL we're in OnPaint() and this is the supplied canvas.
583 gfx::Canvas* paint_canvas_;
585 // Used to record the last position of the mouse.
586 // While the mouse is locked, they store the last known position just as mouse
587 // lock was entered.
588 // Relative to the upper-left corner of the view.
589 gfx::Point unlocked_mouse_position_;
590 // Relative to the upper-left corner of the screen.
591 gfx::Point unlocked_global_mouse_position_;
592 // Last cursor position relative to screen. Used to compute movementX/Y.
593 gfx::Point global_mouse_position_;
594 // In mouse locked mode, we synthetically move the mouse cursor to the center
595 // of the window when it reaches the window borders to avoid it going outside.
596 // This flag is used to differentiate between these synthetic mouse move
597 // events vs. normal mouse move events.
598 bool synthetic_move_sent_;
600 // Used to track the state of the window we're created from. Only used when
601 // created fullscreen.
602 scoped_ptr<aura::WindowTracker> host_tracker_;
604 // Used to track the last cursor visibility update that was sent to the
605 // renderer via NotifyRendererOfCursorVisibilityState().
606 enum CursorVisibilityState {
607 UNKNOWN,
608 VISIBLE,
609 NOT_VISIBLE,
611 CursorVisibilityState cursor_visibility_state_in_renderer_;
613 #if defined(OS_WIN)
614 // The list of rectangles from constrained windows over this view. Windowed
615 // NPAPI plugins shouldn't draw over them.
616 std::vector<gfx::Rect> constrained_rects_;
618 typedef std::map<HWND, WebPluginGeometry> PluginWindowMoves;
619 // Contains information about each windowed plugin's clip and cutout rects (
620 // from the renderer). This is needed because when the transient windows
621 // over this view changes, we need this information in order to create a new
622 // region for the HWND.
623 PluginWindowMoves plugin_window_moves_;
625 // The LegacyRenderWidgetHostHWND class provides a dummy HWND which is used
626 // for accessibility, as the container for windowless plugins like
627 // Flash/Silverlight, etc and for legacy drivers for trackpoints/trackpads,
628 // etc.
629 // The LegacyRenderWidgetHostHWND instance is created during the first call
630 // to RenderWidgetHostViewAura::InternalSetBounds. The instance is destroyed
631 // when the LegacyRenderWidgetHostHWND hwnd is destroyed.
632 content::LegacyRenderWidgetHostHWND* legacy_render_widget_host_HWND_;
634 // Set to true if the legacy_render_widget_host_HWND_ instance was destroyed
635 // by Windows. This could happen if the browser window was destroyed by
636 // DestroyWindow for e.g. This flag helps ensure that we don't try to create
637 // the LegacyRenderWidgetHostHWND instance again as that would be a futile
638 // exercise.
639 bool legacy_window_destroyed_;
641 // Set to true when a context menu is being displayed. Reset to false when
642 // a mouse leave is received in this context.
643 bool showing_context_menu_;
644 #endif
646 bool has_snapped_to_boundary_;
648 TouchEditingClient* touch_editing_client_;
650 scoped_ptr<OverscrollController> overscroll_controller_;
652 // The last scroll offset of the view.
653 gfx::Vector2dF last_scroll_offset_;
655 gfx::Insets insets_;
657 std::vector<ui::LatencyInfo> software_latency_info_;
659 scoped_ptr<aura::client::ScopedTooltipDisabler> tooltip_disabler_;
661 // True when this view acts as a platform view hack for a
662 // RenderWidgetHostViewGuest.
663 bool is_guest_view_hack_;
665 gfx::Rect disambiguation_target_rect_;
667 // The last scroll offset when we start to render the link disambiguation
668 // view, so we can ensure the window hasn't moved between copying from the
669 // compositing surface and showing the disambiguation popup.
670 gfx::Vector2dF disambiguation_scroll_offset_;
672 BeginFrameObserverProxy begin_frame_observer_proxy_;
674 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_;
675 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura);
678 } // namespace content
680 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_