| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/plugins/renderer/plugin_placeholder.h" | 5 #include "components/plugins/renderer/plugin_placeholder.h" |
| 6 | 6 |
| 7 #include "content/public/common/web_preferences.h" |
| 7 #include "content/public/renderer/render_frame.h" | 8 #include "content/public/renderer/render_frame.h" |
| 8 | 9 |
| 9 namespace plugins { | 10 namespace plugins { |
| 10 | 11 |
| 11 gin::WrapperInfo PluginPlaceholder::kWrapperInfo = {gin::kEmbedderNativeGin}; | 12 gin::WrapperInfo PluginPlaceholder::kWrapperInfo = {gin::kEmbedderNativeGin}; |
| 12 | 13 |
| 13 PluginPlaceholder::PluginPlaceholder(content::RenderFrame* render_frame, | 14 PluginPlaceholder::PluginPlaceholder(content::RenderFrame* render_frame, |
| 14 blink::WebLocalFrame* frame, | 15 blink::WebLocalFrame* frame, |
| 15 const blink::WebPluginParams& params, | 16 const blink::WebPluginParams& params, |
| 16 const std::string& html_data, | 17 const std::string& html_data, |
| 17 GURL placeholderDataUrl) | 18 GURL placeholderDataUrl) |
| 18 : content::RenderFrameObserver(render_frame), | 19 : content::RenderFrameObserver(render_frame), |
| 19 frame_(frame), | 20 frame_(frame), |
| 20 plugin_params_(params), | 21 plugin_params_(params), |
| 21 plugin_(WebViewPlugin::Create(this, | 22 plugin_(WebViewPlugin::Create(this, |
| 22 render_frame->GetWebkitPreferences(), | 23 render_frame |
| 24 ? render_frame->GetWebkitPreferences() |
| 25 : content::WebPreferences(), |
| 23 html_data, | 26 html_data, |
| 24 placeholderDataUrl)) { | 27 placeholderDataUrl)) { |
| 25 DCHECK(placeholderDataUrl.is_valid()) | 28 DCHECK(placeholderDataUrl.is_valid()) |
| 26 << "Blink requires the placeholder to have a valid URL."; | 29 << "Blink requires the placeholder to have a valid URL."; |
| 27 } | 30 } |
| 28 | 31 |
| 29 PluginPlaceholder::~PluginPlaceholder() {} | 32 PluginPlaceholder::~PluginPlaceholder() {} |
| 30 | 33 |
| 31 const blink::WebPluginParams& PluginPlaceholder::GetPluginParams() const { | 34 const blink::WebPluginParams& PluginPlaceholder::GetPluginParams() const { |
| 32 return plugin_params_; | 35 return plugin_params_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 47 return v8::Local<v8::Object>(); | 50 return v8::Local<v8::Object>(); |
| 48 } | 51 } |
| 49 | 52 |
| 50 void PluginPlaceholder::OnDestruct() { | 53 void PluginPlaceholder::OnDestruct() { |
| 51 frame_ = NULL; | 54 frame_ = NULL; |
| 52 } | 55 } |
| 53 | 56 |
| 54 blink::WebLocalFrame* PluginPlaceholder::GetFrame() { return frame_; } | 57 blink::WebLocalFrame* PluginPlaceholder::GetFrame() { return frame_; } |
| 55 | 58 |
| 56 } // namespace plugins | 59 } // namespace plugins |
| OLD | NEW |