| 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 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "content/common/site_isolation_policy.h" | 51 #include "content/common/site_isolation_policy.h" |
| 52 #include "content/common/text_input_state.h" | 52 #include "content/common/text_input_state.h" |
| 53 #include "content/common/view_messages.h" | 53 #include "content/common/view_messages.h" |
| 54 #include "content/public/browser/content_browser_client.h" | 54 #include "content/public/browser/content_browser_client.h" |
| 55 #include "content/public/browser/overscroll_configuration.h" | 55 #include "content/public/browser/overscroll_configuration.h" |
| 56 #include "content/public/browser/render_view_host.h" | 56 #include "content/public/browser/render_view_host.h" |
| 57 #include "content/public/browser/user_metrics.h" | 57 #include "content/public/browser/user_metrics.h" |
| 58 #include "content/public/common/child_process_host.h" | 58 #include "content/public/common/child_process_host.h" |
| 59 #include "content/public/common/content_switches.h" | 59 #include "content/public/common/content_switches.h" |
| 60 #include "gpu/ipc/common/gpu_messages.h" | 60 #include "gpu/ipc/common/gpu_messages.h" |
| 61 #include "media/base/video_frame.h" |
| 61 #include "services/service_manager/public/cpp/interface_provider.h" | 62 #include "services/service_manager/public/cpp/interface_provider.h" |
| 62 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 63 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 63 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 64 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| 64 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 65 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
| 65 #include "ui/aura/client/aura_constants.h" | 66 #include "ui/aura/client/aura_constants.h" |
| 66 #include "ui/aura/client/cursor_client.h" | 67 #include "ui/aura/client/cursor_client.h" |
| 67 #include "ui/aura/client/cursor_client_observer.h" | 68 #include "ui/aura/client/cursor_client_observer.h" |
| 68 #include "ui/aura/client/focus_client.h" | 69 #include "ui/aura/client/focus_client.h" |
| 69 #include "ui/aura/client/screen_position_client.h" | 70 #include "ui/aura/client/screen_position_client.h" |
| 70 #include "ui/aura/client/transient_window_client.h" | 71 #include "ui/aura/client/transient_window_client.h" |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 aura::client::FocusClient* client = aura::client::GetFocusClient(window_); | 731 aura::client::FocusClient* client = aura::client::GetFocusClient(window_); |
| 731 if (client) | 732 if (client) |
| 732 window_->Focus(); | 733 window_->Focus(); |
| 733 } | 734 } |
| 734 | 735 |
| 735 bool RenderWidgetHostViewAura::HasFocus() const { | 736 bool RenderWidgetHostViewAura::HasFocus() const { |
| 736 return window_->HasFocus(); | 737 return window_->HasFocus(); |
| 737 } | 738 } |
| 738 | 739 |
| 739 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { | 740 bool RenderWidgetHostViewAura::IsSurfaceAvailableForCopy() const { |
| 740 return delegated_frame_host_ ? delegated_frame_host_->CanCopyToBitmap() | 741 if (!delegated_frame_host_) |
| 741 : false; | 742 return false; |
| 743 return delegated_frame_host_->CanCopyFromCompositingSurface(); |
| 742 } | 744 } |
| 743 | 745 |
| 744 bool RenderWidgetHostViewAura::IsShowing() { | 746 bool RenderWidgetHostViewAura::IsShowing() { |
| 745 return window_->IsVisible(); | 747 return window_->IsVisible(); |
| 746 } | 748 } |
| 747 | 749 |
| 748 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { | 750 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { |
| 749 return window_->GetBoundsInScreen(); | 751 return window_->GetBoundsInScreen(); |
| 750 } | 752 } |
| 751 | 753 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 tooltip_client->SetTooltipShownTimeout(window_, 0); | 845 tooltip_client->SetTooltipShownTimeout(window_, 0); |
| 844 } | 846 } |
| 845 } | 847 } |
| 846 | 848 |
| 847 gfx::Size RenderWidgetHostViewAura::GetRequestedRendererSize() const { | 849 gfx::Size RenderWidgetHostViewAura::GetRequestedRendererSize() const { |
| 848 return delegated_frame_host_ | 850 return delegated_frame_host_ |
| 849 ? delegated_frame_host_->GetRequestedRendererSize() | 851 ? delegated_frame_host_->GetRequestedRendererSize() |
| 850 : RenderWidgetHostViewBase::GetRequestedRendererSize(); | 852 : RenderWidgetHostViewBase::GetRequestedRendererSize(); |
| 851 } | 853 } |
| 852 | 854 |
| 853 void RenderWidgetHostViewAura::CopyFromCompositingSurface( | 855 void RenderWidgetHostViewAura::CopyFromSurface( |
| 854 const gfx::Rect& src_subrect, | 856 const gfx::Rect& src_subrect, |
| 855 const gfx::Size& dst_size, | 857 const gfx::Size& dst_size, |
| 856 const ReadbackRequestCallback& callback, | 858 const ReadbackRequestCallback& callback, |
| 857 const SkColorType preferred_color_type) { | 859 const SkColorType preferred_color_type) { |
| 858 if (!delegated_frame_host_) | 860 if (!IsSurfaceAvailableForCopy()) { |
| 861 callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE); |
| 859 return; | 862 return; |
| 863 } |
| 860 delegated_frame_host_->CopyFromCompositingSurface( | 864 delegated_frame_host_->CopyFromCompositingSurface( |
| 861 src_subrect, dst_size, callback, preferred_color_type); | 865 src_subrect, dst_size, callback, preferred_color_type); |
| 862 } | 866 } |
| 863 | 867 |
| 864 void RenderWidgetHostViewAura::CopyFromCompositingSurfaceToVideoFrame( | 868 void RenderWidgetHostViewAura::CopyFromSurfaceToVideoFrame( |
| 865 const gfx::Rect& src_subrect, | 869 const gfx::Rect& src_subrect, |
| 866 const scoped_refptr<media::VideoFrame>& target, | 870 scoped_refptr<media::VideoFrame> target, |
| 867 const base::Callback<void(const gfx::Rect&, bool)>& callback) { | 871 const base::Callback<void(const gfx::Rect&, bool)>& callback) { |
| 868 if (!delegated_frame_host_) | 872 if (!IsSurfaceAvailableForCopy()) { |
| 873 callback.Run(gfx::Rect(), false); |
| 869 return; | 874 return; |
| 875 } |
| 870 delegated_frame_host_->CopyFromCompositingSurfaceToVideoFrame( | 876 delegated_frame_host_->CopyFromCompositingSurfaceToVideoFrame( |
| 871 src_subrect, target, callback); | 877 src_subrect, std::move(target), callback); |
| 872 } | |
| 873 | |
| 874 bool RenderWidgetHostViewAura::CanCopyToVideoFrame() const { | |
| 875 return delegated_frame_host_ ? delegated_frame_host_->CanCopyToVideoFrame() | |
| 876 : false; | |
| 877 } | 878 } |
| 878 | 879 |
| 879 void RenderWidgetHostViewAura::BeginFrameSubscription( | 880 void RenderWidgetHostViewAura::BeginFrameSubscription( |
| 880 std::unique_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) { | 881 std::unique_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) { |
| 881 if (delegated_frame_host_) | 882 if (delegated_frame_host_) |
| 882 delegated_frame_host_->BeginFrameSubscription(std::move(subscriber)); | 883 delegated_frame_host_->BeginFrameSubscription(std::move(subscriber)); |
| 883 } | 884 } |
| 884 | 885 |
| 885 void RenderWidgetHostViewAura::EndFrameSubscription() { | 886 void RenderWidgetHostViewAura::EndFrameSubscription() { |
| 886 if (delegated_frame_host_) | 887 if (delegated_frame_host_) |
| (...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2370 | 2371 |
| 2371 void RenderWidgetHostViewAura::SetPopupChild( | 2372 void RenderWidgetHostViewAura::SetPopupChild( |
| 2372 RenderWidgetHostViewAura* popup_child_host_view) { | 2373 RenderWidgetHostViewAura* popup_child_host_view) { |
| 2373 popup_child_host_view_ = popup_child_host_view; | 2374 popup_child_host_view_ = popup_child_host_view; |
| 2374 event_handler_->SetPopupChild( | 2375 event_handler_->SetPopupChild( |
| 2375 popup_child_host_view, | 2376 popup_child_host_view, |
| 2376 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); | 2377 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); |
| 2377 } | 2378 } |
| 2378 | 2379 |
| 2379 } // namespace content | 2380 } // namespace content |
| OLD | NEW |