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 void WebContentsViewAndroid::OnPhysicalBackingSizeChanged(int width, | |
241 int height) { | |
242 // |SendScreenRects()| indirectly calls GetViewSize() that asks Java layer. | |
243 web_contents_->SendScreenRects(); | |
boliu
2016/12/06 23:15:46
so this code is duplicated from ContentViewCoreImp
Jinsuk Kim
2016/12/07 12:36:28
Done.
| |
244 | |
245 RenderWidgetHostView* rwhv = !web_contents_->ShowingInterstitialPage() ? | |
246 web_contents_->GetRenderWidgetHostView() : | |
247 web_contents_->GetInterstitialPage() | |
248 ->GetMainFrame() | |
249 ->GetRenderViewHost() | |
250 ->GetWidget() | |
251 ->GetView(); | |
252 (static_cast<RenderWidgetHostViewAndroid*>(rwhv))->WasResized(); | |
253 } | |
254 | |
240 void WebContentsViewAndroid::ShowContextMenu( | 255 void WebContentsViewAndroid::ShowContextMenu( |
241 RenderFrameHost* render_frame_host, const ContextMenuParams& params) { | 256 RenderFrameHost* render_frame_host, const ContextMenuParams& params) { |
242 if (delegate_) | 257 if (delegate_) |
243 delegate_->ShowContextMenu(render_frame_host, params); | 258 delegate_->ShowContextMenu(render_frame_host, params); |
244 } | 259 } |
245 | 260 |
246 void WebContentsViewAndroid::ShowPopupMenu( | 261 void WebContentsViewAndroid::ShowPopupMenu( |
247 RenderFrameHost* render_frame_host, | 262 RenderFrameHost* render_frame_host, |
248 const gfx::Rect& bounds, | 263 const gfx::Rect& bounds, |
249 int item_height, | 264 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 | 379 // 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). | 380 // iterated past the last focusable element on the page). |
366 void WebContentsViewAndroid::TakeFocus(bool reverse) { | 381 void WebContentsViewAndroid::TakeFocus(bool reverse) { |
367 if (web_contents_->GetDelegate() && | 382 if (web_contents_->GetDelegate() && |
368 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) | 383 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) |
369 return; | 384 return; |
370 web_contents_->GetRenderWidgetHostView()->Focus(); | 385 web_contents_->GetRenderWidgetHostView()->Focus(); |
371 } | 386 } |
372 | 387 |
373 } // namespace content | 388 } // namespace content |
OLD | NEW |