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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLPlugInElement.h

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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights 4 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights
5 * reserved. 5 * reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 class CORE_EXPORT HTMLPlugInElement : public HTMLFrameOwnerElement { 44 class CORE_EXPORT HTMLPlugInElement : public HTMLFrameOwnerElement {
45 public: 45 public:
46 ~HTMLPlugInElement() override; 46 ~HTMLPlugInElement() override;
47 DECLARE_VIRTUAL_TRACE(); 47 DECLARE_VIRTUAL_TRACE();
48 48
49 void resetInstance(); 49 void resetInstance();
50 // TODO(dcheng): Consider removing this, since HTMLEmbedElementLegacyCall 50 // TODO(dcheng): Consider removing this, since HTMLEmbedElementLegacyCall
51 // and HTMLObjectElementLegacyCall usage is extremely low. 51 // and HTMLObjectElementLegacyCall usage is extremely low.
52 SharedPersistent<v8::Object>* pluginWrapper(); 52 SharedPersistent<v8::Object>* pluginWrapper();
53 // TODO(joelhockey): Clean up pluginWidget and plugin (maybe also
54 // pluginWrapper). It would be good to remove and/or rename some of these.
55 // pluginWidget and plugin both return the plugin that is stored on this
56 // element. However pluginWidget will synchronously create the plugin if
57 // required by calling layoutPartForJSBindings. Possibly the pluginWidget
58 // code can be inlined into pluginWrapper.
53 PluginView* pluginWidget() const; 59 PluginView* pluginWidget() const;
60 PluginView* plugin() const;
54 bool canProcessDrag() const; 61 bool canProcessDrag() const;
55 const String& url() const { return m_url; } 62 const String& url() const { return m_url; }
56 63
57 // Public for FrameView::addPartToUpdate() 64 // Public for FrameView::addPartToUpdate()
58 bool needsPluginUpdate() const { return m_needsPluginUpdate; } 65 bool needsPluginUpdate() const { return m_needsPluginUpdate; }
59 void setNeedsPluginUpdate(bool needsPluginUpdate) { 66 void setNeedsPluginUpdate(bool needsPluginUpdate) {
60 m_needsPluginUpdate = needsPluginUpdate; 67 m_needsPluginUpdate = needsPluginUpdate;
61 } 68 }
62 void updatePlugin(); 69 void updatePlugin();
63 70
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 bool requireLayoutObject); 159 bool requireLayoutObject);
153 // Perform checks after we have determined that a plugin will be used to 160 // Perform checks after we have determined that a plugin will be used to
154 // show the object (i.e after allowedToLoadObject). 161 // show the object (i.e after allowedToLoadObject).
155 bool allowedToLoadPlugin(const KURL&, const String& mimeType); 162 bool allowedToLoadPlugin(const KURL&, const String& mimeType);
156 // Perform checks based on the URL and MIME-type of the object to load. 163 // Perform checks based on the URL and MIME-type of the object to load.
157 bool allowedToLoadObject(const KURL&, const String& mimeType); 164 bool allowedToLoadObject(const KURL&, const String& mimeType);
158 bool wouldLoadAsNetscapePlugin(const String& url, const String& serviceType); 165 bool wouldLoadAsNetscapePlugin(const String& url, const String& serviceType);
159 166
160 void setPlugin(PluginView*); 167 void setPlugin(PluginView*);
161 PluginView* releasePlugin(); 168 PluginView* releasePlugin();
162 PluginView* ownedPlugin() const;
163 void setPersistedPlugin(PluginView*); 169 void setPersistedPlugin(PluginView*);
164 170
165 bool requestObjectInternal(const String& url, 171 bool requestObjectInternal(const String& url,
166 const String& mimeType, 172 const String& mimeType,
167 const Vector<String>& paramNames, 173 const Vector<String>& paramNames,
168 const Vector<String>& paramValues); 174 const Vector<String>& paramValues);
169 175
170 mutable RefPtr<SharedPersistent<v8::Object>> m_pluginWrapper; 176 mutable RefPtr<SharedPersistent<v8::Object>> m_pluginWrapper;
171 bool m_needsPluginUpdate; 177 bool m_needsPluginUpdate;
172 bool m_shouldPreferPlugInsForImages; 178 bool m_shouldPreferPlugInsForImages;
173 // Represents |layoutObject() && layoutObject()->isEmbeddedObject() && 179 // Represents |layoutObject() && layoutObject()->isEmbeddedObject() &&
174 // !layoutEmbeddedItem().showsUnavailablePluginIndicator()|. We want to 180 // !layoutEmbeddedItem().showsUnavailablePluginIndicator()|. We want to
175 // avoid accessing |layoutObject()| in layoutObjectIsFocusable(). 181 // avoid accessing |layoutObject()| in layoutObjectIsFocusable().
176 bool m_pluginIsAvailable = false; 182 bool m_pluginIsAvailable = false;
177 183
184 Member<PluginView> m_plugin;
178 // Normally the plugin is stored in HTMLFrameOwnerElement::m_widget. 185 // Normally the plugin is stored in HTMLFrameOwnerElement::m_widget.
179 // However, plugins can persist even when not rendered. In order to 186 // However, plugins can persist even when not rendered. In order to
180 // prevent confusing code which may assume that ownedWidget() != null 187 // prevent confusing code which may assume that ownedWidget() != null
181 // means the frame is active, we save off m_widget here while 188 // means the frame is active, we save off m_widget here while
182 // the plugin is persisting but not being displayed. 189 // the plugin is persisting but not being displayed.
183 Member<PluginView> m_persistedPlugin; 190 Member<PluginView> m_persistedPlugin;
184 }; 191 };
185 192
186 inline bool isHTMLPlugInElement(const HTMLElement& element) { 193 inline bool isHTMLPlugInElement(const HTMLElement& element) {
187 return element.isPluginElement(); 194 return element.isPluginElement();
188 } 195 }
189 196
190 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLPlugInElement); 197 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLPlugInElement);
191 198
192 } // namespace blink 199 } // namespace blink
193 200
194 #endif // HTMLPlugInElement_h 201 #endif // HTMLPlugInElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698