| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "web/WebHelperPluginImpl.h" | 31 #include "web/WebHelperPluginImpl.h" |
| 32 | 32 |
| 33 #include "core/frame/LocalFrameClient.h" | 33 #include "core/frame/LocalFrameClient.h" |
| 34 #include "core/frame/WebLocalFrameBase.h" |
| 34 #include "core/html/HTMLObjectElement.h" | 35 #include "core/html/HTMLObjectElement.h" |
| 35 #include "core/loader/FrameLoader.h" | 36 #include "core/loader/FrameLoader.h" |
| 36 #include "public/web/WebPlugin.h" | 37 #include "public/web/WebPlugin.h" |
| 37 #include "web/WebLocalFrameImpl.h" | |
| 38 #include "web/WebPluginContainerImpl.h" | 38 #include "web/WebPluginContainerImpl.h" |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 DEFINE_TYPE_CASTS(WebHelperPluginImpl, WebHelperPlugin, plugin, true, true); | 42 DEFINE_TYPE_CASTS(WebHelperPluginImpl, WebHelperPlugin, plugin, true, true); |
| 43 | 43 |
| 44 WebHelperPlugin* WebHelperPlugin::Create(const WebString& plugin_type, | 44 WebHelperPlugin* WebHelperPlugin::Create(const WebString& plugin_type, |
| 45 WebLocalFrame* frame) { | 45 WebLocalFrame* frame) { |
| 46 WebHelperPluginUniquePtr plugin(new WebHelperPluginImpl()); | 46 WebHelperPluginUniquePtr plugin(new WebHelperPluginImpl()); |
| 47 if (!ToWebHelperPluginImpl(plugin.get()) | 47 if (!ToWebHelperPluginImpl(plugin.get()) |
| 48 ->Initialize(plugin_type, ToWebLocalFrameImpl(frame))) | 48 ->Initialize(plugin_type, ToWebLocalFrameBase(frame))) |
| 49 return 0; | 49 return 0; |
| 50 return plugin.release(); | 50 return plugin.release(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 WebHelperPluginImpl::WebHelperPluginImpl() | 53 WebHelperPluginImpl::WebHelperPluginImpl() |
| 54 : destruction_timer_(this, &WebHelperPluginImpl::ReallyDestroy) {} | 54 : destruction_timer_(this, &WebHelperPluginImpl::ReallyDestroy) {} |
| 55 | 55 |
| 56 bool WebHelperPluginImpl::Initialize(const String& plugin_type, | 56 bool WebHelperPluginImpl::Initialize(const String& plugin_type, |
| 57 WebLocalFrameImpl* frame) { | 57 WebLocalFrameBase* frame) { |
| 58 DCHECK(!object_element_ && !plugin_container_); | 58 DCHECK(!object_element_ && !plugin_container_); |
| 59 if (!frame->GetFrame()->Loader().Client()) | 59 if (!frame->GetFrame()->Loader().Client()) |
| 60 return false; | 60 return false; |
| 61 | 61 |
| 62 object_element_ = | 62 object_element_ = |
| 63 HTMLObjectElement::Create(*frame->GetFrame()->GetDocument(), false); | 63 HTMLObjectElement::Create(*frame->GetFrame()->GetDocument(), false); |
| 64 Vector<String> attribute_names; | 64 Vector<String> attribute_names; |
| 65 Vector<String> attribute_values; | 65 Vector<String> attribute_values; |
| 66 DCHECK(frame->GetFrame()->GetDocument()->Url().IsValid()); | 66 DCHECK(frame->GetFrame()->GetDocument()->Url().IsValid()); |
| 67 plugin_container_ = ToWebPluginContainerImpl( | 67 plugin_container_ = ToWebPluginContainerImpl( |
| (...skipping 26 matching lines...) Expand all Loading... |
| 94 destruction_timer_.StartOneShot(0, BLINK_FROM_HERE); | 94 destruction_timer_.StartOneShot(0, BLINK_FROM_HERE); |
| 95 } | 95 } |
| 96 | 96 |
| 97 WebPlugin* WebHelperPluginImpl::GetPlugin() { | 97 WebPlugin* WebHelperPluginImpl::GetPlugin() { |
| 98 DCHECK(plugin_container_); | 98 DCHECK(plugin_container_); |
| 99 DCHECK(plugin_container_->Plugin()); | 99 DCHECK(plugin_container_->Plugin()); |
| 100 return plugin_container_->Plugin(); | 100 return plugin_container_->Plugin(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace blink | 103 } // namespace blink |
| OLD | NEW |