Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 // Interrogation of the Java object for its methods is done lazily. This class | 27 // Interrogation of the Java object for its methods is done lazily. This class |
| 28 // is not generally threadsafe. However, it does allow for instances to be | 28 // is not generally threadsafe. However, it does allow for instances to be |
| 29 // created and destroyed on different threads. | 29 // created and destroyed on different threads. |
| 30 class JavaBoundObject { | 30 class JavaBoundObject { |
| 31 public: | 31 public: |
| 32 // Takes a Java object and creates a JavaBoundObject around it. The | 32 // Takes a Java object and creates a JavaBoundObject around it. The |
| 33 // |require_annotation| flag specifies whether or not only methods with the | 33 // |require_annotation| flag specifies whether or not only methods with the |
| 34 // JavascriptInterface annotation are exposed to JavaScript. This property | 34 // JavascriptInterface annotation are exposed to JavaScript. This property |
| 35 // propagates to all Objects that get implicitly exposed as return values as | 35 // propagates to all Objects that get implicitly exposed as return values as |
| 36 // well. Returns an NPObject with a ref count of one which owns the | 36 // well. Returns an NPObject with a ref count of one which owns the |
| 37 // JavaBoundObject. | 37 // JavaBoundObject. The object is marked as owned by |owner|. |
| 38 // See also comment below for |manager_|. | 38 // See also comment below for |manager_|. |
| 39 static NPObject* Create( | 39 static NPObject* Create( |
| 40 struct _NPP* owner, | |
|
joth
2013/07/02 20:49:03
I thought in C++ it's fine to just declare this as
Wez
2013/07/02 21:05:09
Yes. However, the NPAPI headers typedef struct _NP
| |
| 40 const base::android::JavaRef<jobject>& object, | 41 const base::android::JavaRef<jobject>& object, |
| 41 const base::android::JavaRef<jclass>& safe_annotation_clazz, | 42 const base::android::JavaRef<jclass>& safe_annotation_clazz, |
| 42 const base::WeakPtr<JavaBridgeDispatcherHostManager>& manager); | 43 const base::WeakPtr<JavaBridgeDispatcherHostManager>& manager); |
| 43 | 44 |
| 44 virtual ~JavaBoundObject(); | 45 virtual ~JavaBoundObject(); |
| 45 | 46 |
| 46 // Gets a local ref to the underlying JavaObject from a JavaBoundObject | 47 // Gets a local ref to the underlying JavaObject from a JavaBoundObject |
| 47 // wrapped as an NPObject. May return null if the underlying object has | 48 // wrapped as an NPObject. May return null if the underlying object has |
| 48 // been garbage collected. | 49 // been garbage collected. |
| 49 static base::android::ScopedJavaLocalRef<jobject> GetJavaObject( | 50 static base::android::ScopedJavaLocalRef<jobject> GetJavaObject( |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 80 mutable bool are_methods_set_up_; | 81 mutable bool are_methods_set_up_; |
| 81 | 82 |
| 82 base::android::ScopedJavaGlobalRef<jclass> safe_annotation_clazz_; | 83 base::android::ScopedJavaGlobalRef<jclass> safe_annotation_clazz_; |
| 83 | 84 |
| 84 DISALLOW_IMPLICIT_CONSTRUCTORS(JavaBoundObject); | 85 DISALLOW_IMPLICIT_CONSTRUCTORS(JavaBoundObject); |
| 85 }; | 86 }; |
| 86 | 87 |
| 87 } // namespace content | 88 } // namespace content |
| 88 | 89 |
| 89 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ | 90 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ |
| OLD | NEW |