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

Unified Diff: content/browser/frame_host/render_frame_host_android.h

Issue 2681933002: Add Java wrapper for RenderFrameHost (Closed)
Patch Set: Add getMainFrame API and test it Created 3 years, 10 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
Index: content/browser/frame_host/render_frame_host_android.h
diff --git a/content/browser/frame_host/render_frame_host_android.h b/content/browser/frame_host/render_frame_host_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..02215260710374406117580d39b54f38dba7b215
--- /dev/null
+++ b/content/browser/frame_host/render_frame_host_android.h
@@ -0,0 +1,54 @@
+// 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.
+
+#ifndef CONTENT_BROWSER_FRAME_HOST_ANDROID_H_
+#define CONTENT_BROWSER_FRAME_HOST_ANDROID_H_
+
+#include <jni.h>
+
+#include <memory>
+
+#include "base/android/jni_android.h"
+#include "base/android/scoped_java_ref.h"
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "content/common/content_export.h"
+
+namespace content {
+
+class RenderFrameHostImpl;
+
+// Android wrapper around RenderFrameHost that provides safer passage from java
+// and
please use gerrit instead 2017/02/14 18:31:10 reflow please
rwlbuis 2017/02/14 19:26:27 Done.
+// back to native and provides java with a means of communicating with its
+// native counterpart.
+class CONTENT_EXPORT RenderFrameHostAndroid {
+ public:
+ static bool Register(JNIEnv* env);
+
+ explicit RenderFrameHostAndroid(RenderFrameHostImpl* render_frame_host);
+ ~RenderFrameHostAndroid();
+
+ RenderFrameHostImpl* render_frame_host() const { return render_frame_host_; }
+
+ base::android::ScopedJavaLocalRef<jobject> GetJavaObject();
+
+ // Methods called from Java
+ base::android::ScopedJavaLocalRef<jstring> GetURL(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>&) const;
+
+ private:
+ RenderFrameHostImpl* render_frame_host_;
+ base::android::ScopedJavaGlobalRef<jobject> obj_;
+
+ base::WeakPtrFactory<RenderFrameHostAndroid> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(RenderFrameHostAndroid);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_FRAME_HOST_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698