 Chromium Code Reviews
 Chromium Code Reviews Issue 2484793002:
  Remove access to WebContents in RWHVA::SynchronousFrameMetadata()  (Closed)
    
  
    Issue 2484793002:
  Remove access to WebContents in RWHVA::SynchronousFrameMetadata()  (Closed) 
  | 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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 593 gfx::NativeViewAccessible | 593 gfx::NativeViewAccessible | 
| 594 RenderWidgetHostViewAndroid::GetNativeViewAccessible() { | 594 RenderWidgetHostViewAndroid::GetNativeViewAccessible() { | 
| 595 NOTIMPLEMENTED(); | 595 NOTIMPLEMENTED(); | 
| 596 return NULL; | 596 return NULL; | 
| 597 } | 597 } | 
| 598 | 598 | 
| 599 void RenderWidgetHostViewAndroid::Focus() { | 599 void RenderWidgetHostViewAndroid::Focus() { | 
| 600 host_->Focus(); | 600 host_->Focus(); | 
| 601 if (overscroll_controller_) | 601 if (overscroll_controller_) | 
| 602 overscroll_controller_->Enable(); | 602 overscroll_controller_->Enable(); | 
| 603 if (content_view_core_) { | |
| 604 WebContentsImpl* web_contents_impl = | |
| 605 static_cast<WebContentsImpl*>(content_view_core_->GetWebContents()); | |
| 606 if (web_contents_impl->ShowingInterstitialPage()) | |
| 607 content_view_core_->ForceUpdateImeAdapter(GetNativeImeAdapter()); | |
| 608 } | |
| 609 } | 603 } | 
| 610 | 604 | 
| 611 bool RenderWidgetHostViewAndroid::HasFocus() const { | 605 bool RenderWidgetHostViewAndroid::HasFocus() const { | 
| 612 if (!content_view_core_) | 606 if (!content_view_core_) | 
| 613 return false; // ContentViewCore not created yet. | 607 return false; // ContentViewCore not created yet. | 
| 614 | 608 | 
| 615 return content_view_core_->HasFocus(); | 609 return content_view_core_->HasFocus(); | 
| 616 } | 610 } | 
| 617 | 611 | 
| 618 bool RenderWidgetHostViewAndroid::IsSurfaceAvailableForCopy() const { | 612 bool RenderWidgetHostViewAndroid::IsSurfaceAvailableForCopy() const { | 
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1184 if (host_ && host_->input_router()) { | 1178 if (host_ && host_->input_router()) { | 
| 1185 host_->input_router()->NotifySiteIsMobileOptimized( | 1179 host_->input_router()->NotifySiteIsMobileOptimized( | 
| 1186 is_mobile_optimized); | 1180 is_mobile_optimized); | 
| 1187 } | 1181 } | 
| 1188 | 1182 | 
| 1189 // This is a subset of OnSwapCompositorFrame() used in the synchronous | 1183 // This is a subset of OnSwapCompositorFrame() used in the synchronous | 
| 1190 // compositor flow. | 1184 // compositor flow. | 
| 1191 OnFrameMetadataUpdated(frame_metadata.Clone(), false); | 1185 OnFrameMetadataUpdated(frame_metadata.Clone(), false); | 
| 1192 | 1186 | 
| 1193 // DevTools ScreenCast support for Android WebView. | 1187 // DevTools ScreenCast support for Android WebView. | 
| 1194 WebContents* web_contents = content_view_core_->GetWebContents(); | 1188 RenderFrameHost* frame_host = RenderViewHost::From(host_)->GetMainFrame(); | 
| 1195 if (DevToolsAgentHost::HasFor(web_contents)) { | 1189 if (!frame_host) | 
| 
boliu
2016/11/08 00:13:55
can merge this with the HasFor check
 
Jinsuk Kim
2016/11/08 17:58:19
Done.
 | |
| 1190 return; | |
| 1191 if (DevToolsAgentHost::HasFor(frame_host)) { | |
| 1196 scoped_refptr<DevToolsAgentHost> dtah = | 1192 scoped_refptr<DevToolsAgentHost> dtah = | 
| 1197 DevToolsAgentHost::GetOrCreateFor(web_contents); | 1193 DevToolsAgentHost::GetOrCreateFor(frame_host); | 
| 1198 // Unblock the compositor. | 1194 // Unblock the compositor. | 
| 1199 BrowserThread::PostTask( | 1195 BrowserThread::PostTask( | 
| 1200 BrowserThread::UI, FROM_HERE, | 1196 BrowserThread::UI, FROM_HERE, | 
| 1201 base::Bind( | 1197 base::Bind( | 
| 1202 &RenderFrameDevToolsAgentHost::SynchronousSwapCompositorFrame, | 1198 &RenderFrameDevToolsAgentHost::SynchronousSwapCompositorFrame, | 
| 1203 static_cast<RenderFrameDevToolsAgentHost*>(dtah.get()), | 1199 static_cast<RenderFrameDevToolsAgentHost*>(dtah.get()), | 
| 1204 base::Passed(&frame_metadata))); | 1200 base::Passed(&frame_metadata))); | 
| 1205 } | 1201 } | 
| 1206 } | 1202 } | 
| 1207 | 1203 | 
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1783 if (!selection_controller_) | 1779 if (!selection_controller_) | 
| 1784 selection_controller_ = CreateSelectionController(this, content_view_core_); | 1780 selection_controller_ = CreateSelectionController(this, content_view_core_); | 
| 1785 | 1781 | 
| 1786 if (!overscroll_controller_ && | 1782 if (!overscroll_controller_ && | 
| 1787 view_.GetWindowAndroid()->GetCompositor()) { | 1783 view_.GetWindowAndroid()->GetCompositor()) { | 
| 1788 overscroll_controller_ = CreateOverscrollController( | 1784 overscroll_controller_ = CreateOverscrollController( | 
| 1789 content_view_core_, ui::GetScaleFactorForNativeView(GetNativeView())); | 1785 content_view_core_, ui::GetScaleFactorForNativeView(GetNativeView())); | 
| 1790 } | 1786 } | 
| 1791 | 1787 | 
| 1792 if (!sync_compositor_) { | 1788 if (!sync_compositor_) { | 
| 1793 sync_compositor_ = SynchronousCompositorHost::Create( | 1789 sync_compositor_ = SynchronousCompositorHost::Create(this); | 
| 1794 this, content_view_core_->GetWebContents()); | |
| 1795 } | 1790 } | 
| 1796 } | 1791 } | 
| 1797 | 1792 | 
| 1798 void RenderWidgetHostViewAndroid::RunAckCallbacks() { | 1793 void RenderWidgetHostViewAndroid::RunAckCallbacks() { | 
| 1799 while (!ack_callbacks_.empty()) { | 1794 while (!ack_callbacks_.empty()) { | 
| 1800 ack_callbacks_.front().Run(); | 1795 ack_callbacks_.front().Run(); | 
| 1801 ack_callbacks_.pop(); | 1796 ack_callbacks_.pop(); | 
| 1802 } | 1797 } | 
| 1803 } | 1798 } | 
| 1804 | 1799 | 
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1966 case ui::MotionEvent::ACTION_UP: | 1961 case ui::MotionEvent::ACTION_UP: | 
| 1967 case ui::MotionEvent::ACTION_POINTER_UP: | 1962 case ui::MotionEvent::ACTION_POINTER_UP: | 
| 1968 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 1963 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 
| 1969 delta.InMicroseconds(), 1, 1000000, 50); | 1964 delta.InMicroseconds(), 1, 1000000, 50); | 
| 1970 default: | 1965 default: | 
| 1971 return; | 1966 return; | 
| 1972 } | 1967 } | 
| 1973 } | 1968 } | 
| 1974 | 1969 | 
| 1975 } // namespace content | 1970 } // namespace content | 
| OLD | NEW |