Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 #pragma once | 18 #pragma once |
19 | 19 |
20 #include <vector> | 20 #include <vector> |
21 | 21 |
22 #include "bindings/runtime.h" | 22 #include "bindings/runtime.h" |
23 #include "intrusive_ptr.h" | 23 #include "intrusive_ptr.h" |
24 #include "filter/ElemHideBase.h" | 24 #include "filter/ElemHideBase.h" |
25 | |
26 class ElemHide; | |
25 | 27 |
26 class ElemHideEmulation_FilterList : public ref_counted | 28 class ElemHideEmulation_FilterList : public ref_counted |
27 { | 29 { |
28 std::vector<ElemHideBasePtr> mFilters; | 30 std::vector<ElemHideBasePtr> mFilters; |
29 public: | 31 public: |
30 size_t BINDINGS_EXPORTED GetFilterCount() const | 32 size_t BINDINGS_EXPORTED GetFilterCount() const |
31 { | 33 { |
32 return mFilters.size(); | 34 return mFilters.size(); |
33 } | 35 } |
34 | 36 |
(...skipping 10 matching lines...) Expand all Loading... | |
45 { | 47 { |
46 mFilters.push_back(filter); | 48 mFilters.push_back(filter); |
47 } | 49 } |
48 | 50 |
49 }; | 51 }; |
50 | 52 |
51 class ElemHideEmulation : public ref_counted | 53 class ElemHideEmulation : public ref_counted |
52 { | 54 { |
53 StringMap<ElemHideBasePtr> mFilters; | 55 StringMap<ElemHideBasePtr> mFilters; |
54 | 56 |
55 static ElemHideEmulation* mInstance; | |
sergei
2018/01/25 16:04:01
Could you please turn it into non-singleton?
hub
2018/01/25 19:05:27
Ah yes, I was meaning to the same as for ElemHide.
| |
56 | |
57 public: | 57 public: |
58 static ElemHideEmulation* BINDINGS_EXPORTED GetInstance() | 58 static ElemHideEmulation* BINDINGS_EXPORTED Create() |
59 { | 59 { |
60 return mInstance; | 60 return new ElemHideEmulation(); |
61 } | 61 } |
62 | 62 |
63 void BINDINGS_EXPORTED Add(ElemHideBase&); | 63 void BINDINGS_EXPORTED Add(ElemHideBase&); |
64 void BINDINGS_EXPORTED Remove(ElemHideBase&); | 64 void BINDINGS_EXPORTED Remove(ElemHideBase&); |
65 void BINDINGS_EXPORTED Clear(); | 65 void BINDINGS_EXPORTED Clear(); |
66 ElemHideEmulation_FilterList* BINDINGS_EXPORTED GetRulesForDomain(DependentStr ing&); | 66 ElemHideEmulation_FilterList* BINDINGS_EXPORTED GetRulesForDomain(const ElemHi de&, DependentString&); |
67 }; | 67 }; |
LEFT | RIGHT |