| 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 <cstdint> | 20 #include <cstdint> |
| 21 #include <vector> | 21 #include <vector> |
| 22 | 22 |
| 23 #include "../base.h" |
| 23 #include "../bindings/runtime.h" | 24 #include "../bindings/runtime.h" |
| 24 #include "../filter/Filter.h" | 25 #include "../filter/Filter.h" |
| 25 #include "../Md5.h" | |
| 26 #include "../StringMap.h" | 26 #include "../StringMap.h" |
| 27 #include "Subscription.h" | 27 #include "Subscription.h" |
| 28 |
| 29 ABP_NS_BEGIN |
| 28 | 30 |
| 29 class String; | 31 class String; |
| 30 class DownloadableSubscription_Parser; | 32 class DownloadableSubscription_Parser; |
| 31 | 33 |
| 32 class DownloadableSubscription : public Subscription | 34 class DownloadableSubscription : public Subscription |
| 33 { | 35 { |
| 34 public: | 36 public: |
| 35 static constexpr Type classType = Type::DOWNLOADABLE; | 37 static constexpr Type classType = Type::DOWNLOADABLE; |
| 36 explicit DownloadableSubscription(const String& id); | 38 explicit DownloadableSubscription(const String& id); |
| 37 | 39 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 66 | 68 |
| 67 typedef intrusive_ptr<DownloadableSubscription> DownloadableSubscriptionPtr; | 69 typedef intrusive_ptr<DownloadableSubscription> DownloadableSubscriptionPtr; |
| 68 | 70 |
| 69 class DownloadableSubscription_Parser : public ref_counted | 71 class DownloadableSubscription_Parser : public ref_counted |
| 70 { | 72 { |
| 71 std::vector<OwnedString> mFiltersText; | 73 std::vector<OwnedString> mFiltersText; |
| 72 OwnedStringMap<OwnedString> mParams; | 74 OwnedStringMap<OwnedString> mParams; |
| 73 public: | 75 public: |
| 74 DownloadableSubscription_Parser(); | 76 DownloadableSubscription_Parser(); |
| 75 bool BINDINGS_EXPORTED Process(const String& buffer); | 77 bool BINDINGS_EXPORTED Process(const String& buffer); |
| 76 bool BINDINGS_EXPORTED VerifyChecksum(); | |
| 77 // return the expiration interval. | 78 // return the expiration interval. |
| 78 int64_t BINDINGS_EXPORTED Finalize(DownloadableSubscription&); | 79 int64_t BINDINGS_EXPORTED Finalize(DownloadableSubscription&); |
| 79 const String& BINDINGS_EXPORTED GetRedirect() const; | 80 const String& BINDINGS_EXPORTED GetRedirect() const; |
| 80 const String& BINDINGS_EXPORTED GetHomepage() const; | 81 const String& BINDINGS_EXPORTED GetHomepage() const; |
| 81 const String& BINDINGS_EXPORTED GetError() const | 82 const String& BINDINGS_EXPORTED GetError() const |
| 82 { | 83 { |
| 83 return mError; | 84 return mError; |
| 84 } | 85 } |
| 85 private: | 86 private: |
| 86 MD5 mChecksum; | |
| 87 DependentString mError; | 87 DependentString mError; |
| 88 OwnedString mRequiredVersion; | 88 OwnedString mRequiredVersion; |
| 89 OwnedString mB64Checksum; | |
| 90 static int64_t ParseExpires(const String& expires); | 89 static int64_t ParseExpires(const String& expires); |
| 91 bool ProcessFirstLine(const String& line); | 90 bool ProcessFirstLine(const String& line); |
| 92 void ProcessLine(const String& line); | 91 void ProcessLine(const String& line); |
| 93 static bool GetNextLine(DependentString& buffer, DependentString& line); | 92 static bool GetNextLine(DependentString& buffer, DependentString& line); |
| 94 }; | 93 }; |
| 95 | 94 |
| 95 ABP_NS_END |
| LEFT | RIGHT |