| 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/renderer/render_frame.h" | 7 #include "content/public/renderer/render_frame.h" |
| 8 | 8 |
| 9 namespace plugins { | 9 namespace plugins { |
| 10 | 10 |
| 11 gin::WrapperInfo PluginPlaceholder::kWrapperInfo = {gin::kEmbedderNativeGin}; | 11 gin::WrapperInfo PluginPlaceholder::kWrapperInfo = {gin::kEmbedderNativeGin}; |
| 12 | 12 |
| 13 PluginPlaceholder::PluginPlaceholder(content::RenderFrame* render_frame, | 13 PluginPlaceholder::PluginPlaceholder(content::RenderFrame* render_frame, |
| 14 blink::WebLocalFrame* frame, | 14 blink::WebLocalFrame* frame, |
| 15 const blink::WebPluginParams& params, | 15 const blink::WebPluginParams& params, |
| 16 const std::string& html_data, | 16 const std::string& html_data, |
| 17 GURL placeholderDataUrl) | 17 GURL placeholderDataUrl) |
| 18 : content::RenderFrameObserver(render_frame), | 18 : content::RenderFrameObserver(render_frame), |
| 19 frame_(frame), | 19 frame_(frame), |
| 20 plugin_params_(params), | 20 plugin_params_(params), |
| 21 plugin_(WebViewPlugin::Create(this, | 21 plugin_(WebViewPlugin::Create(this, |
| 22 render_frame->GetWebkitPreferences(), | 22 render_frame->GetWebkitPreferences(), |
| 23 html_data, | 23 html_data, |
| 24 placeholderDataUrl)) { | 24 placeholderDataUrl)) { |
| 25 DCHECK(placeholderDataUrl.is_valid()) |
| 26 << "Blink requires the placeholder to have a valid URL."; |
| 25 } | 27 } |
| 26 | 28 |
| 27 PluginPlaceholder::~PluginPlaceholder() {} | 29 PluginPlaceholder::~PluginPlaceholder() {} |
| 28 | 30 |
| 29 const blink::WebPluginParams& PluginPlaceholder::GetPluginParams() const { | 31 const blink::WebPluginParams& PluginPlaceholder::GetPluginParams() const { |
| 30 return plugin_params_; | 32 return plugin_params_; |
| 31 } | 33 } |
| 32 | 34 |
| 33 void PluginPlaceholder::ShowContextMenu(const blink::WebMouseEvent& event) { | 35 void PluginPlaceholder::ShowContextMenu(const blink::WebMouseEvent& event) { |
| 34 // Does nothing by default. Will be overridden if a specific browser wants | 36 // Does nothing by default. Will be overridden if a specific browser wants |
| 35 // a context menu. | 37 // a context menu. |
| 36 return; | 38 return; |
| 37 } | 39 } |
| 38 | 40 |
| 39 void PluginPlaceholder::PluginDestroyed() { | 41 void PluginPlaceholder::PluginDestroyed() { |
| 40 plugin_ = NULL; | 42 plugin_ = NULL; |
| 41 } | 43 } |
| 42 | 44 |
| 43 void PluginPlaceholder::OnDestruct() { | 45 void PluginPlaceholder::OnDestruct() { |
| 44 frame_ = NULL; | 46 frame_ = NULL; |
| 45 } | 47 } |
| 46 | 48 |
| 47 blink::WebLocalFrame* PluginPlaceholder::GetFrame() { return frame_; } | 49 blink::WebLocalFrame* PluginPlaceholder::GetFrame() { return frame_; } |
| 48 | 50 |
| 49 } // namespace plugins | 51 } // namespace plugins |
| OLD | NEW |