| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 WebPlugin* WebHelperPluginImpl::getPlugin() | 186 WebPlugin* WebHelperPluginImpl::getPlugin() |
| 187 { | 187 { |
| 188 ASSERT(m_page); | 188 ASSERT(m_page); |
| 189 | 189 |
| 190 RefPtr<NodeList> objectElements = m_page->mainFrame()->document()->getElemen
tsByTagName(WebCore::HTMLNames::objectTag.localName()); | 190 RefPtr<NodeList> objectElements = m_page->mainFrame()->document()->getElemen
tsByTagName(WebCore::HTMLNames::objectTag.localName()); |
| 191 ASSERT(objectElements && objectElements->length() == 1); | 191 ASSERT(objectElements && objectElements->length() == 1); |
| 192 if (!objectElements || objectElements->length() < 1) | 192 if (!objectElements || objectElements->length() < 1) |
| 193 return 0; | 193 return 0; |
| 194 Node* node = objectElements->item(0); | 194 Node* node = objectElements->item(0); |
| 195 ASSERT(node->hasTagName(WebCore::HTMLNames::objectTag)); | 195 ASSERT(node->hasTagName(WebCore::HTMLNames::objectTag)); |
| 196 WebCore::Widget* widget = toHTMLPlugInElement(node)->pluginWidget(); | 196 WebCore::Widget* widget = toHTMLPlugInElement(node)->widget(); |
| 197 if (!widget) | 197 if (!widget) |
| 198 return 0; | 198 return 0; |
| 199 WebPlugin* plugin = toPluginContainerImpl(widget)->plugin(); | 199 WebPlugin* plugin = toPluginContainerImpl(widget)->plugin(); |
| 200 ASSERT(plugin); | 200 ASSERT(plugin); |
| 201 // If the plugin is a placeholder, it is not useful to the caller, and it | 201 // If the plugin is a placeholder, it is not useful to the caller, and it |
| 202 // could be replaced at any time. Therefore, do not return it. | 202 // could be replaced at any time. Therefore, do not return it. |
| 203 if (plugin->isPlaceholder()) | 203 if (plugin->isPlaceholder()) |
| 204 return 0; | 204 return 0; |
| 205 | 205 |
| 206 // The plugin was instantiated and will outlive this object. | 206 // The plugin was instantiated and will outlive this object. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // A WebHelperPluginImpl instance usually has two references. | 268 // A WebHelperPluginImpl instance usually has two references. |
| 269 // - One owned by the instance itself. It represents the visible widget. | 269 // - One owned by the instance itself. It represents the visible widget. |
| 270 // - One owned by the hosting element. It's released when the hosting | 270 // - One owned by the hosting element. It's released when the hosting |
| 271 // element asks the WebHelperPluginImpl to close. | 271 // element asks the WebHelperPluginImpl to close. |
| 272 // We need them because the closing operation is asynchronous and the widget | 272 // We need them because the closing operation is asynchronous and the widget |
| 273 // can be closed while the hosting element is unaware of it. | 273 // can be closed while the hosting element is unaware of it. |
| 274 return adoptRef(new WebHelperPluginImpl(client)).leakRef(); | 274 return adoptRef(new WebHelperPluginImpl(client)).leakRef(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 } // namespace blink | 277 } // namespace blink |
| OLD | NEW |