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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 // Method to indicate if this instance is shutting down or closing. | 302 // Method to indicate if this instance is shutting down or closing. |
301 // TODO(shrikant): Discuss around to see if it makes sense to add this method | 303 // TODO(shrikant): Discuss around to see if it makes sense to add this method |
302 // as part of RenderWidgetHostView. | 304 // as part of RenderWidgetHostView. |
303 bool IsClosing() const { return in_shutdown_; } | 305 bool IsClosing() const { return in_shutdown_; } |
304 | 306 |
305 // Sets whether the overscroll controller should be enabled for this page. | 307 // Sets whether the overscroll controller should be enabled for this page. |
306 void SetOverscrollControllerEnabled(bool enabled); | 308 void SetOverscrollControllerEnabled(bool enabled); |
307 | 309 |
308 void SnapToPhysicalPixelBoundary(); | 310 void SnapToPhysicalPixelBoundary(); |
309 | 311 |
310 ui::TouchSelectionController* selection_controller() const { | |
311 return selection_controller_.get(); | |
312 } | |
313 | |
314 TouchSelectionControllerClientAura* selection_controller_client() const { | |
315 return selection_controller_client_.get(); | |
316 } | |
317 | |
318 OverscrollController* overscroll_controller() const { | |
319 return overscroll_controller_.get(); | |
320 } | |
321 | |
322 // Called when the context menu is about to be displayed. | 312 // Called when the context menu is about to be displayed. |
323 // Returns true if the context menu should be displayed. We only return false | 313 // Returns true if the context menu should be displayed. We only return false |
324 // on Windows if the context menu is being displayed in response to a long | 314 // on Windows if the context menu is being displayed in response to a long |
325 // press gesture. On Windows we should be consistent like other apps and | 315 // press gesture. On Windows we should be consistent like other apps and |
326 // display the menu when the touch is released. | 316 // display the menu when the touch is released. |
327 bool OnShowContextMenu(const ContextMenuParams& params); | 317 bool OnShowContextMenu(const ContextMenuParams& params); |
328 | 318 |
329 // Used in tests to set a mock client for touch selection controller. It will | 319 // Used in tests to set a mock client for touch selection controller. It will |
330 // create a new touch selection controller for the new client. | 320 // create a new touch selection controller for the new client. |
331 void SetSelectionControllerClientForTest( | 321 void SetSelectionControllerClientForTest( |
332 std::unique_ptr<TouchSelectionControllerClientAura> client); | 322 std::unique_ptr<TouchSelectionControllerClientAura> client); |
333 | 323 |
334 // Exposed for tests. | 324 // Exposed for tests. |
335 cc::SurfaceId SurfaceIdForTesting() const override; | 325 cc::SurfaceId SurfaceIdForTesting() const override; |
336 | 326 |
| 327 // RenderWidgetHostViewEventHandler::Delegate: |
| 328 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const override; |
| 329 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event) override; |
| 330 RenderFrameHostImpl* GetFocusedFrame(); |
| 331 bool NeedsMouseCapture() override; |
| 332 void SetTooltipsEnabled(bool enable) override; |
| 333 void ShowContextMenu(const ContextMenuParams& params) override; |
| 334 void Shutdown() override; |
| 335 |
| 336 RenderWidgetHostViewEventHandler* event_handler() { |
| 337 return event_handler_.get(); |
| 338 } |
| 339 |
337 protected: | 340 protected: |
338 ~RenderWidgetHostViewAura() override; | 341 ~RenderWidgetHostViewAura() override; |
339 | 342 |
340 // Exposed for tests. | 343 // Exposed for tests. |
341 aura::Window* window() { return window_; } | 344 aura::Window* window() { return window_; } |
342 | 345 |
343 DelegatedFrameHost* GetDelegatedFrameHost() const { | 346 DelegatedFrameHost* GetDelegatedFrameHost() const { |
344 return delegated_frame_host_.get(); | 347 return delegated_frame_host_.get(); |
345 } | 348 } |
346 | 349 |
347 const ui::MotionEventAura& pointer_state() const { return pointer_state_; } | |
348 | |
349 private: | 350 private: |
350 friend class InputMethodAuraTestBase; | 351 friend class InputMethodAuraTestBase; |
351 friend class RenderWidgetHostViewAuraCopyRequestTest; | 352 friend class RenderWidgetHostViewAuraCopyRequestTest; |
352 friend class TestInputMethodObserver; | 353 friend class TestInputMethodObserver; |
353 FRIEND_TEST_ALL_PREFIXES(InputMethodResultAuraTest, | 354 FRIEND_TEST_ALL_PREFIXES(InputMethodResultAuraTest, |
354 FinishImeCompositionSession); | 355 FinishImeCompositionSession); |
355 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, | 356 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, |
356 PopupRetainsCaptureAfterMouseRelease); | 357 PopupRetainsCaptureAfterMouseRelease); |
357 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText); | 358 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText); |
358 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState); | 359 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 // Creates and/or updates the legacy dummy window which corresponds to | 405 // Creates and/or updates the legacy dummy window which corresponds to |
405 // the bounds of the webcontents. It is needed for accessibility and | 406 // the bounds of the webcontents. It is needed for accessibility and |
406 // for scrolling to work in legacy drivers for trackpoints/trackpads, etc. | 407 // for scrolling to work in legacy drivers for trackpoints/trackpads, etc. |
407 void UpdateLegacyWin(); | 408 void UpdateLegacyWin(); |
408 | 409 |
409 bool UsesNativeWindowFrame() const; | 410 bool UsesNativeWindowFrame() const; |
410 #endif | 411 #endif |
411 | 412 |
412 ui::InputMethod* GetInputMethod() const; | 413 ui::InputMethod* GetInputMethod() const; |
413 | 414 |
414 // Sends shutdown request. | |
415 void Shutdown(); | |
416 | |
417 // Returns whether the widget needs an input grab to work properly. | 415 // Returns whether the widget needs an input grab to work properly. |
418 bool NeedsInputGrab(); | 416 bool NeedsInputGrab(); |
419 | 417 |
420 // Returns whether the widget needs to grab mouse capture to work properly. | |
421 bool NeedsMouseCapture(); | |
422 | |
423 // Confirm existing composition text in the webpage and ask the input method | |
424 // to cancel its ongoing composition session. | |
425 void FinishImeCompositionSession(); | |
426 | |
427 // This method computes movementX/Y and keeps track of mouse location for | |
428 // mouse lock on all mouse move events. | |
429 // |ui_mouse_event| contains the mouse event received. | |
430 // |event| contains the WebMouseEvent being modified. | |
431 void ModifyEventMovementAndCoords(const ui::MouseEvent& ui_mouse_event, | |
432 blink::WebMouseEvent* event); | |
433 | |
434 // Sends an IPC to the renderer process to communicate whether or not | 418 // Sends an IPC to the renderer process to communicate whether or not |
435 // the mouse cursor is visible anywhere on the screen. | 419 // the mouse cursor is visible anywhere on the screen. |
436 void NotifyRendererOfCursorVisibilityState(bool is_visible); | 420 void NotifyRendererOfCursorVisibilityState(bool is_visible); |
437 | 421 |
438 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty | 422 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty |
439 // SchedulePaint() is invoked for |rect|. | 423 // SchedulePaint() is invoked for |rect|. |
440 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip); | 424 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip); |
441 | 425 |
442 // Helper method to determine if, in mouse locked mode, the cursor should be | |
443 // moved to center. | |
444 bool ShouldMoveToCenter(); | |
445 | |
446 // Called after |window_| is parented to a WindowEventDispatcher. | 426 // Called after |window_| is parented to a WindowEventDispatcher. |
447 void AddedToRootWindow(); | 427 void AddedToRootWindow(); |
448 | 428 |
449 // Called prior to removing |window_| from a WindowEventDispatcher. | 429 // Called prior to removing |window_| from a WindowEventDispatcher. |
450 void RemovingFromRootWindow(); | 430 void RemovingFromRootWindow(); |
451 | 431 |
452 // DelegatedFrameHostClient implementation. | 432 // DelegatedFrameHostClient implementation. |
453 ui::Layer* DelegatedFrameHostGetLayer() const override; | 433 ui::Layer* DelegatedFrameHostGetLayer() const override; |
454 bool DelegatedFrameHostIsVisible() const override; | 434 bool DelegatedFrameHostIsVisible() const override; |
455 SkColor DelegatedFrameHostGetGutterColor(SkColor color) const override; | 435 SkColor DelegatedFrameHostGetGutterColor(SkColor color) const override; |
(...skipping 23 matching lines...) Expand all Loading... |
479 RenderWidgetHostViewBase* updated_view) override; | 459 RenderWidgetHostViewBase* updated_view) override; |
480 | 460 |
481 // cc::BeginFrameObserver implementation. | 461 // cc::BeginFrameObserver implementation. |
482 void OnBeginFrame(const cc::BeginFrameArgs& args) override; | 462 void OnBeginFrame(const cc::BeginFrameArgs& args) override; |
483 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; | 463 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; |
484 void OnBeginFrameSourcePausedChanged(bool paused) override; | 464 void OnBeginFrameSourcePausedChanged(bool paused) override; |
485 | 465 |
486 // Detaches |this| from the input method object. | 466 // Detaches |this| from the input method object. |
487 void DetachFromInputMethod(); | 467 void DetachFromInputMethod(); |
488 | 468 |
489 // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method | |
490 // calls our keybindings handler against the event and send matched | |
491 // edit commands to renderer instead. | |
492 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event); | |
493 | |
494 // Dismisses a Web Popup on a mouse or touch press outside the popup and its | 469 // Dismisses a Web Popup on a mouse or touch press outside the popup and its |
495 // parent. | 470 // parent. |
496 void ApplyEventFilterForPopupExit(ui::LocatedEvent* event); | 471 void ApplyEventFilterForPopupExit(ui::LocatedEvent* event); |
497 | 472 |
498 // Converts |rect| from window coordinate to screen coordinate. | |
499 gfx::Rect ConvertRectToScreen(const gfx::Rect& rect) const; | |
500 | |
501 // Converts |rect| from screen coordinate to window coordinate. | 473 // Converts |rect| from screen coordinate to window coordinate. |
502 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const; | 474 gfx::Rect ConvertRectFromScreen(const gfx::Rect& rect) const; |
503 | 475 |
504 // Helper function to set keyboard focus to the main window. | |
505 void SetKeyboardFocus(); | |
506 | |
507 RenderFrameHostImpl* GetFocusedFrame(); | |
508 | |
509 // Returns true if the |event| passed in can be forwarded to the renderer. | |
510 bool CanRendererHandleEvent(const ui::MouseEvent* event, | |
511 bool mouse_locked, | |
512 bool selection_popup) const; | |
513 | |
514 // Returns true when we can do SurfaceHitTesting for the event type. | |
515 bool ShouldRouteEvent(const ui::Event* event) const; | |
516 | |
517 // Called when the parent window bounds change. | 476 // Called when the parent window bounds change. |
518 void HandleParentBoundsChanged(); | 477 void HandleParentBoundsChanged(); |
519 | 478 |
520 // Called when the parent window hierarchy for our window changes. | 479 // Called when the parent window hierarchy for our window changes. |
521 void ParentHierarchyChanged(); | 480 void ParentHierarchyChanged(); |
522 | 481 |
523 // Helper function to be called whenever new selection information is | 482 // Helper function to be called whenever new selection information is |
524 // received. It will update selection controller. | 483 // received. It will update selection controller. |
525 void SelectionUpdated(bool is_editable, | 484 void SelectionUpdated(bool is_editable, |
526 bool is_empty_text_form_control, | 485 bool is_empty_text_form_control, |
527 const gfx::SelectionBound& start, | 486 const gfx::SelectionBound& start, |
528 const gfx::SelectionBound& end); | 487 const gfx::SelectionBound& end); |
529 | 488 |
530 // Helper function to create a selection controller. | 489 // Helper function to create a selection controller. |
531 void CreateSelectionController(); | 490 void CreateSelectionController(); |
532 | 491 |
533 // Performs gesture handling needed for touch text selection. Sets event as | 492 // Used to set the |popup_child_host_view_| on the |popup_parent_host_view_| |
534 // handled if it should not be further processed. | 493 // and to notify the |event_handler_|. |
535 void HandleGestureForTouchSelection(ui::GestureEvent* event); | 494 void SetPopupChild(RenderWidgetHostViewAura* popup_child_host_view); |
536 | 495 |
537 // Forwards a mouse event to this view's parent window delegate. | 496 // Forwards a mouse event to this view's parent window delegate. |
538 void ForwardMouseEventToParent(ui::MouseEvent* event); | 497 void ForwardMouseEventToParent(ui::MouseEvent* event); |
539 | 498 |
540 // Adds/Removes frame observer based on state. | 499 // Adds/Removes frame observer based on state. |
541 void UpdateNeedsBeginFramesInternal(); | 500 void UpdateNeedsBeginFramesInternal(); |
542 | 501 |
543 // Returns the RenderViewHostDelegateView instance for this view. Returns | |
544 // NULL on failure. | |
545 RenderViewHostDelegateView* GetRenderViewHostDelegateView(); | |
546 | |
547 // The model object. | 502 // The model object. |
548 RenderWidgetHostImpl* const host_; | 503 RenderWidgetHostImpl* const host_; |
549 | 504 |
550 aura::Window* window_; | 505 aura::Window* window_; |
551 | 506 |
552 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_; | 507 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_; |
553 | 508 |
554 std::unique_ptr<WindowObserver> window_observer_; | 509 std::unique_ptr<WindowObserver> window_observer_; |
555 | 510 |
556 // Tracks the ancestors of the RWHVA window for window location changes. | 511 // Tracks the ancestors of the RWHVA window for window location changes. |
557 std::unique_ptr<WindowAncestorObserver> ancestor_window_observer_; | 512 std::unique_ptr<WindowAncestorObserver> ancestor_window_observer_; |
558 | 513 |
559 // Are we in the process of closing? Tracked so fullscreen views can avoid | 514 // Are we in the process of closing? Tracked so fullscreen views can avoid |
560 // sending a second shutdown request to the host when they lose the focus | 515 // sending a second shutdown request to the host when they lose the focus |
561 // after requesting shutdown for another reason (e.g. Escape key). | 516 // after requesting shutdown for another reason (e.g. Escape key). |
562 bool in_shutdown_; | 517 bool in_shutdown_; |
563 | 518 |
564 // True if in the process of handling a window bounds changed notification. | 519 // True if in the process of handling a window bounds changed notification. |
565 bool in_bounds_changed_; | 520 bool in_bounds_changed_; |
566 | 521 |
567 // Is this a fullscreen view? | |
568 bool is_fullscreen_; | |
569 | |
570 // Our parent host view, if this is a popup. NULL otherwise. | 522 // Our parent host view, if this is a popup. NULL otherwise. |
571 RenderWidgetHostViewAura* popup_parent_host_view_; | 523 RenderWidgetHostViewAura* popup_parent_host_view_; |
572 | 524 |
573 // Our child popup host. NULL if we do not have a child popup. | 525 // Our child popup host. NULL if we do not have a child popup. |
574 RenderWidgetHostViewAura* popup_child_host_view_; | 526 RenderWidgetHostViewAura* popup_child_host_view_; |
575 | 527 |
576 class EventFilterForPopupExit; | 528 class EventFilterForPopupExit; |
577 friend class EventFilterForPopupExit; | 529 friend class EventFilterForPopupExit; |
578 std::unique_ptr<ui::EventHandler> event_filter_for_popup_exit_; | 530 std::unique_ptr<ui::EventHandler> event_filter_for_popup_exit_; |
579 | 531 |
580 // True when content is being loaded. Used to show an hourglass cursor. | 532 // True when content is being loaded. Used to show an hourglass cursor. |
581 bool is_loading_; | 533 bool is_loading_; |
582 | 534 |
583 // The cursor for the page. This is passed up from the renderer. | 535 // The cursor for the page. This is passed up from the renderer. |
584 WebCursor current_cursor_; | 536 WebCursor current_cursor_; |
585 | 537 |
586 // Stores the current state of the active pointers targeting this | |
587 // object. | |
588 ui::MotionEventAura pointer_state_; | |
589 | |
590 | |
591 // Indicates if there is onging composition text. | 538 // Indicates if there is onging composition text. |
592 bool has_composition_text_; | 539 bool has_composition_text_; |
593 | 540 |
594 // Whether return characters should be passed on to the RenderWidgetHostImpl. | |
595 bool accept_return_character_; | |
596 | |
597 // Current tooltip text. | 541 // Current tooltip text. |
598 base::string16 tooltip_; | 542 base::string16 tooltip_; |
599 | 543 |
600 // The begin frame source being observed. Null if none. | 544 // The begin frame source being observed. Null if none. |
601 cc::BeginFrameSource* begin_frame_source_; | 545 cc::BeginFrameSource* begin_frame_source_; |
602 cc::BeginFrameArgs last_begin_frame_args_; | 546 cc::BeginFrameArgs last_begin_frame_args_; |
603 | 547 |
604 // Whether a request for begin frames has been issued. | 548 // Whether a request for begin frames has been issued. |
605 bool needs_begin_frames_; | 549 bool needs_begin_frames_; |
606 | 550 |
607 // Whether a request to flush input has been issued. | 551 // Whether a request to flush input has been issued. |
608 bool needs_flush_input_; | 552 bool needs_flush_input_; |
609 | 553 |
610 // Whether or not a frame observer has been added. | 554 // Whether or not a frame observer has been added. |
611 bool added_frame_observer_; | 555 bool added_frame_observer_; |
612 | 556 |
613 // Used to record the last position of the mouse. | |
614 // While the mouse is locked, they store the last known position just as mouse | |
615 // lock was entered. | |
616 // Relative to the upper-left corner of the view. | |
617 gfx::Point unlocked_mouse_position_; | |
618 // Relative to the upper-left corner of the screen. | |
619 gfx::Point unlocked_global_mouse_position_; | |
620 // Last cursor position relative to screen. Used to compute movementX/Y. | |
621 gfx::Point global_mouse_position_; | |
622 // In mouse locked mode, we synthetically move the mouse cursor to the center | |
623 // of the window when it reaches the window borders to avoid it going outside. | |
624 // This flag is used to differentiate between these synthetic mouse move | |
625 // events vs. normal mouse move events. | |
626 bool synthetic_move_sent_; | |
627 | |
628 // Used to track the state of the window we're created from. Only used when | |
629 // created fullscreen. | |
630 std::unique_ptr<aura::WindowTracker> host_tracker_; | |
631 | |
632 // Used to track the last cursor visibility update that was sent to the | 557 // Used to track the last cursor visibility update that was sent to the |
633 // renderer via NotifyRendererOfCursorVisibilityState(). | 558 // renderer via NotifyRendererOfCursorVisibilityState(). |
634 enum CursorVisibilityState { | 559 enum CursorVisibilityState { |
635 UNKNOWN, | 560 UNKNOWN, |
636 VISIBLE, | 561 VISIBLE, |
637 NOT_VISIBLE, | 562 NOT_VISIBLE, |
638 }; | 563 }; |
639 CursorVisibilityState cursor_visibility_state_in_renderer_; | 564 CursorVisibilityState cursor_visibility_state_in_renderer_; |
640 | 565 |
641 #if defined(OS_WIN) | 566 #if defined(OS_WIN) |
(...skipping 18 matching lines...) Expand all Loading... |
660 std::unique_ptr<ContextMenuParams> last_context_menu_params_; | 585 std::unique_ptr<ContextMenuParams> last_context_menu_params_; |
661 | 586 |
662 // Set to true if we requested the on screen keyboard to be displayed. | 587 // Set to true if we requested the on screen keyboard to be displayed. |
663 bool virtual_keyboard_requested_; | 588 bool virtual_keyboard_requested_; |
664 | 589 |
665 std::unique_ptr<ui::OnScreenKeyboardObserver> keyboard_observer_; | 590 std::unique_ptr<ui::OnScreenKeyboardObserver> keyboard_observer_; |
666 #endif | 591 #endif |
667 | 592 |
668 bool has_snapped_to_boundary_; | 593 bool has_snapped_to_boundary_; |
669 | 594 |
670 std::unique_ptr<TouchSelectionControllerClientAura> | |
671 selection_controller_client_; | |
672 std::unique_ptr<ui::TouchSelectionController> selection_controller_; | |
673 | |
674 std::unique_ptr<OverscrollController> overscroll_controller_; | |
675 | |
676 // The last scroll offset of the view. | 595 // The last scroll offset of the view. |
677 gfx::Vector2dF last_scroll_offset_; | 596 gfx::Vector2dF last_scroll_offset_; |
678 | 597 |
679 gfx::Insets insets_; | 598 gfx::Insets insets_; |
680 | 599 |
681 std::vector<ui::LatencyInfo> software_latency_info_; | 600 std::vector<ui::LatencyInfo> software_latency_info_; |
682 | 601 |
683 std::unique_ptr<aura::client::ScopedTooltipDisabler> tooltip_disabler_; | 602 std::unique_ptr<aura::client::ScopedTooltipDisabler> tooltip_disabler_; |
684 | 603 |
685 // True when this view acts as a platform view hack for a | 604 // True when this view acts as a platform view hack for a |
686 // RenderWidgetHostViewGuest. | 605 // RenderWidgetHostViewGuest. |
687 bool is_guest_view_hack_; | 606 bool is_guest_view_hack_; |
688 | 607 |
689 // This flag when set ensures that we send over a notification to blink that | |
690 // the current view has focus. Defaults to false. | |
691 bool set_focus_on_mouse_down_or_key_event_; | |
692 | |
693 float device_scale_factor_; | 608 float device_scale_factor_; |
694 | 609 |
695 // Allows tests to send gesture events for testing without first sending a | |
696 // corresponding touch sequence, as would be required by | |
697 // RenderWidgetHostInputEventRouter. | |
698 bool disable_input_event_router_for_testing_; | |
699 | |
700 // The routing and process IDs for the last RenderWidgetHost which had a | 610 // The routing and process IDs for the last RenderWidgetHost which had a |
701 // TextInputState of non-NONE. | 611 // TextInputState of non-NONE. |
702 int32_t last_active_widget_process_id_; | 612 int32_t last_active_widget_process_id_; |
703 int32_t last_active_widget_routing_id_; | 613 int32_t last_active_widget_routing_id_; |
704 | 614 |
| 615 // While this is a ui::EventHandler for targetting, |event_handler_| actually |
| 616 // provides an implementation, and directs events to |host_|. |
| 617 std::unique_ptr<RenderWidgetHostViewEventHandler> event_handler_; |
| 618 |
705 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; | 619 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; |
706 | 620 |
707 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); | 621 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); |
708 }; | 622 }; |
709 | 623 |
710 } // namespace content | 624 } // namespace content |
711 | 625 |
712 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 626 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
OLD | NEW |