| 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 blink::WebLocalFrame* frame, |
| 14 const blink::WebPluginParams& params) |
| 15 : PluginPlaceholder(nullptr, |
| 16 frame, |
| 17 params, |
| 18 "<div>Test content</div>", |
| 19 GURL("http://www.test.com")) { |
| 20 } |
| 21 |
| 22 void TestPluginPlaceholder::BindWebFrame(blink::WebFrame* frame) { |
| 23 v8::Isolate* isolate = blink::mainThreadIsolate(); |
| 24 v8::HandleScope handle_scope(isolate); |
| 25 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); |
| 26 DCHECK(!context.IsEmpty()); |
| 27 |
| 28 v8::Context::Scope context_scope(context); |
| 29 v8::Local<v8::Object> global = context->Global(); |
| 30 global->Set(gin::StringToV8(isolate, "plugin"), |
| 31 gin::CreateHandle(isolate, this).ToV8()); |
| 32 } |
| 33 |
| 34 } // namespace content |
| OLD | NEW |