| 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> |
| 11 | 11 |
| 12 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
| 13 #include "base/memory/linked_ptr.h" | 13 #include "base/memory/linked_ptr.h" |
| 14 #include "content/browser/renderer_host/java/java_method.h" | 14 #include "content/browser/renderer_host/java/java_method.h" |
| 15 #include "third_party/npapi/bindings/npruntime.h" | 15 #include "third_party/npapi/bindings/npruntime.h" |
| 16 | 16 |
| 17 namespace content { |
| 18 |
| 17 // Wrapper around a Java object. | 19 // Wrapper around a Java object. |
| 18 // | 20 // |
| 19 // Represents a Java object for use in the Java bridge. Holds a global ref to | 21 // Represents a Java object for use in the Java bridge. Holds a global ref to |
| 20 // the Java object and provides the ability to invoke methods on it. | 22 // the Java object and provides the ability to invoke methods on it. |
| 21 // Interrogation of the Java object for its methods is done lazily. This class | 23 // Interrogation of the Java object for its methods is done lazily. This class |
| 22 // is not generally threadsafe. However, it does allow for instances to be | 24 // is not generally threadsafe. However, it does allow for instances to be |
| 23 // created and destroyed on different threads. | 25 // created and destroyed on different threads. |
| 24 class JavaBoundObject { | 26 class JavaBoundObject { |
| 25 public: | 27 public: |
| 26 // Takes a Java object and creates a JavaBoundObject around it. The | 28 // Takes a Java object and creates a JavaBoundObject around it. The |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // scoped_ptr in STL containers as we can't copy it. | 63 // scoped_ptr in STL containers as we can't copy it. |
| 62 typedef std::multimap<std::string, linked_ptr<JavaMethod> > JavaMethodMap; | 64 typedef std::multimap<std::string, linked_ptr<JavaMethod> > JavaMethodMap; |
| 63 mutable JavaMethodMap methods_; | 65 mutable JavaMethodMap methods_; |
| 64 mutable bool are_methods_set_up_; | 66 mutable bool are_methods_set_up_; |
| 65 | 67 |
| 66 const bool require_annotation_; | 68 const bool require_annotation_; |
| 67 | 69 |
| 68 DISALLOW_IMPLICIT_CONSTRUCTORS(JavaBoundObject); | 70 DISALLOW_IMPLICIT_CONSTRUCTORS(JavaBoundObject); |
| 69 }; | 71 }; |
| 70 | 72 |
| 73 } // namespace content |
| 74 |
| 71 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ | 75 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ |
| OLD | NEW |