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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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_(NULL), |
85 delegate_(delegate), | 85 delegate_(delegate), |
86 synchronous_compositor_client_(nullptr) { | 86 view_(this), |
87 } | 87 synchronous_compositor_client_(nullptr) {} |
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 | 230 |
231 void WebContentsViewAndroid::RenderViewCreated(RenderViewHost* host) { | 231 void WebContentsViewAndroid::RenderViewCreated(RenderViewHost* host) { |
232 } | 232 } |
233 | 233 |
234 void WebContentsViewAndroid::RenderViewSwappedIn(RenderViewHost* host) { | 234 void WebContentsViewAndroid::RenderViewSwappedIn(RenderViewHost* host) { |
235 } | 235 } |
236 | 236 |
237 void WebContentsViewAndroid::SetOverscrollControllerEnabled(bool enabled) { | 237 void WebContentsViewAndroid::SetOverscrollControllerEnabled(bool enabled) { |
238 } | 238 } |
239 | 239 |
240 bool WebContentsViewAndroid::OnPhysicalBackingSizeChanged(int width, | |
241 int height) { | |
242 // |SendScreenRects()| indirectly calls GetViewSize() that asks Java layer. | |
243 web_contents_->SendScreenRects(); | |
244 | |
245 RenderWidgetHostView* rwhv = !web_contents_->ShowingInterstitialPage() ? | |
boliu
2016/12/06 00:34:14
it's not clear to me why WasResized should only ca
Jinsuk Kim
2016/12/06 07:35:07
I don't have good answers to your questions. You m
boliu
2016/12/06 19:13:59
afaict that's a bug in CVCImpl. Update both.
Jinsuk Kim
2016/12/07 12:36:28
Done. I think the bug is addressed by letting each
| |
246 web_contents_->GetRenderWidgetHostView() : | |
247 web_contents_->GetInterstitialPage() | |
248 ->GetMainFrame() | |
249 ->GetRenderViewHost() | |
250 ->GetWidget() | |
251 ->GetView(); | |
252 (static_cast<RenderWidgetHostViewAndroid*>(rwhv))->WasResized(); | |
253 return true; | |
254 } | |
255 | |
240 void WebContentsViewAndroid::ShowContextMenu( | 256 void WebContentsViewAndroid::ShowContextMenu( |
241 RenderFrameHost* render_frame_host, const ContextMenuParams& params) { | 257 RenderFrameHost* render_frame_host, const ContextMenuParams& params) { |
242 if (delegate_) | 258 if (delegate_) |
243 delegate_->ShowContextMenu(render_frame_host, params); | 259 delegate_->ShowContextMenu(render_frame_host, params); |
244 } | 260 } |
245 | 261 |
246 void WebContentsViewAndroid::ShowPopupMenu( | 262 void WebContentsViewAndroid::ShowPopupMenu( |
247 RenderFrameHost* render_frame_host, | 263 RenderFrameHost* render_frame_host, |
248 const gfx::Rect& bounds, | 264 const gfx::Rect& bounds, |
249 int item_height, | 265 int item_height, |
(...skipping 114 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 | 380 // 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). | 381 // iterated past the last focusable element on the page). |
366 void WebContentsViewAndroid::TakeFocus(bool reverse) { | 382 void WebContentsViewAndroid::TakeFocus(bool reverse) { |
367 if (web_contents_->GetDelegate() && | 383 if (web_contents_->GetDelegate() && |
368 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) | 384 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) |
369 return; | 385 return; |
370 web_contents_->GetRenderWidgetHostView()->Focus(); | 386 web_contents_->GetRenderWidgetHostView()->Focus(); |
371 } | 387 } |
372 | 388 |
373 } // namespace content | 389 } // namespace content |
OLD | NEW |