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

Unified Diff: include/AdblockPlus/ReferrerMapping.h

Issue 5728380594946048: Issue 116 - Document the libadblockplus API (Closed)
Patch Set: Write libadblockplus in lower case consistently Created Sept. 2, 2014, 2:18 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/AdblockPlus/LogSystem.h ('k') | include/AdblockPlus/WebRequest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/AdblockPlus/ReferrerMapping.h
===================================================================
--- a/include/AdblockPlus/ReferrerMapping.h
+++ b/include/AdblockPlus/ReferrerMapping.h
@@ -25,11 +25,36 @@
namespace AdblockPlus
{
+ /**
+ * Stores a mapping between URLs and their referrers.
+ * This can be used to build a chain of referrers for any URL
+ * (see `BuildReferrerChain()`), which approximates the frame structure, see
+ * FilterEngine::Matches().
+ */
class ReferrerMapping
{
public:
+ /**
+ * Constructor.
+ * @param maxCachedUrls Number of URL mappings to store. The higher the
+ * better - clients typically cache requests, and a single cached
+ * request will break the referrer chain.
+ */
ReferrerMapping(const int maxCachedUrls = 5000);
+
+ /**
+ * Records the refferer for a URL.
+ * @param url Request URL.
+ * @param referrer Request referrer.
+ */
void Add(const std::string& url, const std::string& referrer);
+
+ /**
+ * Builds a chain of referrers for the supplied URL.
+ * This should reconstruct a document's parent frame URLs.
+ * @param url URL to build the chain for.
+ * @return List of URLs, starting with `url`.
+ */
std::vector<std::string> BuildReferrerChain(const std::string& url) const;
private:
« no previous file with comments | « include/AdblockPlus/LogSystem.h ('k') | include/AdblockPlus/WebRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld