OLD | NEW |
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 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) | 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) |
5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. | 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. |
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 28 matching lines...) Expand all Loading... |
39 #include "core/html/PluginDocument.h" | 39 #include "core/html/PluginDocument.h" |
40 #include "core/input/EventHandler.h" | 40 #include "core/input/EventHandler.h" |
41 #include "core/inspector/ConsoleMessage.h" | 41 #include "core/inspector/ConsoleMessage.h" |
42 #include "core/layout/LayoutImage.h" | 42 #include "core/layout/LayoutImage.h" |
43 #include "core/layout/LayoutPart.h" | 43 #include "core/layout/LayoutPart.h" |
44 #include "core/layout/api/LayoutEmbeddedItem.h" | 44 #include "core/layout/api/LayoutEmbeddedItem.h" |
45 #include "core/loader/MixedContentChecker.h" | 45 #include "core/loader/MixedContentChecker.h" |
46 #include "core/page/Page.h" | 46 #include "core/page/Page.h" |
47 #include "core/page/scrolling/ScrollingCoordinator.h" | 47 #include "core/page/scrolling/ScrollingCoordinator.h" |
48 #include "core/plugins/PluginView.h" | 48 #include "core/plugins/PluginView.h" |
49 #include "platform/FrameViewBase.h" | |
50 #include "platform/Histogram.h" | 49 #include "platform/Histogram.h" |
51 #include "platform/loader/fetch/ResourceRequest.h" | 50 #include "platform/loader/fetch/ResourceRequest.h" |
52 #include "platform/network/mime/MIMETypeFromURL.h" | 51 #include "platform/network/mime/MIMETypeFromURL.h" |
53 #include "platform/network/mime/MIMETypeRegistry.h" | 52 #include "platform/network/mime/MIMETypeRegistry.h" |
54 #include "platform/plugins/PluginData.h" | 53 #include "platform/plugins/PluginData.h" |
55 #include "public/platform/WebURLRequest.h" | 54 #include "public/platform/WebURLRequest.h" |
56 | 55 |
57 namespace blink { | 56 namespace blink { |
58 | 57 |
59 using namespace HTMLNames; | 58 using namespace HTMLNames; |
(...skipping 10 matching lines...) Expand all Loading... |
70 | 69 |
71 } // anonymous namespace | 70 } // anonymous namespace |
72 | 71 |
73 HTMLPlugInElement::HTMLPlugInElement( | 72 HTMLPlugInElement::HTMLPlugInElement( |
74 const QualifiedName& tag_name, | 73 const QualifiedName& tag_name, |
75 Document& doc, | 74 Document& doc, |
76 bool created_by_parser, | 75 bool created_by_parser, |
77 PreferPlugInsForImagesOption prefer_plug_ins_for_images_option) | 76 PreferPlugInsForImagesOption prefer_plug_ins_for_images_option) |
78 : HTMLFrameOwnerElement(tag_name, doc), | 77 : HTMLFrameOwnerElement(tag_name, doc), |
79 is_delaying_load_event_(false), | 78 is_delaying_load_event_(false), |
80 // m_needsPluginUpdate(!createdByParser) allows HTMLObjectElement to delay | 79 // needs_plugin_update(!createdByParser) allows HTMLObjectElement to delay |
81 // FrameViewBase updates until after all children are parsed. For | 80 // FrameOrPlugin updates until after all children are parsed. For |
82 // HTMLEmbedElement this delay is unnecessary, but it is simpler to make | 81 // HTMLEmbedElement this delay is unnecessary, but it is simpler to make |
83 // both classes share the same codepath in this class. | 82 // both classes share the same codepath in this class. |
84 needs_plugin_update_(!created_by_parser), | 83 needs_plugin_update_(!created_by_parser), |
85 should_prefer_plug_ins_for_images_(prefer_plug_ins_for_images_option == | 84 should_prefer_plug_ins_for_images_(prefer_plug_ins_for_images_option == |
86 kShouldPreferPlugInsForImages) {} | 85 kShouldPreferPlugInsForImages) {} |
87 | 86 |
88 HTMLPlugInElement::~HTMLPlugInElement() { | 87 HTMLPlugInElement::~HTMLPlugInElement() { |
89 DCHECK(!plugin_wrapper_); // cleared in detachLayoutTree() | 88 DCHECK(!plugin_wrapper_); // cleared in detachLayoutTree() |
90 DCHECK(!is_delaying_load_event_); | 89 DCHECK(!is_delaying_load_event_); |
91 } | 90 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 return false; | 124 return false; |
126 | 125 |
127 KURL completed_url = url.IsEmpty() ? KURL() : GetDocument().CompleteURL(url); | 126 KURL completed_url = url.IsEmpty() ? KURL() : GetDocument().CompleteURL(url); |
128 if (!AllowedToLoadObject(completed_url, mime_type)) | 127 if (!AllowedToLoadObject(completed_url, mime_type)) |
129 return false; | 128 return false; |
130 | 129 |
131 bool use_fallback; | 130 bool use_fallback; |
132 if (!ShouldUsePlugin(completed_url, mime_type, HasFallbackContent(), | 131 if (!ShouldUsePlugin(completed_url, mime_type, HasFallbackContent(), |
133 use_fallback)) { | 132 use_fallback)) { |
134 // If the plugin element already contains a subframe, | 133 // If the plugin element already contains a subframe, |
135 // loadOrRedirectSubframe will re-use it. Otherwise, it will create a | 134 // LoadOrRedirectSubframe will re-use it. Otherwise, it will create a |
136 // new frame and set it as the LayoutPart's FrameViewBase, causing what was | 135 // new frame and set it as the LayoutPart's FrameOrPlugin, causing what was |
137 // previously in the FrameViewBase to be torn down. | 136 // previously in the FrameOrPlugin to be torn down. |
138 return LoadOrRedirectSubframe(completed_url, GetNameAttribute(), true); | 137 return LoadOrRedirectSubframe(completed_url, GetNameAttribute(), true); |
139 } | 138 } |
140 | 139 |
141 return LoadPlugin(completed_url, mime_type, param_names, param_values, | 140 return LoadPlugin(completed_url, mime_type, param_names, param_values, |
142 use_fallback, true); | 141 use_fallback, true); |
143 } | 142 } |
144 | 143 |
145 bool HTMLPlugInElement::CanProcessDrag() const { | 144 bool HTMLPlugInElement::CanProcessDrag() const { |
146 return PluginWidget() && PluginWidget()->CanProcessDrag(); | 145 return PluginWidget() && PluginWidget()->CanProcessDrag(); |
147 } | 146 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 LoadPlugin(url, service_type_, param_names, param_values, use_fallback, | 257 LoadPlugin(url, service_type_, param_names, param_values, use_fallback, |
259 false); | 258 false); |
260 } | 259 } |
261 | 260 |
262 bool HTMLPlugInElement::ShouldAccelerate() const { | 261 bool HTMLPlugInElement::ShouldAccelerate() const { |
263 PluginView* plugin = OwnedPlugin(); | 262 PluginView* plugin = OwnedPlugin(); |
264 return plugin && plugin->PlatformLayer(); | 263 return plugin && plugin->PlatformLayer(); |
265 } | 264 } |
266 | 265 |
267 void HTMLPlugInElement::DetachLayoutTree(const AttachContext& context) { | 266 void HTMLPlugInElement::DetachLayoutTree(const AttachContext& context) { |
268 // Update the FrameViewBase the next time we attach (detaching destroys the | 267 // Update the FrameOrPlugin the next time we attach (detaching destroys the |
269 // plugin). | 268 // plugin). |
270 // FIXME: None of this "needsPluginUpdate" related code looks right. | 269 // FIXME: None of this "NeedsPluginUpdate" related code looks right. |
271 if (GetLayoutObject() && !UseFallbackContent()) | 270 if (GetLayoutObject() && !UseFallbackContent()) |
272 SetNeedsPluginUpdate(true); | 271 SetNeedsPluginUpdate(true); |
273 | 272 |
274 if (is_delaying_load_event_) { | 273 if (is_delaying_load_event_) { |
275 is_delaying_load_event_ = false; | 274 is_delaying_load_event_ = false; |
276 GetDocument().DecrementLoadEventDelayCount(); | 275 GetDocument().DecrementLoadEventDelayCount(); |
277 } | 276 } |
278 | 277 |
279 // Only try to persist a plugin we actually own. | 278 // Only try to persist a plugin we actually own. |
280 PluginView* plugin = OwnedPlugin(); | 279 PluginView* plugin = OwnedPlugin(); |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 | 664 |
666 void HTMLPlugInElement::LazyReattachIfNeeded() { | 665 void HTMLPlugInElement::LazyReattachIfNeeded() { |
667 if (!UseFallbackContent() && NeedsPluginUpdate() && GetLayoutObject() && | 666 if (!UseFallbackContent() && NeedsPluginUpdate() && GetLayoutObject() && |
668 !IsImageType()) { | 667 !IsImageType()) { |
669 LazyReattachIfAttached(); | 668 LazyReattachIfAttached(); |
670 SetPersistedPlugin(nullptr); | 669 SetPersistedPlugin(nullptr); |
671 } | 670 } |
672 } | 671 } |
673 | 672 |
674 } // namespace blink | 673 } // namespace blink |
OLD | NEW |