| 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 #include "content/renderer/java/gin_java_bridge_object.h" | 5 #include "content/renderer/java/gin_java_bridge_object.h" |
| 6 | 6 |
| 7 #include "content/common/gin_java_bridge_messages.h" | 7 #include "content/common/gin_java_bridge_messages.h" |
| 8 #include "content/public/renderer/render_thread.h" | 8 #include "content/public/renderer/render_thread.h" |
| 9 #include "content/renderer/java/gin_java_function_invocation_helper.h" | 9 #include "content/renderer/java/gin_java_function_invocation_helper.h" |
| 10 #include "gin/function_template.h" | 10 #include "gin/function_template.h" |
| 11 #include "third_party/WebKit/public/web/WebFrame.h" | |
| 12 #include "third_party/WebKit/public/web/WebKit.h" | 11 #include "third_party/WebKit/public/web/WebKit.h" |
| 12 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 // static | 16 // static |
| 17 GinJavaBridgeObject* GinJavaBridgeObject::InjectNamed( | 17 GinJavaBridgeObject* GinJavaBridgeObject::InjectNamed( |
| 18 blink::WebFrame* frame, | 18 blink::WebLocalFrame* frame, |
| 19 const base::WeakPtr<GinJavaBridgeDispatcher>& dispatcher, | 19 const base::WeakPtr<GinJavaBridgeDispatcher>& dispatcher, |
| 20 const std::string& object_name, | 20 const std::string& object_name, |
| 21 GinJavaBridgeDispatcher::ObjectID object_id) { | 21 GinJavaBridgeDispatcher::ObjectID object_id) { |
| 22 v8::Isolate* isolate = blink::MainThreadIsolate(); | 22 v8::Isolate* isolate = blink::MainThreadIsolate(); |
| 23 v8::HandleScope handle_scope(isolate); | 23 v8::HandleScope handle_scope(isolate); |
| 24 v8::Local<v8::Context> context = frame->MainWorldScriptContext(); | 24 v8::Local<v8::Context> context = frame->MainWorldScriptContext(); |
| 25 if (context.IsEmpty()) | 25 if (context.IsEmpty()) |
| 26 return NULL; | 26 return NULL; |
| 27 | 27 |
| 28 GinJavaBridgeObject* object = | 28 GinJavaBridgeObject* object = |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 isolate, base::Bind(&GinJavaFunctionInvocationHelper::Invoke, | 113 isolate, base::Bind(&GinJavaFunctionInvocationHelper::Invoke, |
| 114 base::Owned(new GinJavaFunctionInvocationHelper( | 114 base::Owned(new GinJavaFunctionInvocationHelper( |
| 115 name, dispatcher_)))); | 115 name, dispatcher_)))); |
| 116 template_cache_.Set(name, function_template); | 116 template_cache_.Set(name, function_template); |
| 117 return function_template; | 117 return function_template; |
| 118 } | 118 } |
| 119 | 119 |
| 120 gin::WrapperInfo GinJavaBridgeObject::kWrapperInfo = {gin::kEmbedderNativeGin}; | 120 gin::WrapperInfo GinJavaBridgeObject::kWrapperInfo = {gin::kEmbedderNativeGin}; |
| 121 | 121 |
| 122 } // namespace content | 122 } // namespace content |
| OLD | NEW |