| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 if (PluginView* view = pluginView()) | 151 if (PluginView* view = pluginView()) |
| 152 view->didReceiveData(data, length); | 152 view->didReceiveData(data, length); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void PluginDocumentParser::finish() { | 155 void PluginDocumentParser::finish() { |
| 156 m_embedElement = nullptr; | 156 m_embedElement = nullptr; |
| 157 RawDataDocumentParser::finish(); | 157 RawDataDocumentParser::finish(); |
| 158 } | 158 } |
| 159 | 159 |
| 160 PluginView* PluginDocumentParser::pluginView() const { | 160 PluginView* PluginDocumentParser::pluginView() const { |
| 161 if (FrameViewBase* frameViewBase = | 161 return toPluginDocument(document())->pluginView(); |
| 162 toPluginDocument(document())->pluginWidget()) { | |
| 163 SECURITY_DCHECK(frameViewBase->isPluginContainer()); | |
| 164 return toPluginView(frameViewBase); | |
| 165 } | |
| 166 return 0; | |
| 167 } | 162 } |
| 168 | 163 |
| 169 PluginDocument::PluginDocument(const DocumentInit& initializer) | 164 PluginDocument::PluginDocument(const DocumentInit& initializer) |
| 170 : HTMLDocument(initializer, PluginDocumentClass) { | 165 : HTMLDocument(initializer, PluginDocumentClass) { |
| 171 setCompatibilityMode(QuirksMode); | 166 setCompatibilityMode(QuirksMode); |
| 172 lockCompatibilityMode(); | 167 lockCompatibilityMode(); |
| 173 UseCounter::count(*this, UseCounter::PluginDocument); | 168 UseCounter::count(*this, UseCounter::PluginDocument); |
| 174 if (!isInMainFrame()) | 169 if (!isInMainFrame()) |
| 175 UseCounter::count(*this, UseCounter::PluginDocumentInFrame); | 170 UseCounter::count(*this, UseCounter::PluginDocumentInFrame); |
| 176 } | 171 } |
| 177 | 172 |
| 178 DocumentParser* PluginDocument::createParser() { | 173 DocumentParser* PluginDocument::createParser() { |
| 179 return PluginDocumentParser::create(this); | 174 return PluginDocumentParser::create(this); |
| 180 } | 175 } |
| 181 | 176 |
| 182 FrameViewBase* PluginDocument::pluginWidget() { | 177 PluginView* PluginDocument::pluginView() { |
| 183 if (m_pluginNode && m_pluginNode->layoutObject()) { | 178 if (m_pluginNode && m_pluginNode->layoutObject()) { |
| 184 CHECK(m_pluginNode->layoutObject()->isEmbeddedObject()); | 179 CHECK(m_pluginNode->layoutObject()->isEmbeddedObject()); |
| 185 FrameViewBase* frameViewBase = | 180 FrameViewBase* frameViewBase = |
| 186 toLayoutEmbeddedObject(m_pluginNode->layoutObject())->frameViewBase(); | 181 toLayoutEmbeddedObject(m_pluginNode->layoutObject())->frameViewBase(); |
| 187 if (!frameViewBase || !frameViewBase->isPluginContainer()) | 182 if (!frameViewBase || !frameViewBase->isPluginContainer()) |
| 188 return nullptr; | 183 return nullptr; |
| 189 return frameViewBase; | 184 return toPluginView(frameViewBase); |
| 190 } | 185 } |
| 191 return 0; | 186 return 0; |
| 192 } | 187 } |
| 193 | 188 |
| 194 Node* PluginDocument::pluginNode() { | 189 Node* PluginDocument::pluginNode() { |
| 195 return m_pluginNode.get(); | 190 return m_pluginNode.get(); |
| 196 } | 191 } |
| 197 | 192 |
| 198 void PluginDocument::shutdown() { | 193 void PluginDocument::shutdown() { |
| 199 // Release the plugin node so that we don't have a circular reference. | 194 // Release the plugin node so that we don't have a circular reference. |
| 200 m_pluginNode = nullptr; | 195 m_pluginNode = nullptr; |
| 201 HTMLDocument::shutdown(); | 196 HTMLDocument::shutdown(); |
| 202 } | 197 } |
| 203 | 198 |
| 204 DEFINE_TRACE(PluginDocument) { | 199 DEFINE_TRACE(PluginDocument) { |
| 205 visitor->trace(m_pluginNode); | 200 visitor->trace(m_pluginNode); |
| 206 HTMLDocument::trace(visitor); | 201 HTMLDocument::trace(visitor); |
| 207 } | 202 } |
| 208 | 203 |
| 209 } // namespace blink | 204 } // namespace blink |
| OLD | NEW |