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