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_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 RenderWidgetHostImpl* widget_host, | 438 RenderWidgetHostImpl* widget_host, |
439 ContentViewCoreImpl* content_view_core) | 439 ContentViewCoreImpl* content_view_core) |
440 : host_(widget_host), | 440 : host_(widget_host), |
441 outstanding_vsync_requests_(0), | 441 outstanding_vsync_requests_(0), |
442 is_showing_(!widget_host->is_hidden()), | 442 is_showing_(!widget_host->is_hidden()), |
443 is_window_visible_(true), | 443 is_window_visible_(true), |
444 is_window_activity_started_(true), | 444 is_window_activity_started_(true), |
445 content_view_core_(nullptr), | 445 content_view_core_(nullptr), |
446 ime_adapter_android_(this), | 446 ime_adapter_android_(this), |
447 cached_background_color_(SK_ColorWHITE), | 447 cached_background_color_(SK_ColorWHITE), |
| 448 view_(this), |
448 last_compositor_frame_sink_id_(kUndefinedCompositorFrameSinkId), | 449 last_compositor_frame_sink_id_(kUndefinedCompositorFrameSinkId), |
449 gesture_provider_(ui::GetGestureProviderConfig( | 450 gesture_provider_(ui::GetGestureProviderConfig( |
450 ui::GestureProviderConfigType::CURRENT_PLATFORM), | 451 ui::GestureProviderConfigType::CURRENT_PLATFORM), |
451 this), | 452 this), |
452 stylus_text_selector_(this), | 453 stylus_text_selector_(this), |
453 using_browser_compositor_(CompositorImpl::IsInitialized()), | 454 using_browser_compositor_(CompositorImpl::IsInitialized()), |
454 synchronous_compositor_client_(nullptr), | 455 synchronous_compositor_client_(nullptr), |
455 frame_evictor_(new DelegatedFrameEvictor(this)), | 456 frame_evictor_(new DelegatedFrameEvictor(this)), |
456 locks_on_frame_count_(0), | 457 locks_on_frame_count_(0), |
457 observing_root_window_(false), | 458 observing_root_window_(false), |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 gfx::Size RenderWidgetHostViewAndroid::GetPhysicalBackingSize() const { | 715 gfx::Size RenderWidgetHostViewAndroid::GetPhysicalBackingSize() const { |
715 if (!content_view_core_) { | 716 if (!content_view_core_) { |
716 if (default_bounds_.IsEmpty()) return gfx::Size(); | 717 if (default_bounds_.IsEmpty()) return gfx::Size(); |
717 | 718 |
718 return gfx::Size(default_bounds_.right() | 719 return gfx::Size(default_bounds_.right() |
719 * ui::GetScaleFactorForNativeView(GetNativeView()), | 720 * ui::GetScaleFactorForNativeView(GetNativeView()), |
720 default_bounds_.bottom() | 721 default_bounds_.bottom() |
721 * ui::GetScaleFactorForNativeView(GetNativeView())); | 722 * ui::GetScaleFactorForNativeView(GetNativeView())); |
722 } | 723 } |
723 | 724 |
724 return content_view_core_->GetPhysicalBackingSize(); | 725 return view_.GetPhysicalBackingSize(); |
725 } | 726 } |
726 | 727 |
727 bool RenderWidgetHostViewAndroid::DoBrowserControlsShrinkBlinkSize() const { | 728 bool RenderWidgetHostViewAndroid::DoBrowserControlsShrinkBlinkSize() const { |
728 // Whether or not Blink's viewport size should be shrunk by the height of the | 729 // Whether or not Blink's viewport size should be shrunk by the height of the |
729 // URL-bar. | 730 // URL-bar. |
730 return content_view_core_ && | 731 return content_view_core_ && |
731 content_view_core_->DoBrowserControlsShrinkBlinkSize(); | 732 content_view_core_->DoBrowserControlsShrinkBlinkSize(); |
732 } | 733 } |
733 | 734 |
734 float RenderWidgetHostViewAndroid::GetTopControlsHeight() const { | 735 float RenderWidgetHostViewAndroid::GetTopControlsHeight() const { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 | 805 |
805 void RenderWidgetHostViewAndroid::SetNeedsBeginFrames(bool needs_begin_frames) { | 806 void RenderWidgetHostViewAndroid::SetNeedsBeginFrames(bool needs_begin_frames) { |
806 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SetNeedsBeginFrames", | 807 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SetNeedsBeginFrames", |
807 "needs_begin_frames", needs_begin_frames); | 808 "needs_begin_frames", needs_begin_frames); |
808 if (needs_begin_frames) | 809 if (needs_begin_frames) |
809 RequestVSyncUpdate(PERSISTENT_BEGIN_FRAME); | 810 RequestVSyncUpdate(PERSISTENT_BEGIN_FRAME); |
810 else | 811 else |
811 outstanding_vsync_requests_ &= ~PERSISTENT_BEGIN_FRAME; | 812 outstanding_vsync_requests_ &= ~PERSISTENT_BEGIN_FRAME; |
812 } | 813 } |
813 | 814 |
| 815 void RenderWidgetHostViewAndroid::OnPhysicalBackingSizeChanged(int width, |
| 816 int height) { |
| 817 WasResized(); |
| 818 } |
| 819 |
814 void RenderWidgetHostViewAndroid::OnStartContentIntent( | 820 void RenderWidgetHostViewAndroid::OnStartContentIntent( |
815 const GURL& content_url, bool is_main_frame) { | 821 const GURL& content_url, bool is_main_frame) { |
816 if (content_view_core_) | 822 if (content_view_core_) |
817 content_view_core_->StartContentIntent(content_url, is_main_frame); | 823 content_view_core_->StartContentIntent(content_url, is_main_frame); |
818 } | 824 } |
819 | 825 |
820 void RenderWidgetHostViewAndroid::OnSmartClipDataExtracted( | 826 void RenderWidgetHostViewAndroid::OnSmartClipDataExtracted( |
821 const base::string16& text, | 827 const base::string16& text, |
822 const base::string16& html, | 828 const base::string16& html, |
823 const gfx::Rect rect) { | 829 const gfx::Rect rect) { |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1994 case ui::MotionEvent::ACTION_UP: | 2000 case ui::MotionEvent::ACTION_UP: |
1995 case ui::MotionEvent::ACTION_POINTER_UP: | 2001 case ui::MotionEvent::ACTION_POINTER_UP: |
1996 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 2002 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
1997 delta.InMicroseconds(), 1, 1000000, 50); | 2003 delta.InMicroseconds(), 1, 1000000, 50); |
1998 default: | 2004 default: |
1999 return; | 2005 return; |
2000 } | 2006 } |
2001 } | 2007 } |
2002 | 2008 |
2003 } // namespace content | 2009 } // namespace content |
OLD | NEW |