OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/shell/renderer/layout_test/test_plugin_placeholder.h" | |
6 | |
7 #include "gin/handle.h" | |
8 #include "third_party/WebKit/public/web/WebKit.h" | |
9 | |
10 namespace content { | |
11 | |
12 TestPluginPlaceholder::TestPluginPlaceholder( | |
13 RenderFrame* render_frame, | |
14 blink::WebLocalFrame* frame, | |
15 const blink::WebPluginParams& params) | |
16 : PluginPlaceholder(render_frame, | |
17 frame, | |
18 params, | |
19 "<div>Test content</div>", | |
20 GURL("http://www.test.com")) { | |
21 } | |
22 | |
23 void TestPluginPlaceholder::BindWebFrame(blink::WebFrame* frame) { | |
24 v8::Isolate* isolate = blink::mainThreadIsolate(); | |
25 v8::HandleScope handle_scope(isolate); | |
26 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); | |
27 DCHECK(!context.IsEmpty()); | |
28 | |
29 v8::Context::Scope context_scope(context); | |
30 v8::Local<v8::Object> global = context->Global(); | |
31 global->Set(gin::StringToV8(isolate, "plugin"), | |
32 gin::CreateHandle(isolate, this).ToV8()); | |
33 } | |
34 | |
35 } // namespace content | |
OLD | NEW |