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