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 "extensions/renderer/document_custom_bindings.h" | 5 #include "extensions/renderer/document_custom_bindings.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "extensions/renderer/script_context.h" | 10 #include "extensions/renderer/script_context.h" |
11 #include "third_party/WebKit/public/web/WebDocument.h" | 11 #include "third_party/WebKit/public/web/WebDocument.h" |
12 #include "third_party/WebKit/public/web/WebFrame.h" | 12 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
13 #include "v8/include/v8.h" | 13 #include "v8/include/v8.h" |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 | 16 |
17 DocumentCustomBindings::DocumentCustomBindings(ScriptContext* context) | 17 DocumentCustomBindings::DocumentCustomBindings(ScriptContext* context) |
18 : ObjectBackedNativeHandler(context) { | 18 : ObjectBackedNativeHandler(context) { |
19 RouteFunction("RegisterElement", | 19 RouteFunction("RegisterElement", |
20 base::Bind(&DocumentCustomBindings::RegisterElement, | 20 base::Bind(&DocumentCustomBindings::RegisterElement, |
21 base::Unretained(this))); | 21 base::Unretained(this))); |
22 } | 22 } |
(...skipping 10 matching lines...) Expand all Loading... |
33 v8::Local<v8::Object> options = v8::Local<v8::Object>::Cast(args[1]); | 33 v8::Local<v8::Object> options = v8::Local<v8::Object>::Cast(args[1]); |
34 | 34 |
35 blink::WebExceptionCode ec = 0; | 35 blink::WebExceptionCode ec = 0; |
36 blink::WebDocument document = context()->web_frame()->document(); | 36 blink::WebDocument document = context()->web_frame()->document(); |
37 v8::Handle<v8::Value> constructor = document.registerEmbedderCustomElement( | 37 v8::Handle<v8::Value> constructor = document.registerEmbedderCustomElement( |
38 blink::WebString::fromUTF8(element_name), options, ec); | 38 blink::WebString::fromUTF8(element_name), options, ec); |
39 args.GetReturnValue().Set(constructor); | 39 args.GetReturnValue().Set(constructor); |
40 } | 40 } |
41 | 41 |
42 } // namespace extensions | 42 } // namespace extensions |
OLD | NEW |