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

Side by Side Diff: include/AdblockPlus/FilterEngine.h

Issue 10800079: Implemented update checking functionality (Closed)
Patch Set: Created June 5, 2013, 1:40 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
« no previous file with comments | « no previous file | lib/api.js » ('j') | lib/updater.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 Subscription(JsValuePtr value); 61 Subscription(JsValuePtr value);
62 }; 62 };
63 63
64 typedef std::tr1::shared_ptr<Filter> FilterPtr; 64 typedef std::tr1::shared_ptr<Filter> FilterPtr;
65 typedef std::tr1::shared_ptr<Subscription> SubscriptionPtr; 65 typedef std::tr1::shared_ptr<Subscription> SubscriptionPtr;
66 66
67 class FilterEngine 67 class FilterEngine
68 { 68 {
69 public: 69 public:
70 typedef void(*UpdaterCallback)(const std::string& error);
71
70 explicit FilterEngine(JsEnginePtr jsEngine); 72 explicit FilterEngine(JsEnginePtr jsEngine);
71 JsEnginePtr GetJsEngine() const { return jsEngine; } 73 JsEnginePtr GetJsEngine() const { return jsEngine; }
72 bool IsFirstRun() const; 74 bool IsFirstRun() const;
73 FilterPtr GetFilter(const std::string& text); 75 FilterPtr GetFilter(const std::string& text);
74 SubscriptionPtr GetSubscription(const std::string& url); 76 SubscriptionPtr GetSubscription(const std::string& url);
75 std::vector<FilterPtr> GetListedFilters() const; 77 std::vector<FilterPtr> GetListedFilters() const;
76 std::vector<SubscriptionPtr> GetListedSubscriptions() const; 78 std::vector<SubscriptionPtr> GetListedSubscriptions() const;
77 std::vector<SubscriptionPtr> FetchAvailableSubscriptions() const; 79 std::vector<SubscriptionPtr> FetchAvailableSubscriptions() const;
78 FilterPtr Matches(const std::string& url, 80 FilterPtr Matches(const std::string& url,
79 const std::string& contentType, 81 const std::string& contentType,
80 const std::string& documentUrl) const; 82 const std::string& documentUrl) const;
81 std::vector<std::string> GetElementHidingSelectors(const std::string& domain ) const; 83 std::vector<std::string> GetElementHidingSelectors(const std::string& domain ) const;
82 JsValuePtr GetPref(const std::string& pref) const; 84 JsValuePtr GetPref(const std::string& pref) const;
83 void SetPref(const std::string& pref, JsValuePtr value); 85 void SetPref(const std::string& pref, JsValuePtr value);
86 void ForceUpdateCheck(UpdaterCallback callback = 0);
Felix Dahlke 2013/06/05 15:47:36 I suppose you considered using an std::function he
Wladimir Palant 2013/06/05 18:58:21 No, I somehow forgot about that option. Works fine
84 87
85 private: 88 private:
86 JsEnginePtr jsEngine; 89 JsEnginePtr jsEngine;
87 bool initialized; 90 bool initialized;
88 bool firstRun; 91 bool firstRun;
92 int updateCheckId;
89 93
90 void InitDone(JsValueList& params); 94 void InitDone(JsValueList& params);
95 void UpdateCheckDone(std::string eventName, UpdaterCallback callback, JsValu eList& params);
Felix Dahlke 2013/06/05 15:47:36 Any reason why eventName is not a const string ref
Wladimir Palant 2013/06/05 18:58:21 I had concerns where that reference would point to
91 }; 96 };
92 } 97 }
93 98
94 #endif 99 #endif
OLDNEW
« no previous file with comments | « no previous file | lib/api.js » ('j') | lib/updater.js » ('J')

Powered by Google App Engine
This is Rietveld