| 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_OBJECT_H_ | 5 #ifndef CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_OBJECT_H_ |
| 6 #define CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_OBJECT_H_ | 6 #define CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_OBJECT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 12 #include "content/renderer/java/gin_java_bridge_dispatcher.h" | 11 #include "content/renderer/java/gin_java_bridge_dispatcher.h" |
| 13 #include "gin/handle.h" | 12 #include "gin/handle.h" |
| 14 #include "gin/interceptor.h" | 13 #include "gin/interceptor.h" |
| 15 #include "gin/object_template_builder.h" | 14 #include "gin/object_template_builder.h" |
| 16 #include "gin/wrappable.h" | 15 #include "gin/wrappable.h" |
| 17 #include "v8/include/v8-util.h" | 16 #include "v8/include/v8-util.h" |
| 18 | 17 |
| 19 namespace blink { | 18 namespace blink { |
| 20 class WebFrame; | 19 class WebFrame; |
| 21 } | 20 } |
| 22 | 21 |
| 23 namespace content { | 22 namespace content { |
| 24 | 23 |
| 25 class GinJavaBridgeValueConverter; | |
| 26 | |
| 27 class GinJavaBridgeObject : public gin::Wrappable<GinJavaBridgeObject>, | 24 class GinJavaBridgeObject : public gin::Wrappable<GinJavaBridgeObject>, |
| 28 public gin::NamedPropertyInterceptor { | 25 public gin::NamedPropertyInterceptor { |
| 29 public: | 26 public: |
| 30 static gin::WrapperInfo kWrapperInfo; | 27 static gin::WrapperInfo kWrapperInfo; |
| 31 | 28 |
| 32 GinJavaBridgeDispatcher::ObjectID object_id() const { return object_id_; } | 29 GinJavaBridgeDispatcher::ObjectID object_id() const { return object_id_; } |
| 33 | 30 |
| 34 // gin::Wrappable. | 31 // gin::Wrappable. |
| 35 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( | 32 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( |
| 36 v8::Isolate* isolate) override; | 33 v8::Isolate* isolate) override; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 51 GinJavaBridgeDispatcher::ObjectID object_id); | 48 GinJavaBridgeDispatcher::ObjectID object_id); |
| 52 | 49 |
| 53 private: | 50 private: |
| 54 GinJavaBridgeObject(v8::Isolate* isolate, | 51 GinJavaBridgeObject(v8::Isolate* isolate, |
| 55 const base::WeakPtr<GinJavaBridgeDispatcher>& dispatcher, | 52 const base::WeakPtr<GinJavaBridgeDispatcher>& dispatcher, |
| 56 GinJavaBridgeDispatcher::ObjectID object_id); | 53 GinJavaBridgeDispatcher::ObjectID object_id); |
| 57 ~GinJavaBridgeObject() override; | 54 ~GinJavaBridgeObject() override; |
| 58 | 55 |
| 59 v8::Local<v8::FunctionTemplate> GetFunctionTemplate(v8::Isolate* isolate, | 56 v8::Local<v8::FunctionTemplate> GetFunctionTemplate(v8::Isolate* isolate, |
| 60 const std::string& name); | 57 const std::string& name); |
| 61 v8::Handle<v8::Value> InvokeMethod(const std::string& name, | |
| 62 gin::Arguments* args); | |
| 63 | 58 |
| 64 base::WeakPtr<GinJavaBridgeDispatcher> dispatcher_; | 59 base::WeakPtr<GinJavaBridgeDispatcher> dispatcher_; |
| 65 GinJavaBridgeDispatcher::ObjectID object_id_; | 60 GinJavaBridgeDispatcher::ObjectID object_id_; |
| 66 scoped_ptr<GinJavaBridgeValueConverter> converter_; | |
| 67 std::map<std::string, bool> known_methods_; | 61 std::map<std::string, bool> known_methods_; |
| 68 v8::StdPersistentValueMap<std::string, v8::FunctionTemplate> template_cache_; | 62 v8::StdPersistentValueMap<std::string, v8::FunctionTemplate> template_cache_; |
| 69 | 63 |
| 70 DISALLOW_COPY_AND_ASSIGN(GinJavaBridgeObject); | 64 DISALLOW_COPY_AND_ASSIGN(GinJavaBridgeObject); |
| 71 }; | 65 }; |
| 72 | 66 |
| 73 } // namespace content | 67 } // namespace content |
| 74 | 68 |
| 75 #endif // CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_OBJECT_H_ | 69 #endif // CONTENT_RENDERER_JAVA_GIN_JAVA_BRIDGE_OBJECT_H_ |
| OLD | NEW |