Chromium Code Reviews| 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/web_contents/web_contents_view_android.h" | 5 #include "content/browser/web_contents/web_contents_view_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 WebContentsViewAndroid* rv = new WebContentsViewAndroid( | 74 WebContentsViewAndroid* rv = new WebContentsViewAndroid( |
| 75 web_contents, delegate); | 75 web_contents, delegate); |
| 76 *render_view_host_delegate_view = rv; | 76 *render_view_host_delegate_view = rv; |
| 77 return rv; | 77 return rv; |
| 78 } | 78 } |
| 79 | 79 |
| 80 WebContentsViewAndroid::WebContentsViewAndroid( | 80 WebContentsViewAndroid::WebContentsViewAndroid( |
| 81 WebContentsImpl* web_contents, | 81 WebContentsImpl* web_contents, |
| 82 WebContentsViewDelegate* delegate) | 82 WebContentsViewDelegate* delegate) |
| 83 : web_contents_(web_contents), | 83 : web_contents_(web_contents), |
| 84 content_view_core_(NULL), | 84 content_view_core_(nullptr), |
| 85 delegate_(delegate), | 85 delegate_(delegate), |
| 86 synchronous_compositor_client_(nullptr) { | 86 synchronous_compositor_client_(nullptr) {} |
| 87 } | |
| 88 | 87 |
| 89 WebContentsViewAndroid::~WebContentsViewAndroid() { | 88 WebContentsViewAndroid::~WebContentsViewAndroid() { |
| 90 if (view_.GetLayer()) | 89 if (view_.GetLayer()) |
| 91 view_.GetLayer()->RemoveFromParent(); | 90 view_.GetLayer()->RemoveFromParent(); |
| 92 } | 91 } |
| 93 | 92 |
| 94 void WebContentsViewAndroid::SetContentViewCore( | 93 void WebContentsViewAndroid::SetContentViewCore( |
| 95 ContentViewCoreImpl* content_view_core) { | 94 ContentViewCoreImpl* content_view_core) { |
| 96 content_view_core_ = content_view_core; | 95 content_view_core_ = content_view_core; |
| 97 RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>( | 96 RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>( |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 DCHECK(RenderViewHostFactory::has_factory()); | 208 DCHECK(RenderViewHostFactory::has_factory()); |
| 210 return static_cast<RenderWidgetHostViewBase*>( | 209 return static_cast<RenderWidgetHostViewBase*>( |
| 211 render_widget_host->GetView()); | 210 render_widget_host->GetView()); |
| 212 } | 211 } |
| 213 // Note that while this instructs the render widget host to reference | 212 // Note that while this instructs the render widget host to reference |
| 214 // |native_view_|, this has no effect without also instructing the | 213 // |native_view_|, this has no effect without also instructing the |
| 215 // native view (i.e. ContentView) how to obtain a reference to this widget in | 214 // native view (i.e. ContentView) how to obtain a reference to this widget in |
| 216 // order to paint it. See ContentView::GetRenderWidgetHostViewAndroid for an | 215 // order to paint it. See ContentView::GetRenderWidgetHostViewAndroid for an |
| 217 // example of how this is achieved for InterstitialPages. | 216 // example of how this is achieved for InterstitialPages. |
| 218 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host); | 217 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host); |
| 219 RenderWidgetHostViewAndroid* rwhv = | 218 RenderWidgetHostViewAndroid* rwhv = new RenderWidgetHostViewAndroid( |
| 220 new RenderWidgetHostViewAndroid(rwhi, content_view_core_); | 219 rwhi, content_view_core_, overscroll_refresh_handler_); |
| 221 rwhv->SetSynchronousCompositorClient(synchronous_compositor_client_); | 220 rwhv->SetSynchronousCompositorClient(synchronous_compositor_client_); |
| 222 return rwhv; | 221 return rwhv; |
| 223 } | 222 } |
| 224 | 223 |
| 225 RenderWidgetHostViewBase* WebContentsViewAndroid::CreateViewForPopupWidget( | 224 RenderWidgetHostViewBase* WebContentsViewAndroid::CreateViewForPopupWidget( |
| 226 RenderWidgetHost* render_widget_host) { | 225 RenderWidgetHost* render_widget_host) { |
| 227 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host); | 226 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host); |
| 228 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 227 return new RenderWidgetHostViewAndroid(rwhi, nullptr, nullptr); |
|
boliu
2016/12/01 00:01:57
this breaks pull to refresh for popups
rlanday
2016/12/01 00:44:51
Hmm, my understanding here was that since we were
boliu
2016/12/01 00:50:38
For popups, CVC is set later, in WebContentsViewAn
| |
| 229 } | 228 } |
| 230 | 229 |
| 231 void WebContentsViewAndroid::RenderViewCreated(RenderViewHost* host) { | 230 void WebContentsViewAndroid::RenderViewCreated(RenderViewHost* host) { |
| 232 } | 231 } |
| 233 | 232 |
| 234 void WebContentsViewAndroid::RenderViewSwappedIn(RenderViewHost* host) { | 233 void WebContentsViewAndroid::RenderViewSwappedIn(RenderViewHost* host) { |
| 235 } | 234 } |
| 236 | 235 |
| 237 void WebContentsViewAndroid::SetOverscrollControllerEnabled(bool enabled) { | 236 void WebContentsViewAndroid::SetOverscrollControllerEnabled(bool enabled) { |
| 238 } | 237 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 // This is called when we the renderer asks us to take focus back (i.e., it has | 363 // This is called when we the renderer asks us to take focus back (i.e., it has |
| 365 // iterated past the last focusable element on the page). | 364 // iterated past the last focusable element on the page). |
| 366 void WebContentsViewAndroid::TakeFocus(bool reverse) { | 365 void WebContentsViewAndroid::TakeFocus(bool reverse) { |
| 367 if (web_contents_->GetDelegate() && | 366 if (web_contents_->GetDelegate() && |
| 368 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) | 367 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) |
| 369 return; | 368 return; |
| 370 web_contents_->GetRenderWidgetHostView()->Focus(); | 369 web_contents_->GetRenderWidgetHostView()->Focus(); |
| 371 } | 370 } |
| 372 | 371 |
| 373 } // namespace content | 372 } // namespace content |
| OLD | NEW |