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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 synchronous_compositor_client_(nullptr) { |
87 view_.SetViewClient(this); | |
87 } | 88 } |
88 | 89 |
89 WebContentsViewAndroid::~WebContentsViewAndroid() { | 90 WebContentsViewAndroid::~WebContentsViewAndroid() { |
90 if (view_.GetLayer()) | 91 if (view_.GetLayer()) |
91 view_.GetLayer()->RemoveFromParent(); | 92 view_.GetLayer()->RemoveFromParent(); |
92 } | 93 } |
93 | 94 |
94 void WebContentsViewAndroid::SetContentViewCore( | 95 void WebContentsViewAndroid::SetContentViewCore( |
95 ContentViewCoreImpl* content_view_core) { | 96 ContentViewCoreImpl* content_view_core) { |
96 content_view_core_ = content_view_core; | 97 content_view_core_ = content_view_core; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 | 231 |
231 void WebContentsViewAndroid::RenderViewCreated(RenderViewHost* host) { | 232 void WebContentsViewAndroid::RenderViewCreated(RenderViewHost* host) { |
232 } | 233 } |
233 | 234 |
234 void WebContentsViewAndroid::RenderViewSwappedIn(RenderViewHost* host) { | 235 void WebContentsViewAndroid::RenderViewSwappedIn(RenderViewHost* host) { |
235 } | 236 } |
236 | 237 |
237 void WebContentsViewAndroid::SetOverscrollControllerEnabled(bool enabled) { | 238 void WebContentsViewAndroid::SetOverscrollControllerEnabled(bool enabled) { |
238 } | 239 } |
239 | 240 |
241 bool WebContentsViewAndroid::OnPhysicalBackingSizeChanged(int width, | |
242 int height) { | |
243 gfx::Size physical_size(width, height); | |
244 view_.GetLayer()->SetBounds(physical_size); | |
boliu
2016/12/02 23:53:22
ditto about keeping the layer in sync
Jinsuk Kim
2016/12/05 11:07:44
Defined UpdateLayerBounds() and called it when phy
| |
245 | |
246 // |SendScreenRects()| indirectly calls GetViewSize() that asks Java layer. | |
247 web_contents_->SendScreenRects(); | |
248 | |
249 RenderWidgetHostView* rwhv = !web_contents_->ShowingInterstitialPage() ? | |
250 web_contents_->GetRenderWidgetHostView() : | |
251 web_contents_->GetInterstitialPage() | |
252 ->GetMainFrame() | |
253 ->GetRenderViewHost() | |
254 ->GetWidget() | |
255 ->GetView(); | |
256 (static_cast<RenderWidgetHostViewAndroid*>(rwhv))->WasResized(); | |
257 return true; | |
258 } | |
259 | |
240 void WebContentsViewAndroid::ShowContextMenu( | 260 void WebContentsViewAndroid::ShowContextMenu( |
241 RenderFrameHost* render_frame_host, const ContextMenuParams& params) { | 261 RenderFrameHost* render_frame_host, const ContextMenuParams& params) { |
242 if (delegate_) | 262 if (delegate_) |
243 delegate_->ShowContextMenu(render_frame_host, params); | 263 delegate_->ShowContextMenu(render_frame_host, params); |
244 } | 264 } |
245 | 265 |
246 void WebContentsViewAndroid::ShowPopupMenu( | 266 void WebContentsViewAndroid::ShowPopupMenu( |
247 RenderFrameHost* render_frame_host, | 267 RenderFrameHost* render_frame_host, |
248 const gfx::Rect& bounds, | 268 const gfx::Rect& bounds, |
249 int item_height, | 269 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 | 384 // 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). | 385 // iterated past the last focusable element on the page). |
366 void WebContentsViewAndroid::TakeFocus(bool reverse) { | 386 void WebContentsViewAndroid::TakeFocus(bool reverse) { |
367 if (web_contents_->GetDelegate() && | 387 if (web_contents_->GetDelegate() && |
368 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) | 388 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) |
369 return; | 389 return; |
370 web_contents_->GetRenderWidgetHostView()->Focus(); | 390 web_contents_->GetRenderWidgetHostView()->Focus(); |
371 } | 391 } |
372 | 392 |
373 } // namespace content | 393 } // namespace content |
OLD | NEW |