| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 26 matching lines...) Expand all  Loading... | 
| 37   // Methods to implement the NPObject callbacks. | 37   // Methods to implement the NPObject callbacks. | 
| 38   bool HasMethod(const std::string& name) const; | 38   bool HasMethod(const std::string& name) const; | 
| 39   bool Invoke(const std::string& name, const NPVariant* args, size_t arg_count, | 39   bool Invoke(const std::string& name, const NPVariant* args, size_t arg_count, | 
| 40               NPVariant* result); | 40               NPVariant* result); | 
| 41 | 41 | 
| 42  private: | 42  private: | 
| 43   explicit JavaBoundObject(const base::android::JavaRef<jobject>& object); | 43   explicit JavaBoundObject(const base::android::JavaRef<jobject>& object); | 
| 44 | 44 | 
| 45   void EnsureMethodsAreSetUp() const; | 45   void EnsureMethodsAreSetUp() const; | 
| 46 | 46 | 
| 47   // Global ref to the underlying Java object. We use a naked jobject, rather | 47   // The global ref to the underlying Java object that this JavaBoundObject | 
| 48   // than a ScopedJavaGlobalRef, as the global ref will be added and dropped on | 48   // instance represents. | 
| 49   // different threads. | 49   base::android::ScopedJavaGlobalRef<jobject> java_object_; | 
| 50   jobject java_object_; |  | 
| 51 | 50 | 
| 52   // Map of public methods, from method name to Method instance. Multiple | 51   // Map of public methods, from method name to Method instance. Multiple | 
| 53   // entries will be present for overloaded methods. Note that we can't use | 52   // entries will be present for overloaded methods. Note that we can't use | 
| 54   // scoped_ptr in STL containers as we can't copy it. | 53   // scoped_ptr in STL containers as we can't copy it. | 
| 55   typedef std::multimap<std::string, linked_ptr<JavaMethod> > JavaMethodMap; | 54   typedef std::multimap<std::string, linked_ptr<JavaMethod> > JavaMethodMap; | 
| 56   mutable JavaMethodMap methods_; | 55   mutable JavaMethodMap methods_; | 
| 57 | 56 | 
| 58   DISALLOW_IMPLICIT_CONSTRUCTORS(JavaBoundObject); | 57   DISALLOW_IMPLICIT_CONSTRUCTORS(JavaBoundObject); | 
| 59 }; | 58 }; | 
| 60 | 59 | 
| 61 #endif  // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ | 60 #endif  // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ | 
| OLD | NEW | 
|---|