OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_FRAME_HOST_ANDROID_H_ | |
6 #define CONTENT_BROWSER_FRAME_HOST_ANDROID_H_ | |
7 | |
8 #include <jni.h> | |
9 | |
10 #include <memory> | |
11 | |
12 #include "base/android/jni_android.h" | |
13 #include "base/android/scoped_java_ref.h" | |
14 #include "base/compiler_specific.h" | |
15 #include "base/macros.h" | |
16 #include "base/memory/weak_ptr.h" | |
17 #include "base/supports_user_data.h" | |
18 #include "content/common/content_export.h" | |
19 | |
20 namespace content { | |
21 | |
22 class RenderFrameHostImpl; | |
23 | |
24 // Android wrapper around RenderFrameHost that provides safer passage from java | |
25 // and back to native and provides java with a means of communicating with its | |
26 // native counterpart. | |
27 class CONTENT_EXPORT RenderFrameHostAndroid | |
28 : public base::SupportsUserData::Data { | |
29 public: | |
30 static bool Register(JNIEnv* env); | |
31 | |
32 explicit RenderFrameHostAndroid(RenderFrameHostImpl* render_frame_host); | |
33 ~RenderFrameHostAndroid() override; | |
34 | |
35 RenderFrameHostImpl* render_frame_host() const { return render_frame_host_; } | |
36 | |
37 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); | |
38 | |
39 // Methods called from Java | |
40 base::android::ScopedJavaLocalRef<jstring> GetLastCommittedURL( | |
41 JNIEnv* env, | |
42 const base::android::JavaParamRef<jobject>&) const; | |
43 | |
44 private: | |
45 RenderFrameHostImpl* render_frame_host_; | |
46 base::android::ScopedJavaGlobalRef<jobject> obj_; | |
boliu
2017/02/15 02:12:51
native strong ref is probably not ok due to webvie
rwlbuis
2017/02/15 22:08:48
Done.
| |
47 | |
48 base::WeakPtrFactory<RenderFrameHostAndroid> weak_factory_; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostAndroid); | |
51 }; | |
52 | |
53 } // namespace content | |
54 | |
55 #endif // CONTENT_BROWSER_FRAME_HOST_ANDROID_H_ | |
OLD | NEW |