Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginWbPassThrough.cpp

Issue 29331669: Issue 3237 - Whitelisted AFS ad is not shown on netzwelt.de (Closed)
Patch Set: Move subdocument detection to the top. Created Dec. 15, 2015, 2:05 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/plugin/PluginDomTraverserBase.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 } 136 }
137 137
138 WBPassthruSink::WBPassthruSink() 138 WBPassthruSink::WBPassthruSink()
139 : m_currentPositionOfSentPage(0) 139 : m_currentPositionOfSentPage(0)
140 , m_contentType(ContentType::CONTENT_TYPE_OTHER) 140 , m_contentType(ContentType::CONTENT_TYPE_OTHER)
141 , m_isCustomResponse(false) 141 , m_isCustomResponse(false)
142 { 142 {
143 } 143 }
144 144
145 ContentType WBPassthruSink::GetContentTypeFromMimeType(const std::wstring& mimeT ype) 145 ContentType WBPassthruSink::GetContentTypeFromMimeType(const std::wstring& mimeT ype)
Eric 2015/12/15 03:18:18 While not strictly necessary, there are a few thin
sergei 2015/12/15 15:29:31 The same from my side.
146 { 146 {
147 if ((mimeType.find(L"text/html") != std::wstring::npos) ||
148 (mimeType.find(L"application/xhtml+xml") != std::wstring::npos))
149 {
150 return ContentType::CONTENT_TYPE_SUBDOCUMENT;
151 }
147 if (mimeType.find(L"image/") != std::wstring::npos) 152 if (mimeType.find(L"image/") != std::wstring::npos)
148 { 153 {
149 return ContentType::CONTENT_TYPE_IMAGE; 154 return ContentType::CONTENT_TYPE_IMAGE;
150 } 155 }
151 if (mimeType.find(L"text/css") != std::wstring::npos) 156 if (mimeType.find(L"text/css") != std::wstring::npos)
152 { 157 {
153 return ContentType::CONTENT_TYPE_STYLESHEET; 158 return ContentType::CONTENT_TYPE_STYLESHEET;
154 } 159 }
155 if ((mimeType.find(L"application/javascript") != std::wstring::npos) || (mimeT ype.find(L"application/json") != std::wstring::npos)) 160 if ((mimeType.find(L"application/javascript") != std::wstring::npos) || (mimeT ype.find(L"application/json") != std::wstring::npos))
156 { 161 {
157 return ContentType::CONTENT_TYPE_SCRIPT; 162 return ContentType::CONTENT_TYPE_SCRIPT;
158 } 163 }
159 if (mimeType.find(L"application/x-shockwave-flash") != std::wstring::npos) 164 if (mimeType.find(L"application/x-shockwave-flash") != std::wstring::npos)
160 { 165 {
161 return ContentType::CONTENT_TYPE_OBJECT; 166 return ContentType::CONTENT_TYPE_OBJECT;
162 } 167 }
163 if (mimeType.find(L"text/html") != std::wstring::npos)
164 {
165 return ContentType::CONTENT_TYPE_SUBDOCUMENT;
166 }
167 // It is important to have this check last, since it is rather generic, and mi ght overlay text/html, for example 168 // It is important to have this check last, since it is rather generic, and mi ght overlay text/html, for example
168 if (mimeType.find(L"xml") != std::wstring::npos) 169 if (mimeType.find(L"xml") != std::wstring::npos)
169 { 170 {
170 return ContentType::CONTENT_TYPE_XMLHTTPREQUEST; 171 return ContentType::CONTENT_TYPE_XMLHTTPREQUEST;
171 } 172 }
172 173
173 return ContentType::CONTENT_TYPE_OTHER; 174 return ContentType::CONTENT_TYPE_OTHER;
174 } 175 }
175 176
176 ContentType WBPassthruSink::GetContentTypeFromURL(const std::wstring& src) 177 ContentType WBPassthruSink::GetContentTypeFromURL(const std::wstring& src)
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 } 434 }
434 435
435 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne tProtocol); 436 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, m_spInterne tProtocol);
436 } 437 }
437 438
438 STDMETHODIMP WBPassthru::Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [o ut] */ ULONG *pcbRead) 439 STDMETHODIMP WBPassthru::Read(/* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [o ut] */ ULONG *pcbRead)
439 { 440 {
440 WBPassthruSink* pSink = GetSink(); 441 WBPassthruSink* pSink = GetSink();
441 return pSink->OnRead(pv, cb, pcbRead); 442 return pSink->OnRead(pv, cb, pcbRead);
442 } 443 }
OLDNEW
« no previous file with comments | « src/plugin/PluginDomTraverserBase.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld