OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_RENDERER_JAVA_GIN_JAVA_BRIDGE_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_DISPATCHER_H_ |
6 #define CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_DISPATCHER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "base/id_map.h" | 11 #include "base/id_map.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "content/common/android/gin_java_bridge_errors.h" |
15 #include "content/public/renderer/render_frame_observer.h" | 16 #include "content/public/renderer/render_frame_observer.h" |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 class WebFrame; | 19 class WebFrame; |
19 } | 20 } |
20 | 21 |
21 namespace content { | 22 namespace content { |
22 | 23 |
23 class GinJavaBridgeObject; | 24 class GinJavaBridgeObject; |
24 | 25 |
(...skipping 18 matching lines...) Expand all Loading... |
43 virtual ~GinJavaBridgeDispatcher(); | 44 virtual ~GinJavaBridgeDispatcher(); |
44 | 45 |
45 // RenderFrameObserver override: | 46 // RenderFrameObserver override: |
46 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 47 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
47 virtual void DidClearWindowObject() OVERRIDE; | 48 virtual void DidClearWindowObject() OVERRIDE; |
48 | 49 |
49 void GetJavaMethods(ObjectID object_id, std::set<std::string>* methods); | 50 void GetJavaMethods(ObjectID object_id, std::set<std::string>* methods); |
50 bool HasJavaMethod(ObjectID object_id, const std::string& method_name); | 51 bool HasJavaMethod(ObjectID object_id, const std::string& method_name); |
51 scoped_ptr<base::Value> InvokeJavaMethod(ObjectID object_id, | 52 scoped_ptr<base::Value> InvokeJavaMethod(ObjectID object_id, |
52 const std::string& method_name, | 53 const std::string& method_name, |
53 const base::ListValue& arguments); | 54 const base::ListValue& arguments, |
| 55 GinJavaBridgeError* error); |
54 GinJavaBridgeObject* GetObject(ObjectID object_id); | 56 GinJavaBridgeObject* GetObject(ObjectID object_id); |
55 void OnGinJavaBridgeObjectDeleted(ObjectID object_id); | 57 void OnGinJavaBridgeObjectDeleted(ObjectID object_id); |
56 | 58 |
57 private: | 59 private: |
58 void OnAddNamedObject(const std::string& name, | 60 void OnAddNamedObject(const std::string& name, |
59 ObjectID object_id); | 61 ObjectID object_id); |
60 void OnRemoveNamedObject(const std::string& name); | 62 void OnRemoveNamedObject(const std::string& name); |
61 void OnSetAllowObjectContentsInspection(bool allow); | 63 void OnSetAllowObjectContentsInspection(bool allow); |
62 | 64 |
63 typedef std::map<std::string, ObjectID> NamedObjectMap; | 65 typedef std::map<std::string, ObjectID> NamedObjectMap; |
64 NamedObjectMap named_objects_; | 66 NamedObjectMap named_objects_; |
65 ObjectMap objects_; | 67 ObjectMap objects_; |
66 bool inside_did_clear_window_object_; | 68 bool inside_did_clear_window_object_; |
67 | 69 |
68 DISALLOW_COPY_AND_ASSIGN(GinJavaBridgeDispatcher); | 70 DISALLOW_COPY_AND_ASSIGN(GinJavaBridgeDispatcher); |
69 }; | 71 }; |
70 | 72 |
71 } // namespace content | 73 } // namespace content |
72 | 74 |
73 #endif // CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_DISPATCHER_H_ | 75 #endif // CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_DISPATCHER_H_ |
OLD | NEW |