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

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

Issue 5948518908821504: Issue #1158 - removed unnecessary definitions and #ifdef/#else/#endif sections (Closed)
Patch Set: Created Aug. 6, 2014, 7:38 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« src/plugin/PluginTabBase.cpp ('K') | « src/plugin/PluginTabBase.cpp ('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 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginWbPassThrough.h" 3 #include "PluginWbPassThrough.h"
4 #include "PluginClient.h" 4 #include "PluginClient.h"
5 #include "PluginClientFactory.h" 5 #include "PluginClientFactory.h"
6 #ifdef SUPPORT_FILTER
7 #include "PluginFilter.h" 6 #include "PluginFilter.h"
8 #endif
9 #include "PluginSettings.h" 7 #include "PluginSettings.h"
10 #include "PluginClass.h" 8 #include "PluginClass.h"
11 #include "PluginSystem.h" 9 #include "PluginSystem.h"
12 10
13 #include "wtypes.h" 11 #include "wtypes.h"
14 12
15 EXTERN_C IMAGE_DOS_HEADER __ImageBase; 13 EXTERN_C IMAGE_DOS_HEADER __ImageBase;
16 14
17 15
18 16
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 { 150 {
153 boundDomain.SetString(domainRetrieved); 151 boundDomain.SetString(domainRetrieved);
154 } 152 }
155 } 153 }
156 } 154 }
157 155
158 CString cookie; 156 CString cookie;
159 ULONG len1 = 2048; 157 ULONG len1 = 2048;
160 ULONG len2 = 2048; 158 ULONG len2 = 2048;
161 159
162 #ifdef SUPPORT_FILTER
163 int contentType = CFilter::contentTypeAny; 160 int contentType = CFilter::contentTypeAny;
164 161
165 CPluginTab* tab = CPluginClass::GetTab(::GetCurrentThreadId()); 162 CPluginTab* tab = CPluginClass::GetTab(::GetCurrentThreadId());
166 CPluginClient* client = CPluginClient::GetInstance(); 163 CPluginClient* client = CPluginClient::GetInstance();
167 164
168 165
169 if (tab && client) 166 if (tab && client)
170 { 167 {
171 CString documentUrl = tab->GetDocumentUrl(); 168 CString documentUrl = tab->GetDocumentUrl();
172 // Page is identical to document => don't block 169 // Page is identical to document => don't block
173 if (documentUrl == src) 170 if (documentUrl == src)
174 { 171 {
175 // fall through 172 // fall through
176 } 173 }
177 else if (CPluginSettings::GetInstance()->IsPluginEnabled() && !client->IsWhi telistedUrl(std::wstring(documentUrl))) 174 else if (CPluginSettings::GetInstance()->IsPluginEnabled() && !client->IsWhi telistedUrl(std::wstring(documentUrl)))
178 { 175 {
179 boundDomain = tab->GetDocumentUrl(); 176 boundDomain = tab->GetDocumentUrl();
180
181 contentType = CFilter::contentTypeAny; 177 contentType = CFilter::contentTypeAny;
182
183 #ifdef SUPPORT_FRAME_CACHING
184 if ((tab != 0) && (tab->IsFrameCached(src))) 178 if ((tab != 0) && (tab->IsFrameCached(src)))
185 { 179 {
186 contentType = CFilter::contentTypeSubdocument; 180 contentType = CFilter::contentTypeSubdocument;
187 } 181 }
188 else 182 else
189 #endif // SUPPORT_FRAME_CACHING 183 {
190 contentType = GetContentType(mimeType, boundDomain, src); 184 contentType = GetContentType(mimeType, boundDomain, src);
185 }
191 if (client->ShouldBlock(src, contentType, boundDomain, true)) 186 if (client->ShouldBlock(src, contentType, boundDomain, true))
192 { 187 {
193 isBlocked = true; 188 isBlocked = true;
194
195 DEBUG_BLOCKER("Blocker::Blocking Http-request:" + src); 189 DEBUG_BLOCKER("Blocker::Blocking Http-request:" + src);
196 } 190 }
197 } 191 }
198 if (!isBlocked) 192 if (!isBlocked)
199 { 193 {
200 DEBUG_BLOCKER("Blocker::Ignoring Http-request:" + src) 194 DEBUG_BLOCKER("Blocker::Ignoring Http-request:" + src)
201 } 195 }
202 } 196 }
203 197
204 198
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 272 }
279 if ((isBlocked)) 273 if ((isBlocked))
280 { 274 {
281 m_shouldBlock = true; 275 m_shouldBlock = true;
282 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTa rgetProtocol); 276 BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, dwReserved, pTa rgetProtocol);
283 m_spInternetProtocolSink->ReportResult(S_FALSE, 0, L""); 277 m_spInternetProtocolSink->ReportResult(S_FALSE, 0, L"");
284 278
285 return INET_E_REDIRECT_FAILED; 279 return INET_E_REDIRECT_FAILED;
286 } 280 }
287 } 281 }
288 #endif // SUPPORT_FILTER
289
290 return isBlocked ? S_FALSE : BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInf o, grfPI, dwReserved, pTargetProtocol); 282 return isBlocked ? S_FALSE : BaseClass::OnStart(szUrl, pOIProtSink, pOIBindInf o, grfPI, dwReserved, pTargetProtocol);
291 } 283 }
292 284
293 285
294 HRESULT WBPassthruSink::Read(void *pv, ULONG cb, ULONG* pcbRead) 286 HRESULT WBPassthruSink::Read(void *pv, ULONG cb, ULONG* pcbRead)
295 { 287 {
296 if (m_shouldBlock) 288 if (m_shouldBlock)
297 { 289 {
298 *pcbRead = 0; 290 *pcbRead = 0;
299 if (!m_lastDataReported) 291 if (!m_lastDataReported)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI, 387 return OnStart(szUrl, pOIProtSink, pOIBindInfo, grfPI,
396 dwReserved, m_spInternetProtocol); 388 dwReserved, m_spInternetProtocol);
397 } 389 }
398 390
399 STDMETHODIMP WBPassthru::Read( /* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [out] */ ULONG *pcbRead) 391 STDMETHODIMP WBPassthru::Read( /* [in, out] */ void *pv,/* [in] */ ULONG cb,/* [out] */ ULONG *pcbRead)
400 { 392 {
401 393
402 WBPassthruSink* pSink = GetSink(); 394 WBPassthruSink* pSink = GetSink();
403 return pSink->Read(pv, cb, pcbRead); 395 return pSink->Read(pv, cb, pcbRead);
404 } 396 }
OLDNEW
« src/plugin/PluginTabBase.cpp ('K') | « src/plugin/PluginTabBase.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld