| 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 <set> | 12 #include <set> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/callback.h" | 16 #include "base/callback.h" |
| 17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/memory/linked_ptr.h" | 19 #include "base/memory/linked_ptr.h" |
| 20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
| 21 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
| 22 #include "base/memory/weak_ptr.h" | 22 #include "base/memory/weak_ptr.h" |
| 23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 24 #include "cc/scheduler/begin_frame_source.h" |
| 24 #include "content/browser/accessibility/browser_accessibility_manager.h" | 25 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 25 #include "content/browser/compositor/image_transport_factory.h" | 26 #include "content/browser/compositor/image_transport_factory.h" |
| 26 #include "content/browser/compositor/owned_mailbox.h" | 27 #include "content/browser/compositor/owned_mailbox.h" |
| 27 #include "content/browser/renderer_host/begin_frame_observer_proxy.h" | |
| 28 #include "content/browser/renderer_host/delegated_frame_host.h" | 28 #include "content/browser/renderer_host/delegated_frame_host.h" |
| 29 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 29 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 30 #include "content/common/content_export.h" | 30 #include "content/common/content_export.h" |
| 31 #include "content/common/cursors/webcursor.h" | 31 #include "content/common/cursors/webcursor.h" |
| 32 #include "content/public/common/context_menu_params.h" | 32 #include "content/public/common/context_menu_params.h" |
| 33 #include "third_party/skia/include/core/SkRegion.h" | 33 #include "third_party/skia/include/core/SkRegion.h" |
| 34 #include "ui/aura/client/cursor_client_observer.h" | 34 #include "ui/aura/client/cursor_client_observer.h" |
| 35 #include "ui/aura/client/focus_change_observer.h" | 35 #include "ui/aura/client/focus_change_observer.h" |
| 36 #include "ui/aura/window_delegate.h" | 36 #include "ui/aura/window_delegate.h" |
| 37 #include "ui/aura/window_tree_host_observer.h" | 37 #include "ui/aura/window_tree_host_observer.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 class RenderFrameHostImpl; | 85 class RenderFrameHostImpl; |
| 86 class RenderViewHostDelegateView; | 86 class RenderViewHostDelegateView; |
| 87 class RenderWidgetHostImpl; | 87 class RenderWidgetHostImpl; |
| 88 class RenderWidgetHostView; | 88 class RenderWidgetHostView; |
| 89 class TouchSelectionControllerClientAura; | 89 class TouchSelectionControllerClientAura; |
| 90 | 90 |
| 91 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. | 91 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. |
| 92 class CONTENT_EXPORT RenderWidgetHostViewAura | 92 class CONTENT_EXPORT RenderWidgetHostViewAura |
| 93 : public RenderWidgetHostViewBase, | 93 : public RenderWidgetHostViewBase, |
| 94 public DelegatedFrameHostClient, | 94 public DelegatedFrameHostClient, |
| 95 public BeginFrameObserverProxyClient, | |
| 96 public ui::TextInputClient, | 95 public ui::TextInputClient, |
| 97 public gfx::DisplayObserver, | 96 public gfx::DisplayObserver, |
| 98 public aura::WindowTreeHostObserver, | 97 public aura::WindowTreeHostObserver, |
| 99 public aura::WindowDelegate, | 98 public aura::WindowDelegate, |
| 100 public aura::client::ActivationDelegate, | 99 public aura::client::ActivationDelegate, |
| 101 public aura::client::FocusChangeObserver, | 100 public aura::client::FocusChangeObserver, |
| 102 public aura::client::CursorClientObserver { | 101 public aura::client::CursorClientObserver, |
| 102 public cc::BeginFrameObserver { |
| 103 public: | 103 public: |
| 104 // When |is_guest_view_hack| is true, this view isn't really the view for | 104 // When |is_guest_view_hack| is true, this view isn't really the view for |
| 105 // the |widget|, a RenderWidgetHostViewGuest is. | 105 // the |widget|, a RenderWidgetHostViewGuest is. |
| 106 // | 106 // |
| 107 // TODO(lazyboy): Remove |is_guest_view_hack| once BrowserPlugin has migrated | 107 // TODO(lazyboy): Remove |is_guest_view_hack| once BrowserPlugin has migrated |
| 108 // to use RWHVChildFrame (http://crbug.com/330264). | 108 // to use RWHVChildFrame (http://crbug.com/330264). |
| 109 RenderWidgetHostViewAura(RenderWidgetHost* host, bool is_guest_view_hack); | 109 RenderWidgetHostViewAura(RenderWidgetHost* host, bool is_guest_view_hack); |
| 110 | 110 |
| 111 // RenderWidgetHostView implementation. | 111 // RenderWidgetHostView implementation. |
| 112 bool OnMessageReceived(const IPC::Message& msg) override; | 112 bool OnMessageReceived(const IPC::Message& msg) override; |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 void DelegatedFrameHostSendCompositorSwapAck( | 451 void DelegatedFrameHostSendCompositorSwapAck( |
| 452 int output_surface_id, | 452 int output_surface_id, |
| 453 const cc::CompositorFrameAck& ack) override; | 453 const cc::CompositorFrameAck& ack) override; |
| 454 void DelegatedFrameHostSendReclaimCompositorResources( | 454 void DelegatedFrameHostSendReclaimCompositorResources( |
| 455 int output_surface_id, | 455 int output_surface_id, |
| 456 const cc::CompositorFrameAck& ack) override; | 456 const cc::CompositorFrameAck& ack) override; |
| 457 void DelegatedFrameHostOnLostCompositorResources() override; | 457 void DelegatedFrameHostOnLostCompositorResources() override; |
| 458 void DelegatedFrameHostUpdateVSyncParameters( | 458 void DelegatedFrameHostUpdateVSyncParameters( |
| 459 const base::TimeTicks& timebase, | 459 const base::TimeTicks& timebase, |
| 460 const base::TimeDelta& interval) override; | 460 const base::TimeDelta& interval) override; |
| 461 void SetBeginFrameSource(cc::BeginFrameSource* source) override; |
| 461 | 462 |
| 462 // BeginFrameObserverProxyClient implementation. | 463 // cc::BeginFrameObserver implementation. |
| 463 void SendBeginFrame(const cc::BeginFrameArgs& args) override; | 464 void OnBeginFrame(const cc::BeginFrameArgs& args) override; |
| 465 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; |
| 466 void OnBeginFrameSourcePausedChanged(bool paused) override; |
| 467 void AsValueInto(base::trace_event::TracedValue* dict) const override; |
| 464 | 468 |
| 465 // Detaches |this| from the input method object. | 469 // Detaches |this| from the input method object. |
| 466 void DetachFromInputMethod(); | 470 void DetachFromInputMethod(); |
| 467 | 471 |
| 468 // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method | 472 // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method |
| 469 // calls our keybindings handler against the event and send matched | 473 // calls our keybindings handler against the event and send matched |
| 470 // edit commands to renderer instead. | 474 // edit commands to renderer instead. |
| 471 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event); | 475 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event); |
| 472 | 476 |
| 473 // Dismisses a Web Popup on a mouse or touch press outside the popup and its | 477 // Dismisses a Web Popup on a mouse or touch press outside the popup and its |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 // Whether return characters should be passed on to the RenderWidgetHostImpl. | 591 // Whether return characters should be passed on to the RenderWidgetHostImpl. |
| 588 bool accept_return_character_; | 592 bool accept_return_character_; |
| 589 | 593 |
| 590 // Current tooltip text. | 594 // Current tooltip text. |
| 591 base::string16 tooltip_; | 595 base::string16 tooltip_; |
| 592 | 596 |
| 593 // The size and scale of the last software compositing frame that was swapped. | 597 // The size and scale of the last software compositing frame that was swapped. |
| 594 gfx::Size last_swapped_software_frame_size_; | 598 gfx::Size last_swapped_software_frame_size_; |
| 595 float last_swapped_software_frame_scale_factor_; | 599 float last_swapped_software_frame_scale_factor_; |
| 596 | 600 |
| 601 // The begin frame source being observed. Null if none. |
| 602 cc::BeginFrameSource* begin_frame_source_; |
| 603 cc::BeginFrameArgs last_begin_frame_args_; |
| 604 bool observing_begin_frame_source_; |
| 605 |
| 597 // If non-NULL we're in OnPaint() and this is the supplied canvas. | 606 // If non-NULL we're in OnPaint() and this is the supplied canvas. |
| 598 gfx::Canvas* paint_canvas_; | 607 gfx::Canvas* paint_canvas_; |
| 599 | 608 |
| 600 // Used to record the last position of the mouse. | 609 // Used to record the last position of the mouse. |
| 601 // While the mouse is locked, they store the last known position just as mouse | 610 // While the mouse is locked, they store the last known position just as mouse |
| 602 // lock was entered. | 611 // lock was entered. |
| 603 // Relative to the upper-left corner of the view. | 612 // Relative to the upper-left corner of the view. |
| 604 gfx::Point unlocked_mouse_position_; | 613 gfx::Point unlocked_mouse_position_; |
| 605 // Relative to the upper-left corner of the screen. | 614 // Relative to the upper-left corner of the screen. |
| 606 gfx::Point unlocked_global_mouse_position_; | 615 gfx::Point unlocked_global_mouse_position_; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 // RenderWidgetHostViewGuest. | 676 // RenderWidgetHostViewGuest. |
| 668 bool is_guest_view_hack_; | 677 bool is_guest_view_hack_; |
| 669 | 678 |
| 670 gfx::Rect disambiguation_target_rect_; | 679 gfx::Rect disambiguation_target_rect_; |
| 671 | 680 |
| 672 // The last scroll offset when we start to render the link disambiguation | 681 // The last scroll offset when we start to render the link disambiguation |
| 673 // view, so we can ensure the window hasn't moved between copying from the | 682 // view, so we can ensure the window hasn't moved between copying from the |
| 674 // compositing surface and showing the disambiguation popup. | 683 // compositing surface and showing the disambiguation popup. |
| 675 gfx::Vector2dF disambiguation_scroll_offset_; | 684 gfx::Vector2dF disambiguation_scroll_offset_; |
| 676 | 685 |
| 677 BeginFrameObserverProxy begin_frame_observer_proxy_; | |
| 678 | |
| 679 // This flag when set ensures that we send over a notification to blink that | 686 // This flag when set ensures that we send over a notification to blink that |
| 680 // the current view has focus. Defaults to false. | 687 // the current view has focus. Defaults to false. |
| 681 bool set_focus_on_mouse_down_or_key_event_; | 688 bool set_focus_on_mouse_down_or_key_event_; |
| 682 | 689 |
| 683 float device_scale_factor_; | 690 float device_scale_factor_; |
| 684 | 691 |
| 685 // Allows tests to send gesture events for testing without first sending a | 692 // Allows tests to send gesture events for testing without first sending a |
| 686 // corresponding touch sequence, as would be required by | 693 // corresponding touch sequence, as would be required by |
| 687 // RenderWidgetHostInputEventRouter. | 694 // RenderWidgetHostInputEventRouter. |
| 688 bool disable_input_event_router_for_testing_; | 695 bool disable_input_event_router_for_testing_; |
| 689 | 696 |
| 690 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; | 697 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; |
| 691 | 698 |
| 692 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); | 699 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); |
| 693 }; | 700 }; |
| 694 | 701 |
| 695 } // namespace content | 702 } // namespace content |
| 696 | 703 |
| 697 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 704 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
| OLD | NEW |