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/jni_weak_ref.h" |
| 14 #include "base/android/scoped_java_ref.h" |
| 15 #include "base/compiler_specific.h" |
| 16 #include "base/macros.h" |
| 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/supports_user_data.h" |
| 19 #include "content/common/content_export.h" |
| 20 |
| 21 namespace content { |
| 22 |
| 23 class RenderFrameHostImpl; |
| 24 |
| 25 // Android wrapper around RenderFrameHost that provides safer passage from java |
| 26 // and back to native and provides java with a means of communicating with its |
| 27 // native counterpart. |
| 28 class CONTENT_EXPORT RenderFrameHostAndroid |
| 29 : public base::SupportsUserData::Data { |
| 30 public: |
| 31 static bool Register(JNIEnv* env); |
| 32 |
| 33 explicit RenderFrameHostAndroid(RenderFrameHostImpl* render_frame_host); |
| 34 ~RenderFrameHostAndroid() override; |
| 35 |
| 36 RenderFrameHostImpl* render_frame_host() const { return render_frame_host_; } |
| 37 |
| 38 base::android::ScopedJavaLocalRef<jobject> GetJavaObject(); |
| 39 |
| 40 // Methods called from Java |
| 41 base::android::ScopedJavaLocalRef<jstring> GetLastCommittedURL( |
| 42 JNIEnv* env, |
| 43 const base::android::JavaParamRef<jobject>&) const; |
| 44 |
| 45 private: |
| 46 RenderFrameHostImpl* render_frame_host_; |
| 47 JavaObjectWeakGlobalRef obj_; |
| 48 |
| 49 base::WeakPtrFactory<RenderFrameHostAndroid> weak_factory_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostAndroid); |
| 52 }; |
| 53 |
| 54 } // namespace content |
| 55 |
| 56 #endif // CONTENT_BROWSER_FRAME_HOST_ANDROID_H_ |
OLD | NEW |