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

Delta Between Two Patch Sets: include/AdblockPlus/FilterEngine.h

Issue 11018003: Filter changed callback (Closed)
Left Patch Set: Filter changed callback Created July 19, 2013, 8:33 a.m.
Right Patch Set: Filter changed callback Created July 22, 2013, 9:16 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | lib/filterUpdateRegistration.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2013 Eyeo GmbH 3 * Copyright (C) 2006-2013 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 Subscription(JsValuePtr value); 62 Subscription(JsValuePtr value);
63 }; 63 };
64 64
65 typedef std::tr1::shared_ptr<Filter> FilterPtr; 65 typedef std::tr1::shared_ptr<Filter> FilterPtr;
66 typedef std::tr1::shared_ptr<Subscription> SubscriptionPtr; 66 typedef std::tr1::shared_ptr<Subscription> SubscriptionPtr;
67 67
68 class FilterEngine 68 class FilterEngine
69 { 69 {
70 public: 70 public:
71 typedef std::tr1::function<void(const std::string&)> UpdaterCallback; 71 typedef std::tr1::function<void(const std::string&)> UpdaterCallback;
72 typedef std::tr1::function<void(const std::string&, const std::string&)> Fil terChangeCallback; 72 typedef std::tr1::function<void(const std::string&, const JsValuePtr)> Filte rChangeCallback;
73 73
74 explicit FilterEngine(JsEnginePtr jsEngine); 74 explicit FilterEngine(JsEnginePtr jsEngine);
75 JsEnginePtr GetJsEngine() const { return jsEngine; } 75 JsEnginePtr GetJsEngine() const { return jsEngine; }
76 bool IsFirstRun() const; 76 bool IsFirstRun() const;
77 FilterPtr GetFilter(const std::string& text); 77 FilterPtr GetFilter(const std::string& text);
78 SubscriptionPtr GetSubscription(const std::string& url); 78 SubscriptionPtr GetSubscription(const std::string& url);
79 std::vector<FilterPtr> GetListedFilters() const; 79 std::vector<FilterPtr> GetListedFilters() const;
80 std::vector<SubscriptionPtr> GetListedSubscriptions() const; 80 std::vector<SubscriptionPtr> GetListedSubscriptions() const;
81 std::vector<SubscriptionPtr> FetchAvailableSubscriptions() const; 81 std::vector<SubscriptionPtr> FetchAvailableSubscriptions() const;
82 FilterPtr Matches(const std::string& url, 82 FilterPtr Matches(const std::string& url,
83 const std::string& contentType, 83 const std::string& contentType,
84 const std::string& documentUrl) const; 84 const std::string& documentUrl) const;
85 std::vector<std::string> GetElementHidingSelectors(const std::string& domain ) const; 85 std::vector<std::string> GetElementHidingSelectors(const std::string& domain ) const;
86 JsValuePtr GetPref(const std::string& pref) const; 86 JsValuePtr GetPref(const std::string& pref) const;
87 void SetPref(const std::string& pref, JsValuePtr value); 87 void SetPref(const std::string& pref, JsValuePtr value);
88 void ForceUpdateCheck(UpdaterCallback callback = 0); 88 void ForceUpdateCheck(UpdaterCallback callback = 0);
89 void SetFilterChangeCallback(FilterChangeCallback callback); 89 void SetFilterChangeCallback(FilterChangeCallback callback);
90 void RemoveFilterChangeCallback(); 90 void RemoveFilterChangeCallback();
91 91
92 private: 92 private:
93 JsEnginePtr jsEngine; 93 JsEnginePtr jsEngine;
94 bool initialized; 94 bool initialized;
95 bool firstRun; 95 bool firstRun;
96 int updateCheckId; 96 int updateCheckId;
97 97
98 void InitDone(JsValueList& params); 98 void InitDone(JsValueList& params);
99 void UpdateCheckDone(const std::string& eventName, UpdaterCallback callback, JsValueList& params); 99 void UpdateCheckDone(const std::string& eventName, UpdaterCallback callback, JsValueList& params);
100 void FilterChanged(const std::string& eventName, FilterChangeCallback callba ck, JsValueList& params); 100 void FilterChanged(FilterChangeCallback callback, JsValueList& params);
101 }; 101 };
102 } 102 }
103 103
104 #endif 104 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld