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 *render_view_host_delegate_view = rv; | 77 *render_view_host_delegate_view = rv; |
78 return rv; | 78 return rv; |
79 } | 79 } |
80 | 80 |
81 WebContentsViewAndroid::WebContentsViewAndroid( | 81 WebContentsViewAndroid::WebContentsViewAndroid( |
82 WebContentsImpl* web_contents, | 82 WebContentsImpl* web_contents, |
83 WebContentsViewDelegate* delegate) | 83 WebContentsViewDelegate* delegate) |
84 : web_contents_(web_contents), | 84 : web_contents_(web_contents), |
85 content_view_core_(NULL), | 85 content_view_core_(NULL), |
86 delegate_(delegate), | 86 delegate_(delegate), |
| 87 view_(this), |
87 synchronous_compositor_client_(nullptr) { | 88 synchronous_compositor_client_(nullptr) { |
88 } | 89 } |
89 | 90 |
90 WebContentsViewAndroid::~WebContentsViewAndroid() { | 91 WebContentsViewAndroid::~WebContentsViewAndroid() { |
91 if (view_.GetLayer()) | 92 if (view_.GetLayer()) |
92 view_.GetLayer()->RemoveFromParent(); | 93 view_.GetLayer()->RemoveFromParent(); |
93 } | 94 } |
94 | 95 |
95 void WebContentsViewAndroid::SetContentViewCore( | 96 void WebContentsViewAndroid::SetContentViewCore( |
96 ContentViewCoreImpl* content_view_core) { | 97 ContentViewCoreImpl* content_view_core) { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 257 |
257 void WebContentsViewAndroid::RenderViewCreated(RenderViewHost* host) { | 258 void WebContentsViewAndroid::RenderViewCreated(RenderViewHost* host) { |
258 } | 259 } |
259 | 260 |
260 void WebContentsViewAndroid::RenderViewSwappedIn(RenderViewHost* host) { | 261 void WebContentsViewAndroid::RenderViewSwappedIn(RenderViewHost* host) { |
261 } | 262 } |
262 | 263 |
263 void WebContentsViewAndroid::SetOverscrollControllerEnabled(bool enabled) { | 264 void WebContentsViewAndroid::SetOverscrollControllerEnabled(bool enabled) { |
264 } | 265 } |
265 | 266 |
| 267 void WebContentsViewAndroid::OnPhysicalBackingSizeChanged(int width, |
| 268 int height) { |
| 269 // |SendScreenRects()| indirectly calls GetViewSize() that asks Java layer. |
| 270 web_contents_->SendScreenRects(); |
| 271 } |
| 272 |
266 void WebContentsViewAndroid::ShowContextMenu( | 273 void WebContentsViewAndroid::ShowContextMenu( |
267 RenderFrameHost* render_frame_host, const ContextMenuParams& params) { | 274 RenderFrameHost* render_frame_host, const ContextMenuParams& params) { |
268 if (delegate_) | 275 if (delegate_) |
269 delegate_->ShowContextMenu(render_frame_host, params); | 276 delegate_->ShowContextMenu(render_frame_host, params); |
270 } | 277 } |
271 | 278 |
272 void WebContentsViewAndroid::ShowPopupMenu( | 279 void WebContentsViewAndroid::ShowPopupMenu( |
273 RenderFrameHost* render_frame_host, | 280 RenderFrameHost* render_frame_host, |
274 const gfx::Rect& bounds, | 281 const gfx::Rect& bounds, |
275 int item_height, | 282 int item_height, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 // This is called when we the renderer asks us to take focus back (i.e., it has | 397 // This is called when we the renderer asks us to take focus back (i.e., it has |
391 // iterated past the last focusable element on the page). | 398 // iterated past the last focusable element on the page). |
392 void WebContentsViewAndroid::TakeFocus(bool reverse) { | 399 void WebContentsViewAndroid::TakeFocus(bool reverse) { |
393 if (web_contents_->GetDelegate() && | 400 if (web_contents_->GetDelegate() && |
394 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) | 401 web_contents_->GetDelegate()->TakeFocus(web_contents_, reverse)) |
395 return; | 402 return; |
396 web_contents_->GetRenderWidgetHostView()->Focus(); | 403 web_contents_->GetRenderWidgetHostView()->Focus(); |
397 } | 404 } |
398 | 405 |
399 } // namespace content | 406 } // namespace content |
OLD | NEW |