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

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

Issue 2258033002: Replace ASSERT()s with DCHECK*() in core/html/*.{cpp,h}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace ASSERT()s with DCHECK*() in core/html/*.{cpp,h}. Created 4 years, 4 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 * (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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // this delay is unnecessary, but it is simpler to make both classes share 77 // this delay is unnecessary, but it is simpler to make both classes share
78 // the same codepath in this class. 78 // the same codepath in this class.
79 , m_needsWidgetUpdate(!createdByParser) 79 , m_needsWidgetUpdate(!createdByParser)
80 , m_shouldPreferPlugInsForImages(preferPlugInsForImagesOption == ShouldPrefe rPlugInsForImages) 80 , m_shouldPreferPlugInsForImages(preferPlugInsForImagesOption == ShouldPrefe rPlugInsForImages)
81 { 81 {
82 } 82 }
83 83
84 HTMLPlugInElement::~HTMLPlugInElement() 84 HTMLPlugInElement::~HTMLPlugInElement()
85 { 85 {
86 DCHECK(!m_pluginWrapper); // cleared in detachLayoutTree() 86 DCHECK(!m_pluginWrapper); // cleared in detachLayoutTree()
87 ASSERT(!m_isDelayingLoadEvent); 87 DCHECK(!m_isDelayingLoadEvent);
88 } 88 }
89 89
90 DEFINE_TRACE(HTMLPlugInElement) 90 DEFINE_TRACE(HTMLPlugInElement)
91 { 91 {
92 visitor->trace(m_imageLoader); 92 visitor->trace(m_imageLoader);
93 visitor->trace(m_persistedPluginWidget); 93 visitor->trace(m_persistedPluginWidget);
94 HTMLFrameOwnerElement::trace(visitor); 94 HTMLFrameOwnerElement::trace(visitor);
95 } 95 }
96 96
97 void HTMLPlugInElement::setPersistedPluginWidget(Widget* widget) 97 void HTMLPlugInElement::setPersistedPluginWidget(Widget* widget)
98 { 98 {
99 if (m_persistedPluginWidget == widget) 99 if (m_persistedPluginWidget == widget)
100 return; 100 return;
101 if (m_persistedPluginWidget) { 101 if (m_persistedPluginWidget) {
102 if (m_persistedPluginWidget->isPluginView()) { 102 if (m_persistedPluginWidget->isPluginView()) {
103 m_persistedPluginWidget->hide(); 103 m_persistedPluginWidget->hide();
104 disposeWidgetSoon(m_persistedPluginWidget.release()); 104 disposeWidgetSoon(m_persistedPluginWidget.release());
105 } else { 105 } else {
106 ASSERT(m_persistedPluginWidget->isFrameView() || m_persistedPluginWi dget->isRemoteFrameView()); 106 DCHECK(m_persistedPluginWidget->isFrameView() || m_persistedPluginWi dget->isRemoteFrameView());
107 } 107 }
108 } 108 }
109 m_persistedPluginWidget = widget; 109 m_persistedPluginWidget = widget;
110 } 110 }
111 111
112 bool HTMLPlugInElement::requestObjectInternal(const String& url, const String& m imeType, const Vector<String>& paramNames, const Vector<String>& paramValues) 112 bool HTMLPlugInElement::requestObjectInternal(const String& url, const String& m imeType, const Vector<String>& paramNames, const Vector<String>& paramValues)
113 { 113 {
114 if (url.isEmpty() && mimeType.isEmpty()) 114 if (url.isEmpty() && mimeType.isEmpty())
115 return false; 115 return false;
116 116
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 return; 227 return;
228 228
229 if (layoutObject() && layoutObject()->isLayoutPart()) 229 if (layoutObject() && layoutObject()->isLayoutPart())
230 return; 230 return;
231 231
232 createPluginWithoutLayoutObject(); 232 createPluginWithoutLayoutObject();
233 } 233 }
234 234
235 void HTMLPlugInElement::createPluginWithoutLayoutObject() 235 void HTMLPlugInElement::createPluginWithoutLayoutObject()
236 { 236 {
237 ASSERT(document().frame()->loader().client()->canCreatePluginWithoutRenderer (m_serviceType)); 237 DCHECK(document().frame()->loader().client()->canCreatePluginWithoutRenderer (m_serviceType));
238 238
239 KURL url; 239 KURL url;
240 // CSP can block src-less objects. 240 // CSP can block src-less objects.
241 if (!allowedToLoadObject(url, m_serviceType)) 241 if (!allowedToLoadObject(url, m_serviceType))
242 return; 242 return;
243 243
244 Vector<String> paramNames; 244 Vector<String> paramNames;
245 Vector<String> paramValues; 245 Vector<String> paramValues;
246 246
247 paramNames.append("type"); 247 paramNames.append("type");
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 if (contentFrame() && protocolIsJavaScript(completeURL) 467 if (contentFrame() && protocolIsJavaScript(completeURL)
468 && !document().getSecurityOrigin()->canAccess(contentFrame()->securityCo ntext()->getSecurityOrigin())) 468 && !document().getSecurityOrigin()->canAccess(contentFrame()->securityCo ntext()->getSecurityOrigin()))
469 return false; 469 return false;
470 return document().frame()->isURLAllowed(completeURL); 470 return document().frame()->isURLAllowed(completeURL);
471 } 471 }
472 472
473 // We don't use m_url, or m_serviceType as they may not be the final values 473 // We don't use m_url, or m_serviceType as they may not be the final values
474 // that <object> uses depending on <param> values. 474 // that <object> uses depending on <param> values.
475 bool HTMLPlugInElement::wouldLoadAsNetscapePlugin(const String& url, const Strin g& serviceType) 475 bool HTMLPlugInElement::wouldLoadAsNetscapePlugin(const String& url, const Strin g& serviceType)
476 { 476 {
477 ASSERT(document().frame()); 477 DCHECK(document().frame());
478 KURL completedURL; 478 KURL completedURL;
479 if (!url.isEmpty()) 479 if (!url.isEmpty())
480 completedURL = document().completeURL(url); 480 completedURL = document().completeURL(url);
481 return document().frame()->loader().client()->getObjectContentType(completed URL, serviceType, shouldPreferPlugInsForImages()) == ObjectContentNetscapePlugin ; 481 return document().frame()->loader().client()->getObjectContentType(completed URL, serviceType, shouldPreferPlugInsForImages()) == ObjectContentNetscapePlugin ;
482 } 482 }
483 483
484 bool HTMLPlugInElement::requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues) 484 bool HTMLPlugInElement::requestObject(const String& url, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues)
485 { 485 {
486 bool result = requestObjectInternal(url, mimeType, paramNames, paramValues); 486 bool result = requestObjectInternal(url, mimeType, paramNames, paramValues);
487 487
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 616
617 void HTMLPlugInElement::lazyReattachIfNeeded() 617 void HTMLPlugInElement::lazyReattachIfNeeded()
618 { 618 {
619 if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() && !isIma geType()) { 619 if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() && !isIma geType()) {
620 lazyReattachIfAttached(); 620 lazyReattachIfAttached();
621 setPersistedPluginWidget(nullptr); 621 setPersistedPluginWidget(nullptr);
622 } 622 }
623 } 623 }
624 624
625 } // namespace blink 625 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698