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/mojo/interface_provider_js_wrapper.h" | 5 #include "content/renderer/mojo/interface_provider_js_wrapper.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "mojo/edk/js/handle.h" | |
11 #include "services/service_manager/public/cpp/interface_provider.h" | 10 #include "services/service_manager/public/cpp/interface_provider.h" |
12 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 11 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 12 #include "third_party/WebKit/public/web/WebMojoBindings.h" |
| 13 |
| 14 namespace gin { |
| 15 template <> |
| 16 struct Converter<mojo::Handle> { |
| 17 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, mojo::Handle val) { |
| 18 return blink::WebMojoBindings::wrap(isolate->GetCurrentContext(), |
| 19 mojo::MakeScopedHandle(val)); |
| 20 } |
| 21 }; |
| 22 } // namespace gin |
13 | 23 |
14 namespace content { | 24 namespace content { |
15 | 25 |
16 gin::WrapperInfo InterfaceProviderJsWrapper::kWrapperInfo = { | 26 gin::WrapperInfo InterfaceProviderJsWrapper::kWrapperInfo = { |
17 gin::kEmbedderNativeGin}; | 27 gin::kEmbedderNativeGin}; |
18 const char InterfaceProviderJsWrapper::kPerFrameModuleName[] = | 28 const char InterfaceProviderJsWrapper::kPerFrameModuleName[] = |
19 "content/public/renderer/frame_interfaces"; | 29 "content/public/renderer/frame_interfaces"; |
20 const char InterfaceProviderJsWrapper::kPerProcessModuleName[] = | 30 const char InterfaceProviderJsWrapper::kPerProcessModuleName[] = |
21 "content/public/renderer/interfaces"; | 31 "content/public/renderer/interfaces"; |
22 | 32 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 114 } |
105 | 115 |
106 // static | 116 // static |
107 void InterfaceProviderJsWrapper::ClearContext( | 117 void InterfaceProviderJsWrapper::ClearContext( |
108 const v8::WeakCallbackInfo<InterfaceProviderJsWrapper>& data) { | 118 const v8::WeakCallbackInfo<InterfaceProviderJsWrapper>& data) { |
109 InterfaceProviderJsWrapper* registry = data.GetParameter(); | 119 InterfaceProviderJsWrapper* registry = data.GetParameter(); |
110 registry->context_.Reset(); | 120 registry->context_.Reset(); |
111 } | 121 } |
112 | 122 |
113 } // namespace content | 123 } // namespace content |
OLD | NEW |