Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: content/browser/renderer_host/java/java_bound_object.h

Issue 213693005: [Android] Block access to java.lang.Object.getClass in injected Java objects (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed tests Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/renderer_host/java/java_bound_object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 private: 58 private:
59 JavaBoundObject( 59 JavaBoundObject(
60 const base::android::JavaRef<jobject>& object, 60 const base::android::JavaRef<jobject>& object,
61 const base::android::JavaRef<jclass>& safe_annotation_clazz, 61 const base::android::JavaRef<jclass>& safe_annotation_clazz,
62 const base::WeakPtr<JavaBridgeDispatcherHostManager>& manager, 62 const base::WeakPtr<JavaBridgeDispatcherHostManager>& manager,
63 bool can_enumerate_methods); 63 bool can_enumerate_methods);
64 64
65 void EnsureMethodsAreSetUp() const; 65 void EnsureMethodsAreSetUp() const;
66 66
67 static void ThrowSecurityException(const char* message);
68
67 // The weak ref to the underlying Java object that this JavaBoundObject 69 // The weak ref to the underlying Java object that this JavaBoundObject
68 // instance represents. 70 // instance represents.
69 JavaObjectWeakGlobalRef java_object_; 71 JavaObjectWeakGlobalRef java_object_;
70 72
71 // Keep a pointer back to the JavaBridgeDispatcherHostManager so that we 73 // Keep a pointer back to the JavaBridgeDispatcherHostManager so that we
72 // can notify it when this JavaBoundObject is destroyed. JavaBoundObjects 74 // can notify it when this JavaBoundObject is destroyed. JavaBoundObjects
73 // may outlive the manager so keep a WeakPtr. Note the WeakPtr may only be 75 // may outlive the manager so keep a WeakPtr. Note the WeakPtr may only be
74 // dereferenced on the UI thread. 76 // dereferenced on the UI thread.
75 base::WeakPtr<JavaBridgeDispatcherHostManager> manager_; 77 base::WeakPtr<JavaBridgeDispatcherHostManager> manager_;
76 78
77 // Map of public methods, from method name to Method instance. Multiple 79 // Map of public methods, from method name to Method instance. Multiple
78 // entries will be present for overloaded methods. Note that we can't use 80 // entries will be present for overloaded methods. Note that we can't use
79 // scoped_ptr in STL containers as we can't copy it. 81 // scoped_ptr in STL containers as we can't copy it.
80 typedef std::multimap<std::string, linked_ptr<JavaMethod> > JavaMethodMap; 82 typedef std::multimap<std::string, linked_ptr<JavaMethod> > JavaMethodMap;
81 mutable JavaMethodMap methods_; 83 mutable JavaMethodMap methods_;
82 mutable bool are_methods_set_up_; 84 mutable bool are_methods_set_up_;
85 mutable jmethodID object_get_class_method_id_;
83 const bool can_enumerate_methods_; 86 const bool can_enumerate_methods_;
84 87
85 base::android::ScopedJavaGlobalRef<jclass> safe_annotation_clazz_; 88 base::android::ScopedJavaGlobalRef<jclass> safe_annotation_clazz_;
86 89
87 DISALLOW_IMPLICIT_CONSTRUCTORS(JavaBoundObject); 90 DISALLOW_IMPLICIT_CONSTRUCTORS(JavaBoundObject);
88 }; 91 };
89 92
90 } // namespace content 93 } // namespace content
91 94
92 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_ 95 #endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_BOUND_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/java/java_bound_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698