Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1542)

Unified Diff: content/browser/web_contents/web_contents_view_android.cc

Issue 2502763003: Introduce ViewRoot to forward input/view events to native (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/web_contents_view_android.cc
diff --git a/content/browser/web_contents/web_contents_view_android.cc b/content/browser/web_contents/web_contents_view_android.cc
index 338d07eb410e963b6fc9993c5aa4a1e1446f10f3..7757ea079add829111bdff4db97874d191d560bf 100644
--- a/content/browser/web_contents/web_contents_view_android.cc
+++ b/content/browser/web_contents/web_contents_view_android.cc
@@ -6,6 +6,7 @@
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
+#include "base/bind.h"
#include "base/logging.h"
#include "cc/layers/layer.h"
#include "content/browser/android/content_view_core_impl.h"
@@ -22,6 +23,8 @@
#include "ui/gfx/android/java_bitmap.h"
#include "ui/gfx/image/image_skia.h"
+using base::Bind;
+using base::Unretained;
using base::android::AttachCurrentThread;
using base::android::ConvertUTF16ToJavaString;
using base::android::JavaRef;
@@ -84,6 +87,7 @@ WebContentsViewAndroid::WebContentsViewAndroid(
WebContentsViewAndroid::~WebContentsViewAndroid() {
if (view_.GetLayer())
view_.GetLayer()->RemoveFromParent();
+ view_.reset_physical_backing_size_changed_handler();
}
void WebContentsViewAndroid::SetContentViewCore(
@@ -104,6 +108,23 @@ void WebContentsViewAndroid::SetContentViewCore(
if (rwhv)
rwhv->SetContentViewCore(content_view_core_);
}
+
+ view_.reset_physical_backing_size_changed_handler(
+ Bind(&WebContentsViewAndroid::OnPhysicalBackingSizeChanged,
+ Unretained(this)));
+}
+
+void WebContentsViewAndroid::OnPhysicalBackingSizeChanged(int width,
+ int height) {
+ gfx::Size physical_size(width, height);
+ view_.GetLayer()->SetBounds(physical_size);
+
+ RenderWidgetHostViewAndroid* rwhv = static_cast<RenderWidgetHostViewAndroid*>(
+ web_contents_->GetRenderWidgetHostView());
+ if (rwhv) {
+ web_contents_->SendScreenRects();
+ rwhv->WasResized();
+ }
}
gfx::NativeView WebContentsViewAndroid::GetNativeView() const {

Powered by Google App Engine
This is Rietveld 408576698