OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <memory> | 12 #include <memory> |
13 #include <set> | 13 #include <set> |
14 #include <string> | 14 #include <string> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "base/callback.h" | 17 #include "base/callback.h" |
| 18 #include "base/compiler_specific.h" |
18 #include "base/gtest_prod_util.h" | 19 #include "base/gtest_prod_util.h" |
19 #include "base/macros.h" | 20 #include "base/macros.h" |
20 #include "base/memory/linked_ptr.h" | 21 #include "base/memory/linked_ptr.h" |
21 #include "base/memory/ref_counted.h" | 22 #include "base/memory/ref_counted.h" |
22 #include "base/memory/weak_ptr.h" | 23 #include "base/memory/weak_ptr.h" |
23 #include "build/build_config.h" | 24 #include "build/build_config.h" |
24 #include "cc/scheduler/begin_frame_source.h" | 25 #include "cc/scheduler/begin_frame_source.h" |
25 #include "content/browser/accessibility/browser_accessibility_manager.h" | 26 #include "content/browser/accessibility/browser_accessibility_manager.h" |
26 #include "content/browser/compositor/image_transport_factory.h" | 27 #include "content/browser/compositor/image_transport_factory.h" |
27 #include "content/browser/compositor/owned_mailbox.h" | 28 #include "content/browser/compositor/owned_mailbox.h" |
28 #include "content/browser/renderer_host/delegated_frame_host.h" | 29 #include "content/browser/renderer_host/delegated_frame_host.h" |
29 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 30 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 31 #include "content/browser/renderer_host/render_widget_host_view_event_handler.h" |
30 #include "content/browser/renderer_host/text_input_manager.h" | 32 #include "content/browser/renderer_host/text_input_manager.h" |
31 #include "content/common/content_export.h" | 33 #include "content/common/content_export.h" |
32 #include "content/common/cursors/webcursor.h" | 34 #include "content/common/cursors/webcursor.h" |
33 #include "content/public/common/context_menu_params.h" | 35 #include "content/public/common/context_menu_params.h" |
34 #include "third_party/skia/include/core/SkRegion.h" | 36 #include "third_party/skia/include/core/SkRegion.h" |
35 #include "ui/aura/client/cursor_client_observer.h" | 37 #include "ui/aura/client/cursor_client_observer.h" |
36 #include "ui/aura/client/focus_change_observer.h" | 38 #include "ui/aura/client/focus_change_observer.h" |
37 #include "ui/aura/window_delegate.h" | 39 #include "ui/aura/window_delegate.h" |
38 #include "ui/aura/window_tracker.h" | |
39 #include "ui/aura/window_tree_host_observer.h" | 40 #include "ui/aura/window_tree_host_observer.h" |
40 #include "ui/base/ime/text_input_client.h" | 41 #include "ui/base/ime/text_input_client.h" |
41 #include "ui/display/display_observer.h" | 42 #include "ui/display/display_observer.h" |
42 #include "ui/events/gestures/motion_event_aura.h" | |
43 #include "ui/gfx/geometry/insets.h" | 43 #include "ui/gfx/geometry/insets.h" |
44 #include "ui/gfx/geometry/rect.h" | 44 #include "ui/gfx/geometry/rect.h" |
45 #include "ui/gfx/selection_bound.h" | 45 #include "ui/gfx/selection_bound.h" |
46 #include "ui/wm/public/activation_delegate.h" | 46 #include "ui/wm/public/activation_delegate.h" |
47 | 47 |
48 namespace aura { | 48 namespace aura { |
49 namespace client { | 49 namespace client { |
50 class ScopedTooltipDisabler; | 50 class ScopedTooltipDisabler; |
51 } | 51 } |
52 } | 52 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 class RenderFrameHostImpl; | 88 class RenderFrameHostImpl; |
89 class RenderViewHostDelegateView; | 89 class RenderViewHostDelegateView; |
90 class RenderWidgetHostImpl; | 90 class RenderWidgetHostImpl; |
91 class RenderWidgetHostView; | 91 class RenderWidgetHostView; |
92 class TouchSelectionControllerClientAura; | 92 class TouchSelectionControllerClientAura; |
93 struct TextInputState; | 93 struct TextInputState; |
94 | 94 |
95 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. | 95 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. |
96 class CONTENT_EXPORT RenderWidgetHostViewAura | 96 class CONTENT_EXPORT RenderWidgetHostViewAura |
97 : public RenderWidgetHostViewBase, | 97 : public RenderWidgetHostViewBase, |
| 98 NON_EXPORTED_BASE(public RenderWidgetHostViewEventHandler::Delegate), |
98 public DelegatedFrameHostClient, | 99 public DelegatedFrameHostClient, |
99 public TextInputManager::Observer, | 100 public TextInputManager::Observer, |
100 public ui::TextInputClient, | 101 public ui::TextInputClient, |
101 public display::DisplayObserver, | 102 public display::DisplayObserver, |
102 public aura::WindowTreeHostObserver, | 103 public aura::WindowTreeHostObserver, |
103 public aura::WindowDelegate, | 104 public aura::WindowDelegate, |
104 public aura::client::ActivationDelegate, | 105 public aura::client::ActivationDelegate, |
105 public aura::client::FocusChangeObserver, | 106 public aura::client::FocusChangeObserver, |
106 public aura::client::CursorClientObserver, | 107 public aura::client::CursorClientObserver, |
107 public cc::BeginFrameObserver { | 108 public cc::BeginFrameObserver { |
(...skipping 14 matching lines...) Expand all Loading... |
122 gfx::NativeView GetNativeView() const override; | 123 gfx::NativeView GetNativeView() const override; |
123 gfx::NativeViewAccessible GetNativeViewAccessible() override; | 124 gfx::NativeViewAccessible GetNativeViewAccessible() override; |
124 ui::TextInputClient* GetTextInputClient() override; | 125 ui::TextInputClient* GetTextInputClient() override; |
125 bool HasFocus() const override; | 126 bool HasFocus() const override; |
126 bool IsSurfaceAvailableForCopy() const override; | 127 bool IsSurfaceAvailableForCopy() const override; |
127 void Show() override; | 128 void Show() override; |
128 void Hide() override; | 129 void Hide() override; |
129 bool IsShowing() override; | 130 bool IsShowing() override; |
130 gfx::Rect GetViewBounds() const override; | 131 gfx::Rect GetViewBounds() const override; |
131 void SetBackgroundColor(SkColor color) override; | 132 void SetBackgroundColor(SkColor color) override; |
| 133 bool IsMouseLocked() override; |
132 gfx::Size GetVisibleViewportSize() const override; | 134 gfx::Size GetVisibleViewportSize() const override; |
133 void SetInsets(const gfx::Insets& insets) override; | 135 void SetInsets(const gfx::Insets& insets) override; |
134 void FocusedNodeTouched(const gfx::Point& location_dips_screen, | 136 void FocusedNodeTouched(const gfx::Point& location_dips_screen, |
135 bool editable) override; | 137 bool editable) override; |
136 void SetNeedsBeginFrames(bool needs_begin_frames) override; | 138 void SetNeedsBeginFrames(bool needs_begin_frames) override; |
137 | 139 |
138 // Overridden from RenderWidgetHostViewBase: | 140 // Overridden from RenderWidgetHostViewBase: |
139 void InitAsPopup(RenderWidgetHostView* parent_host_view, | 141 void InitAsPopup(RenderWidgetHostView* parent_host_view, |
140 const gfx::Rect& pos) override; | 142 const gfx::Rect& pos) override; |
141 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override; | 143 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 // Method to indicate if this instance is shutting down or closing. | 300 // Method to indicate if this instance is shutting down or closing. |
299 // TODO(shrikant): Discuss around to see if it makes sense to add this method | 301 // TODO(shrikant): Discuss around to see if it makes sense to add this method |
300 // as part of RenderWidgetHostView. | 302 // as part of RenderWidgetHostView. |
301 bool IsClosing() const { return in_shutdown_; } | 303 bool IsClosing() const { return in_shutdown_; } |
302 | 304 |
303 // Sets whether the overscroll controller should be enabled for this page. | 305 // Sets whether the overscroll controller should be enabled for this page. |
304 void SetOverscrollControllerEnabled(bool enabled); | 306 void SetOverscrollControllerEnabled(bool enabled); |
305 | 307 |
306 void SnapToPhysicalPixelBoundary(); | 308 void SnapToPhysicalPixelBoundary(); |
307 | 309 |
308 ui::TouchSelectionController* selection_controller() const { | |
309 return selection_controller_.get(); | |
310 } | |
311 | |
312 TouchSelectionControllerClientAura* selection_controller_client() const { | |
313 return selection_controller_client_.get(); | |
314 } | |
315 | |
316 OverscrollController* overscroll_controller() const { | |
317 return overscroll_controller_.get(); | |
318 } | |
319 | |
320 // Called when the context menu is about to be displayed. | 310 // Called when the context menu is about to be displayed. |
321 // Returns true if the context menu should be displayed. We only return false | 311 // Returns true if the context menu should be displayed. We only return false |
322 // on Windows if the context menu is being displayed in response to a long | 312 // on Windows if the context menu is being displayed in response to a long |
323 // press gesture. On Windows we should be consistent like other apps and | 313 // press gesture. On Windows we should be consistent like other apps and |
324 // display the menu when the touch is released. | 314 // display the menu when the touch is released. |
325 bool OnShowContextMenu(const ContextMenuParams& params); | 315 bool OnShowContextMenu(const ContextMenuParams& params); |
326 | 316 |
327 // Used in tests to set a mock client for touch selection controller. It will | 317 // Used in tests to set a mock client for touch selection controller. It will |
328 // create a new touch selection controller for the new client. | 318 // create a new touch selection controller for the new client. |
329 void SetSelectionControllerClientForTest( | 319 void SetSelectionControllerClientForTest( |
330 std::unique_ptr<TouchSelectionControllerClientAura> client); | 320 std::unique_ptr<TouchSelectionControllerClientAura> client); |
331 | 321 |
332 // Exposed for tests. | 322 // Exposed for tests. |
333 cc::SurfaceId SurfaceIdForTesting() const override; | 323 cc::SurfaceId SurfaceIdForTesting() const override; |
334 | 324 |
| 325 // RenderWidgetHostViewEventHandler::Delegate: |
| 326 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const override; |
| 327 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event) override; |
| 328 RenderFrameHostImpl* GetFocusedFrame() override; |
| 329 bool NeedsMouseCapture() override; |
| 330 void SetTooltipsEnabled(bool enable) override; |
| 331 void Shutdown() override; |
| 332 |
| 333 RenderWidgetHostViewEventHandler* event_handler() { |
| 334 return event_handler_.get(); |
| 335 } |
| 336 |
335 protected: | 337 protected: |
336 ~RenderWidgetHostViewAura() override; | 338 ~RenderWidgetHostViewAura() override; |
337 | 339 |
338 // Exposed for tests. | 340 // Exposed for tests. |
339 aura::Window* window() { return window_; } | 341 aura::Window* window() { return window_; } |
340 | 342 |
341 DelegatedFrameHost* GetDelegatedFrameHost() const { | 343 DelegatedFrameHost* GetDelegatedFrameHost() const { |
342 return delegated_frame_host_.get(); | 344 return delegated_frame_host_.get(); |
343 } | 345 } |
344 | 346 |
345 const ui::MotionEventAura& pointer_state() const { return pointer_state_; } | |
346 | |
347 private: | 347 private: |
348 friend class InputMethodAuraTestBase; | 348 friend class InputMethodAuraTestBase; |
349 friend class RenderWidgetHostViewAuraCopyRequestTest; | 349 friend class RenderWidgetHostViewAuraCopyRequestTest; |
350 friend class TestInputMethodObserver; | 350 friend class TestInputMethodObserver; |
351 FRIEND_TEST_ALL_PREFIXES(InputMethodResultAuraTest, | 351 FRIEND_TEST_ALL_PREFIXES(InputMethodResultAuraTest, |
352 FinishImeCompositionSession); | 352 FinishImeCompositionSession); |
353 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, | 353 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, |
354 PopupRetainsCaptureAfterMouseRelease); | 354 PopupRetainsCaptureAfterMouseRelease); |
355 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText); | 355 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText); |
356 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState); | 356 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 // Creates and/or updates the legacy dummy window which corresponds to | 402 // Creates and/or updates the legacy dummy window which corresponds to |
403 // the bounds of the webcontents. It is needed for accessibility and | 403 // the bounds of the webcontents. It is needed for accessibility and |
404 // for scrolling to work in legacy drivers for trackpoints/trackpads, etc. | 404 // for scrolling to work in legacy drivers for trackpoints/trackpads, etc. |
405 void UpdateLegacyWin(); | 405 void UpdateLegacyWin(); |
406 | 406 |
407 bool UsesNativeWindowFrame() const; | 407 bool UsesNativeWindowFrame() const; |
408 #endif | 408 #endif |
409 | 409 |
410 ui::InputMethod* GetInputMethod() const; | 410 ui::InputMethod* GetInputMethod() const; |
411 | 411 |
412 // Sends shutdown request. | |
413 void Shutdown(); | |
414 | |
415 // Returns whether the widget needs an input grab to work properly. | 412 // Returns whether the widget needs an input grab to work properly. |
416 bool NeedsInputGrab(); | 413 bool NeedsInputGrab(); |
417 | 414 |
418 // Returns whether the widget needs to grab mouse capture to work properly. | |
419 bool NeedsMouseCapture(); | |
420 | |
421 // Confirm existing composition text in the webpage and ask the input method | |
422 // to cancel its ongoing composition session. | |
423 void FinishImeCompositionSession(); | |
424 | |
425 // This method computes movementX/Y and keeps track of mouse location for | |
426 // mouse lock on all mouse move events. | |
427 void ModifyEventMovementAndCoords(blink::WebMouseEvent* event); | |
428 | |
429 // Sends an IPC to the renderer process to communicate whether or not | 415 // Sends an IPC to the renderer process to communicate whether or not |
430 // the mouse cursor is visible anywhere on the screen. | 416 // the mouse cursor is visible anywhere on the screen. |
431 void NotifyRendererOfCursorVisibilityState(bool is_visible); | 417 void NotifyRendererOfCursorVisibilityState(bool is_visible); |
432 | 418 |
433 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty | 419 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty |
434 // SchedulePaint() is invoked for |rect|. | 420 // SchedulePaint() is invoked for |rect|. |
435 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip); | 421 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip); |
436 | 422 |
437 // Helper method to determine if, in mouse locked mode, the cursor should be | |
438 // moved to center. | |
439 bool ShouldMoveToCenter(); | |
440 | |
441 // Called after |window_| is parented to a WindowEventDispatcher. | 423 // Called after |window_| is parented to a WindowEventDispatcher. |
442 void AddedToRootWindow(); | 424 void AddedToRootWindow(); |
443 | 425 |
444 // Called prior to removing |window_| from a WindowEventDispatcher. | 426 // Called prior to removing |window_| from a WindowEventDispatcher. |
445 void RemovingFromRootWindow(); | 427 void RemovingFromRootWindow(); |
446 | 428 |
447 // DelegatedFrameHostClient implementation. | 429 // DelegatedFrameHostClient implementation. |
448 ui::Layer* DelegatedFrameHostGetLayer() const override; | 430 ui::Layer* DelegatedFrameHostGetLayer() const override; |
449 bool DelegatedFrameHostIsVisible() const override; | 431 bool DelegatedFrameHostIsVisible() const override; |
450 SkColor DelegatedFrameHostGetGutterColor(SkColor color) const override; | 432 SkColor DelegatedFrameHostGetGutterColor(SkColor color) const override; |
(...skipping 23 matching lines...) Expand all Loading... |
474 RenderWidgetHostViewBase* updated_view) override; | 456 RenderWidgetHostViewBase* updated_view) override; |
475 | 457 |
476 // cc::BeginFrameObserver implementation. | 458 // cc::BeginFrameObserver implementation. |
477 void OnBeginFrame(const cc::BeginFrameArgs& args) override; | 459 void OnBeginFrame(const cc::BeginFrameArgs& args) override; |
478 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; | 460 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; |
479 void OnBeginFrameSourcePausedChanged(bool paused) override; | 461 void OnBeginFrameSourcePausedChanged(bool paused) override; |
480 | 462 |
481 // Detaches |this| from the input method object. | 463 // Detaches |this| from the input method object. |
482 void DetachFromInputMethod(); | 464 void DetachFromInputMethod(); |
483 | 465 |
484 // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method | |
485 // calls our keybindings handler against the event and send matched | |
486 // edit commands to renderer instead. | |
487 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event); | |
488 | |
489 // Dismisses a Web Popup on a mouse or touch press outside the popup and its | 466 // Dismisses a Web Popup on a mouse or touch press outside the popup and its |
490 // parent. | 467 // parent. |
491 void ApplyEventFilterForPopupExit(ui::LocatedEvent* event); | 468 void ApplyEventFilterForPopupExit(ui::LocatedEvent* event); |
492 | 469 |
493 // Converts |rect| from window coordinate to screen coordinate. | |
494 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const; | |
495 | |
496 // Converts |rect| from screen coordinate to window coordinate. | 470 // Converts |rect| from screen coordinate to window coordinate. |
497 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const; | 471 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const; |
498 | 472 |
499 // Helper function to set keyboard focus to the main window. | |
500 void SetKeyboardFocus(); | |
501 | |
502 RenderFrameHostImpl* GetFocusedFrame(); | |
503 | |
504 // Returns true if the |event| passed in can be forwarded to the renderer. | |
505 bool CanRendererHandleEvent(const ui::MouseEvent* event, | |
506 bool mouse_locked, | |
507 bool selection_popup) const; | |
508 | |
509 // Returns true when we can do SurfaceHitTesting for the event type. | |
510 bool ShouldRouteEvent(const ui::Event* event) const; | |
511 | |
512 // Called when the parent window bounds change. | 473 // Called when the parent window bounds change. |
513 void HandleParentBoundsChanged(); | 474 void HandleParentBoundsChanged(); |
514 | 475 |
515 // Called when the parent window hierarchy for our window changes. | 476 // Called when the parent window hierarchy for our window changes. |
516 void ParentHierarchyChanged(); | 477 void ParentHierarchyChanged(); |
517 | 478 |
518 // Helper function to be called whenever new selection information is | 479 // Helper function to be called whenever new selection information is |
519 // received. It will update selection controller. | 480 // received. It will update selection controller. |
520 void SelectionUpdated(bool is_editable, | 481 void SelectionUpdated(bool is_editable, |
521 bool is_empty_text_form_control, | 482 bool is_empty_text_form_control, |
522 const gfx::SelectionBound& start, | 483 const gfx::SelectionBound& start, |
523 const gfx::SelectionBound& end); | 484 const gfx::SelectionBound& end); |
524 | 485 |
525 // Helper function to create a selection controller. | 486 // Helper function to create a selection controller. |
526 void CreateSelectionController(); | 487 void CreateSelectionController(); |
527 | 488 |
528 // Performs gesture handling needed for touch text selection. Sets event as | 489 // Used to set the |popup_child_host_view_| on the |popup_parent_host_view_| |
529 // handled if it should not be further processed. | 490 // and to notify the |event_handler_|. |
530 void HandleGestureForTouchSelection(ui::GestureEvent* event); | 491 void SetPopupChild(RenderWidgetHostViewAura* popup_child_host_view); |
531 | |
532 // Forwards a mouse event to this view's parent window delegate. | |
533 void ForwardMouseEventToParent(ui::MouseEvent* event); | |
534 | |
535 // Returns the RenderViewHostDelegateView instance for this view. Returns | |
536 // NULL on failure. | |
537 RenderViewHostDelegateView* GetRenderViewHostDelegateView(); | |
538 | 492 |
539 // The model object. | 493 // The model object. |
540 RenderWidgetHostImpl* const host_; | 494 RenderWidgetHostImpl* const host_; |
541 | 495 |
542 aura::Window* window_; | 496 aura::Window* window_; |
543 | 497 |
544 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_; | 498 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_; |
545 | 499 |
546 std::unique_ptr<WindowObserver> window_observer_; | 500 std::unique_ptr<WindowObserver> window_observer_; |
547 | 501 |
548 // Tracks the ancestors of the RWHVA window for window location changes. | 502 // Tracks the ancestors of the RWHVA window for window location changes. |
549 std::unique_ptr<WindowAncestorObserver> ancestor_window_observer_; | 503 std::unique_ptr<WindowAncestorObserver> ancestor_window_observer_; |
550 | 504 |
551 // Are we in the process of closing? Tracked so fullscreen views can avoid | 505 // Are we in the process of closing? Tracked so fullscreen views can avoid |
552 // sending a second shutdown request to the host when they lose the focus | 506 // sending a second shutdown request to the host when they lose the focus |
553 // after requesting shutdown for another reason (e.g. Escape key). | 507 // after requesting shutdown for another reason (e.g. Escape key). |
554 bool in_shutdown_; | 508 bool in_shutdown_; |
555 | 509 |
556 // True if in the process of handling a window bounds changed notification. | 510 // True if in the process of handling a window bounds changed notification. |
557 bool in_bounds_changed_; | 511 bool in_bounds_changed_; |
558 | 512 |
559 // Is this a fullscreen view? | |
560 bool is_fullscreen_; | |
561 | |
562 // Our parent host view, if this is a popup. NULL otherwise. | 513 // Our parent host view, if this is a popup. NULL otherwise. |
563 RenderWidgetHostViewAura* popup_parent_host_view_; | 514 RenderWidgetHostViewAura* popup_parent_host_view_; |
564 | 515 |
565 // Our child popup host. NULL if we do not have a child popup. | 516 // Our child popup host. NULL if we do not have a child popup. |
566 RenderWidgetHostViewAura* popup_child_host_view_; | 517 RenderWidgetHostViewAura* popup_child_host_view_; |
567 | 518 |
568 class EventFilterForPopupExit; | 519 class EventFilterForPopupExit; |
569 friend class EventFilterForPopupExit; | 520 friend class EventFilterForPopupExit; |
570 std::unique_ptr<ui::EventHandler> event_filter_for_popup_exit_; | 521 std::unique_ptr<ui::EventHandler> event_filter_for_popup_exit_; |
571 | 522 |
572 // True when content is being loaded. Used to show an hourglass cursor. | 523 // True when content is being loaded. Used to show an hourglass cursor. |
573 bool is_loading_; | 524 bool is_loading_; |
574 | 525 |
575 // The cursor for the page. This is passed up from the renderer. | 526 // The cursor for the page. This is passed up from the renderer. |
576 WebCursor current_cursor_; | 527 WebCursor current_cursor_; |
577 | 528 |
578 // Stores the current state of the active pointers targeting this | |
579 // object. | |
580 ui::MotionEventAura pointer_state_; | |
581 | |
582 | |
583 // Indicates if there is onging composition text. | 529 // Indicates if there is onging composition text. |
584 bool has_composition_text_; | 530 bool has_composition_text_; |
585 | 531 |
586 // Whether return characters should be passed on to the RenderWidgetHostImpl. | |
587 bool accept_return_character_; | |
588 | |
589 // Current tooltip text. | 532 // Current tooltip text. |
590 base::string16 tooltip_; | 533 base::string16 tooltip_; |
591 | 534 |
592 // The begin frame source being observed. Null if none. | 535 // The begin frame source being observed. Null if none. |
593 cc::BeginFrameSource* begin_frame_source_; | 536 cc::BeginFrameSource* begin_frame_source_; |
594 cc::BeginFrameArgs last_begin_frame_args_; | 537 cc::BeginFrameArgs last_begin_frame_args_; |
595 bool needs_begin_frames_; | 538 bool needs_begin_frames_; |
596 | 539 |
597 // Used to record the last position of the mouse. | |
598 // While the mouse is locked, they store the last known position just as mouse | |
599 // lock was entered. | |
600 // Relative to the upper-left corner of the view. | |
601 gfx::Point unlocked_mouse_position_; | |
602 // Relative to the upper-left corner of the screen. | |
603 gfx::Point unlocked_global_mouse_position_; | |
604 // Last cursor position relative to screen. Used to compute movementX/Y. | |
605 gfx::Point global_mouse_position_; | |
606 // In mouse locked mode, we synthetically move the mouse cursor to the center | |
607 // of the window when it reaches the window borders to avoid it going outside. | |
608 // This flag is used to differentiate between these synthetic mouse move | |
609 // events vs. normal mouse move events. | |
610 bool synthetic_move_sent_; | |
611 | |
612 // Used to track the state of the window we're created from. Only used when | |
613 // created fullscreen. | |
614 std::unique_ptr<aura::WindowTracker> host_tracker_; | |
615 | |
616 // Used to track the last cursor visibility update that was sent to the | 540 // Used to track the last cursor visibility update that was sent to the |
617 // renderer via NotifyRendererOfCursorVisibilityState(). | 541 // renderer via NotifyRendererOfCursorVisibilityState(). |
618 enum CursorVisibilityState { | 542 enum CursorVisibilityState { |
619 UNKNOWN, | 543 UNKNOWN, |
620 VISIBLE, | 544 VISIBLE, |
621 NOT_VISIBLE, | 545 NOT_VISIBLE, |
622 }; | 546 }; |
623 CursorVisibilityState cursor_visibility_state_in_renderer_; | 547 CursorVisibilityState cursor_visibility_state_in_renderer_; |
624 | 548 |
625 #if defined(OS_WIN) | 549 #if defined(OS_WIN) |
(...skipping 18 matching lines...) Expand all Loading... |
644 std::unique_ptr<ContextMenuParams> last_context_menu_params_; | 568 std::unique_ptr<ContextMenuParams> last_context_menu_params_; |
645 | 569 |
646 // Set to true if we requested the on screen keyboard to be displayed. | 570 // Set to true if we requested the on screen keyboard to be displayed. |
647 bool virtual_keyboard_requested_; | 571 bool virtual_keyboard_requested_; |
648 | 572 |
649 std::unique_ptr<ui::OnScreenKeyboardObserver> keyboard_observer_; | 573 std::unique_ptr<ui::OnScreenKeyboardObserver> keyboard_observer_; |
650 #endif | 574 #endif |
651 | 575 |
652 bool has_snapped_to_boundary_; | 576 bool has_snapped_to_boundary_; |
653 | 577 |
654 std::unique_ptr<TouchSelectionControllerClientAura> | |
655 selection_controller_client_; | |
656 std::unique_ptr<ui::TouchSelectionController> selection_controller_; | |
657 | |
658 std::unique_ptr<OverscrollController> overscroll_controller_; | |
659 | |
660 // The last scroll offset of the view. | 578 // The last scroll offset of the view. |
661 gfx::Vector2dF last_scroll_offset_; | 579 gfx::Vector2dF last_scroll_offset_; |
662 | 580 |
663 gfx::Insets insets_; | 581 gfx::Insets insets_; |
664 | 582 |
665 std::vector<ui::LatencyInfo> software_latency_info_; | 583 std::vector<ui::LatencyInfo> software_latency_info_; |
666 | 584 |
667 std::unique_ptr<aura::client::ScopedTooltipDisabler> tooltip_disabler_; | 585 std::unique_ptr<aura::client::ScopedTooltipDisabler> tooltip_disabler_; |
668 | 586 |
669 // True when this view acts as a platform view hack for a | 587 // True when this view acts as a platform view hack for a |
670 // RenderWidgetHostViewGuest. | 588 // RenderWidgetHostViewGuest. |
671 bool is_guest_view_hack_; | 589 bool is_guest_view_hack_; |
672 | 590 |
673 // This flag when set ensures that we send over a notification to blink that | |
674 // the current view has focus. Defaults to false. | |
675 bool set_focus_on_mouse_down_or_key_event_; | |
676 | |
677 float device_scale_factor_; | 591 float device_scale_factor_; |
678 | 592 |
679 // Allows tests to send gesture events for testing without first sending a | |
680 // corresponding touch sequence, as would be required by | |
681 // RenderWidgetHostInputEventRouter. | |
682 bool disable_input_event_router_for_testing_; | |
683 | |
684 // The routing and process IDs for the last RenderWidgetHost which had a | 593 // The routing and process IDs for the last RenderWidgetHost which had a |
685 // TextInputState of non-NONE. | 594 // TextInputState of non-NONE. |
686 int32_t last_active_widget_process_id_; | 595 int32_t last_active_widget_process_id_; |
687 int32_t last_active_widget_routing_id_; | 596 int32_t last_active_widget_routing_id_; |
688 | 597 |
| 598 // While this is a ui::EventHandler for targetting, |event_handler_| actually |
| 599 // provides an implementation, and directs events to |host_|. |
| 600 std::unique_ptr<RenderWidgetHostViewEventHandler> event_handler_; |
| 601 |
689 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; | 602 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; |
690 | 603 |
691 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); | 604 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); |
692 }; | 605 }; |
693 | 606 |
694 } // namespace content | 607 } // namespace content |
695 | 608 |
696 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 609 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
OLD | NEW |