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

Unified Diff: ui/android/view_root.cc

Issue 2595263002: Introduce ViewRoot forwarding input/view events to native (Closed)
Patch Set: view_root.java_obj_... Created 3 years, 11 months 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
« no previous file with comments | « ui/android/view_root.h ('k') | ui/android/window_android.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/android/view_root.cc
diff --git a/ui/android/view_root.cc b/ui/android/view_root.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5099fcc9499b7996056cef362113d00a16e85dbd
--- /dev/null
+++ b/ui/android/view_root.cc
@@ -0,0 +1,65 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/android/view_root.h"
+
+#include <jni.h>
+#include <string>
+#include <vector>
+
+#include "base/android/jni_weak_ref.h"
+#include "base/android/scoped_java_ref.h"
+#include "base/macros.h"
+#include "base/observer_list.h"
+#include "base/time/time.h"
+#include "jni/ViewRoot_jni.h"
+#include "ui/android/ui_android_export.h"
+#include "ui/android/view_android.h"
+#include "ui/gfx/geometry/vector2d_f.h"
+
+namespace ui {
+
+using base::android::JavaParamRef;
+using base::android::JavaRef;
+using base::android::ScopedJavaLocalRef;
+
+ViewRoot::ViewRoot(jlong window_android_ptr) {
+ WindowAndroid* window_android =
+ reinterpret_cast<WindowAndroid*>(window_android_ptr);
+ window_ = window_android;
+}
+
+void ViewRoot::Destroy(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj) {
+ delete this;
+}
+
+ViewAndroid* ViewRoot::GetViewRoot() {
+ return this;
+}
+
+WindowAndroid* ViewRoot::GetWindowAndroid() const {
+ return window_;
+}
+
+// static
+void ViewRoot::OnPhysicalBackingSizeChanged(JNIEnv* env,
+ const JavaParamRef<jobject>& jobj,
+ int width,
+ int height) {
+ OnPhysicalBackingSizeChangedInternal(width, height);
+}
+
+// static
+jlong Init(JNIEnv* env,
+ const JavaParamRef<jobject>& obj,
+ jlong window_android_ptr) {
+ return reinterpret_cast<intptr_t>(new ViewRoot(window_android_ptr));
+}
+
+bool RegisterViewRoot(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+} // namespace ui
« no previous file with comments | « ui/android/view_root.h ('k') | ui/android/window_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698