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

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

Issue 6505394822184960: Issue 1109 - Support notifications (Closed)
Patch Set: Created May 11, 2015, 10:01 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
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 11 matching lines...) Expand all
22 #include "PluginClient.h" 22 #include "PluginClient.h"
23 #include "PluginClientFactory.h" 23 #include "PluginClientFactory.h"
24 #include "PluginMutex.h" 24 #include "PluginMutex.h"
25 #include "PluginSettings.h" 25 #include "PluginSettings.h"
26 #include "PluginSystem.h" 26 #include "PluginSystem.h"
27 #include "PluginClass.h" 27 #include "PluginClass.h"
28 #include "mlang.h" 28 #include "mlang.h"
29 29
30 #include "..\shared\CriticalSection.h" 30 #include "..\shared\CriticalSection.h"
31 #include "..\shared\Utils.h" 31 #include "..\shared\Utils.h"
32 #include "..\shared\MsHTMLUtils.h"
32 33
33 // The filters are described at http://adblockplus.org/en/filters 34 // The filters are described at http://adblockplus.org/en/filters
34 35
35 static CriticalSection s_criticalSectionFilterMap; 36 static CriticalSection s_criticalSectionFilterMap;
36 37
37 namespace
38 {
39 struct GetHtmlElementAttributeResult
40 {
41 GetHtmlElementAttributeResult() : isAttributeFound(false)
42 {
43 }
44 std::wstring attributeValue;
45 bool isAttributeFound;
46 };
47
48 GetHtmlElementAttributeResult GetHtmlElementAttribute(IHTMLElement& htmlElemen t,
49 const ATL::CComBSTR& attributeName)
50 {
51 GetHtmlElementAttributeResult retValue;
52 ATL::CComVariant vAttr;
53 ATL::CComPtr<IHTMLElement4> htmlElement4;
54 if (FAILED(htmlElement.QueryInterface(&htmlElement4)) || !htmlElement4)
55 {
56 return retValue;
57 }
58 ATL::CComPtr<IHTMLDOMAttribute> attributeNode;
59 if (FAILED(htmlElement4->getAttributeNode(attributeName, &attributeNode)) || !attributeNode)
60 {
61 return retValue;
62 }
63 // we set that attribute found but it's not necessary that we can retrieve i ts value
64 retValue.isAttributeFound = true;
65 if (FAILED(attributeNode->get_nodeValue(&vAttr)))
66 {
67 return retValue;
68 }
69 if (vAttr.vt == VT_BSTR && vAttr.bstrVal)
70 {
71 retValue.attributeValue = vAttr.bstrVal;
72 }
73 else if (vAttr.vt == VT_I4)
74 {
75 retValue.attributeValue = std::to_wstring(vAttr.iVal);
76 }
77 return retValue;
78 }
79 }
80
81 // ============================================================================ 38 // ============================================================================
82 // CFilterElementHideAttrSelector 39 // CFilterElementHideAttrSelector
83 // ============================================================================ 40 // ============================================================================
84 41
85 CFilterElementHideAttrSelector::CFilterElementHideAttrSelector() : m_type(TYPE_N ONE), m_pos(POS_NONE), m_bstrAttr(NULL) 42 CFilterElementHideAttrSelector::CFilterElementHideAttrSelector() : m_type(TYPE_N ONE), m_pos(POS_NONE), m_bstrAttr(NULL)
86 { 43 {
87 } 44 }
88 45
89 CFilterElementHideAttrSelector::CFilterElementHideAttrSelector(const CFilterElem entHideAttrSelector& filter) 46 CFilterElementHideAttrSelector::CFilterElementHideAttrSelector(const CFilterElem entHideAttrSelector& filter)
90 { 47 {
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 } 687 }
731 #endif 688 #endif
732 return result; 689 return result;
733 } 690 }
734 691
735 const std::vector<std::wstring>& CPluginFilter::GetHideFilters() const 692 const std::vector<std::wstring>& CPluginFilter::GetHideFilters() const
736 { 693 {
737 DWORD res = WaitForSingleObject(hideFiltersLoadedEvent, ENGINE_STARTUP_TIMEOUT ); 694 DWORD res = WaitForSingleObject(hideFiltersLoadedEvent, ENGINE_STARTUP_TIMEOUT );
738 return m_hideFilters; 695 return m_hideFilters;
739 } 696 }
OLDNEW

Powered by Google App Engine
This is Rietveld