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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 159 |
160 RefPtr<NodeList> objectElements = m_page->mainFrame()->document()->getElemen
tsByTagName(WebCore::HTMLNames::objectTag.localName()); | 160 RefPtr<NodeList> objectElements = m_page->mainFrame()->document()->getElemen
tsByTagName(WebCore::HTMLNames::objectTag.localName()); |
161 ASSERT(objectElements && objectElements->length() == 1); | 161 ASSERT(objectElements && objectElements->length() == 1); |
162 if (!objectElements || objectElements->length() < 1) | 162 if (!objectElements || objectElements->length() < 1) |
163 return 0; | 163 return 0; |
164 Node* node = objectElements->item(0); | 164 Node* node = objectElements->item(0); |
165 ASSERT(node->hasTagName(WebCore::HTMLNames::objectTag)); | 165 ASSERT(node->hasTagName(WebCore::HTMLNames::objectTag)); |
166 WebCore::Widget* widget = toHTMLPlugInElement(node)->pluginWidget(); | 166 WebCore::Widget* widget = toHTMLPlugInElement(node)->pluginWidget(); |
167 if (!widget) | 167 if (!widget) |
168 return 0; | 168 return 0; |
169 WebPlugin* plugin = static_cast<WebPluginContainerImpl*>(widget)->plugin(); | 169 WebPlugin* plugin = toPluginContainerImpl(widget)->plugin(); |
170 ASSERT(plugin); | 170 ASSERT(plugin); |
171 // If the plugin is a placeholder, it is not useful to the caller, and it | 171 // If the plugin is a placeholder, it is not useful to the caller, and it |
172 // could be replaced at any time. Therefore, do not return it. | 172 // could be replaced at any time. Therefore, do not return it. |
173 if (plugin->isPlaceholder()) | 173 if (plugin->isPlaceholder()) |
174 return 0; | 174 return 0; |
175 | 175 |
176 // The plugin was instantiated and will outlive this object. | 176 // The plugin was instantiated and will outlive this object. |
177 return plugin; | 177 return plugin; |
178 } | 178 } |
179 | 179 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // A WebHelperPluginImpl instance usually has two references. | 241 // A WebHelperPluginImpl instance usually has two references. |
242 // - One owned by the instance itself. It represents the visible widget. | 242 // - One owned by the instance itself. It represents the visible widget. |
243 // - One owned by the hosting element. It's released when the hosting | 243 // - One owned by the hosting element. It's released when the hosting |
244 // element asks the WebHelperPluginImpl to close. | 244 // element asks the WebHelperPluginImpl to close. |
245 // We need them because the closing operation is asynchronous and the widget | 245 // We need them because the closing operation is asynchronous and the widget |
246 // can be closed while the hosting element is unaware of it. | 246 // can be closed while the hosting element is unaware of it. |
247 return adoptRef(new WebHelperPluginImpl(client)).leakRef(); | 247 return adoptRef(new WebHelperPluginImpl(client)).leakRef(); |
248 } | 248 } |
249 | 249 |
250 } // namespace WebKit | 250 } // namespace WebKit |
OLD | NEW |