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 overscroll_refresh_handler_(nullptr), | |
|
Jinsuk Kim
2016/11/25 01:49:18
The signature in the header hasn't changed. Maybe
rlanday
2016/11/28 21:17:51
Sorry, I'm a little confused here; I did add a set
Jinsuk Kim
2016/11/28 23:06:40
Acknowledged.
| |
| 85 delegate_(delegate), | 86 delegate_(delegate), |
| 86 synchronous_compositor_client_(nullptr) { | 87 synchronous_compositor_client_(nullptr) {} |
| 87 } | |
| 88 | 88 |
| 89 WebContentsViewAndroid::~WebContentsViewAndroid() { | 89 WebContentsViewAndroid::~WebContentsViewAndroid() { |
| 90 if (view_.GetLayer()) | 90 if (view_.GetLayer()) |
| 91 view_.GetLayer()->RemoveFromParent(); | 91 view_.GetLayer()->RemoveFromParent(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void WebContentsViewAndroid::SetContentViewCore( | 94 void WebContentsViewAndroid::SetContentViewCore( |
| 95 ContentViewCoreImpl* content_view_core) { | 95 ContentViewCoreImpl* content_view_core) { |
| 96 content_view_core_ = content_view_core; | 96 content_view_core_ = content_view_core; |
| 97 RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>( | 97 RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>( |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 DCHECK(RenderViewHostFactory::has_factory()); | 210 DCHECK(RenderViewHostFactory::has_factory()); |
| 211 return static_cast<RenderWidgetHostViewBase*>( | 211 return static_cast<RenderWidgetHostViewBase*>( |
| 212 render_widget_host->GetView()); | 212 render_widget_host->GetView()); |
| 213 } | 213 } |
| 214 // Note that while this instructs the render widget host to reference | 214 // Note that while this instructs the render widget host to reference |
| 215 // |native_view_|, this has no effect without also instructing the | 215 // |native_view_|, this has no effect without also instructing the |
| 216 // native view (i.e. ContentView) how to obtain a reference to this widget in | 216 // native view (i.e. ContentView) how to obtain a reference to this widget in |
| 217 // order to paint it. See ContentView::GetRenderWidgetHostViewAndroid for an | 217 // order to paint it. See ContentView::GetRenderWidgetHostViewAndroid for an |
| 218 // example of how this is achieved for InterstitialPages. | 218 // example of how this is achieved for InterstitialPages. |
| 219 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host); | 219 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host); |
| 220 RenderWidgetHostViewAndroid* rwhv = | 220 RenderWidgetHostViewAndroid* rwhv = new RenderWidgetHostViewAndroid( |
| 221 new RenderWidgetHostViewAndroid(rwhi, content_view_core_); | 221 rwhi, content_view_core_, overscroll_refresh_handler_); |
| 222 rwhv->SetSynchronousCompositorClient(synchronous_compositor_client_); | 222 rwhv->SetSynchronousCompositorClient(synchronous_compositor_client_); |
| 223 return rwhv; | 223 return rwhv; |
| 224 } | 224 } |
| 225 | 225 |
| 226 RenderWidgetHostViewBase* WebContentsViewAndroid::CreateViewForPopupWidget( | 226 RenderWidgetHostViewBase* WebContentsViewAndroid::CreateViewForPopupWidget( |
| 227 RenderWidgetHost* render_widget_host) { | 227 RenderWidgetHost* render_widget_host) { |
| 228 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host); | 228 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(render_widget_host); |
| 229 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 229 return new RenderWidgetHostViewAndroid(rwhi, nullptr, nullptr); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void WebContentsViewAndroid::RenderViewCreated(RenderViewHost* host) { | 232 void WebContentsViewAndroid::RenderViewCreated(RenderViewHost* host) { |
| 233 } | 233 } |
| 234 | 234 |
| 235 void WebContentsViewAndroid::RenderViewSwappedIn(RenderViewHost* host) { | 235 void WebContentsViewAndroid::RenderViewSwappedIn(RenderViewHost* host) { |
| 236 } | 236 } |
| 237 | 237 |
| 238 void WebContentsViewAndroid::SetOverscrollControllerEnabled(bool enabled) { | 238 void WebContentsViewAndroid::SetOverscrollControllerEnabled(bool enabled) { |
| 239 } | 239 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 // This is called when we the renderer asks us to take focus back (i.e., it has | 365 // This is called when we the renderer asks us to take focus back (i.e., it has |
| 366 // iterated past the last focusable element on the page). | 366 // iterated past the last focusable element on the page). |
| 367 void WebContentsViewAndroid::TakeFocus(bool reverse) { | 367 void WebContentsViewAndroid::TakeFocus(bool reverse) { |
| 368 if (web_contents_->GetDelegate() && | 368 if (web_contents_->GetDelegate() && |
| 369 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) | 369 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) |
| 370 return; | 370 return; |
| 371 web_contents_->GetRenderWidgetHostView()->Focus(); | 371 web_contents_->GetRenderWidgetHostView()->Focus(); |
| 372 } | 372 } |
| 373 | 373 |
| 374 } // namespace content | 374 } // namespace content |
| OLD | NEW |