Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: third_party/WebKit/Source/core/html/PluginDocument.cpp

Issue 2764313002: Move plugins to be stored in HTMLPlugInElement. (Closed)
Patch Set: Update comments about duplicating code Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 16 matching lines...) Expand all
27 #include "bindings/core/v8/ExceptionState.h" 27 #include "bindings/core/v8/ExceptionState.h"
28 #include "core/HTMLNames.h" 28 #include "core/HTMLNames.h"
29 #include "core/dom/RawDataDocumentParser.h" 29 #include "core/dom/RawDataDocumentParser.h"
30 #include "core/frame/FrameView.h" 30 #include "core/frame/FrameView.h"
31 #include "core/frame/LocalFrame.h" 31 #include "core/frame/LocalFrame.h"
32 #include "core/frame/LocalFrameClient.h" 32 #include "core/frame/LocalFrameClient.h"
33 #include "core/frame/UseCounter.h" 33 #include "core/frame/UseCounter.h"
34 #include "core/html/HTMLBodyElement.h" 34 #include "core/html/HTMLBodyElement.h"
35 #include "core/html/HTMLEmbedElement.h" 35 #include "core/html/HTMLEmbedElement.h"
36 #include "core/html/HTMLHtmlElement.h" 36 #include "core/html/HTMLHtmlElement.h"
37 #include "core/html/HTMLPlugInElement.h"
37 #include "core/layout/LayoutEmbeddedObject.h" 38 #include "core/layout/LayoutEmbeddedObject.h"
38 #include "core/loader/DocumentLoader.h" 39 #include "core/loader/DocumentLoader.h"
39 #include "core/loader/FrameLoader.h" 40 #include "core/loader/FrameLoader.h"
40 #include "core/plugins/PluginView.h" 41 #include "core/plugins/PluginView.h"
41 42
42 namespace blink { 43 namespace blink {
43 44
44 using namespace HTMLNames; 45 using namespace HTMLNames;
45 46
46 // FIXME: Share more code with MediaDocumentParser. 47 // FIXME: Share more code with MediaDocumentParser.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 UseCounter::count(*this, UseCounter::PluginDocument); 169 UseCounter::count(*this, UseCounter::PluginDocument);
169 if (!isInMainFrame()) 170 if (!isInMainFrame())
170 UseCounter::count(*this, UseCounter::PluginDocumentInFrame); 171 UseCounter::count(*this, UseCounter::PluginDocumentInFrame);
171 } 172 }
172 173
173 DocumentParser* PluginDocument::createParser() { 174 DocumentParser* PluginDocument::createParser() {
174 return PluginDocumentParser::create(this); 175 return PluginDocumentParser::create(this);
175 } 176 }
176 177
177 PluginView* PluginDocument::pluginView() { 178 PluginView* PluginDocument::pluginView() {
178 if (m_pluginNode && m_pluginNode->layoutObject()) { 179 return m_pluginNode && isHTMLPlugInElement(m_pluginNode)
haraken 2017/04/05 12:34:00 Add TODO: Change the type of m_pluginNode to HTMLP
joelhockey 2017/04/05 22:10:31 Ack
179 CHECK(m_pluginNode->layoutObject()->isEmbeddedObject()); 180 ? toHTMLPlugInElement(m_pluginNode)->plugin()
180 FrameViewBase* frameViewBase = 181 : nullptr;
181 toLayoutEmbeddedObject(m_pluginNode->layoutObject())->frameViewBase();
182 if (!frameViewBase || !frameViewBase->isPluginContainer())
183 return nullptr;
184 return toPluginView(frameViewBase);
185 }
186 return 0;
187 } 182 }
188 183
189 Node* PluginDocument::pluginNode() { 184 Node* PluginDocument::pluginNode() {
190 return m_pluginNode.get(); 185 return m_pluginNode.get();
191 } 186 }
192 187
193 void PluginDocument::shutdown() { 188 void PluginDocument::shutdown() {
194 // Release the plugin node so that we don't have a circular reference. 189 // Release the plugin node so that we don't have a circular reference.
195 m_pluginNode = nullptr; 190 m_pluginNode = nullptr;
196 HTMLDocument::shutdown(); 191 HTMLDocument::shutdown();
197 } 192 }
198 193
199 DEFINE_TRACE(PluginDocument) { 194 DEFINE_TRACE(PluginDocument) {
200 visitor->trace(m_pluginNode); 195 visitor->trace(m_pluginNode);
201 HTMLDocument::trace(visitor); 196 HTMLDocument::trace(visitor);
202 } 197 }
203 198
204 } // namespace blink 199 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698