| Index: include/AdblockPlus/ReferrerMapping.h |
| =================================================================== |
| --- a/include/AdblockPlus/ReferrerMapping.h |
| +++ b/include/AdblockPlus/ReferrerMapping.h |
| @@ -22,14 +22,14 @@ |
| #include <map> |
| #include <string> |
| #include <vector> |
| +#include "FilterEngine.h" |
| 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(). |
| + * This can be used to build a frame structure for any URL |
| + * (see `BuildFrameStructure()`), it's useful for FilterEngine::Matches(). |
| */ |
| class ReferrerMapping |
| { |
| @@ -46,20 +46,31 @@ |
| * Records the refferer for a URL. |
| * @param url Request URL. |
| * @param referrer Request referrer. |
| + * @param requestType Request type. |
| */ |
| - void Add(const std::string& url, const std::string& referrer); |
| + void Add(const std::string& url, const std::string& referrer, |
| + FilterEngine::ContentType requestType); |
| /** |
| - * Builds a chain of referrers for the supplied URL. |
| + * Builds a frame structure 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`. |
| + * @return List of URLs, finishing with `url`. |
| */ |
| - std::vector<std::string> BuildReferrerChain(const std::string& url) const; |
| + std::vector<std::string> BuildFrameStructure(const std::string& url) const; |
| private: |
| const int maxCachedUrls; |
| - std::map<std::string, std::string> mapping; |
| + struct RequestInfo |
| + { |
| + RequestInfo(const std::string& referrerArg, FilterEngine::ContentType typeArg) |
| + : referrer(referrerArg) , type(typeArg) |
| + { |
| + } |
| + std::string referrer; |
| + FilterEngine::ContentType type; |
|
Wladimir Palant
2014/11/25 15:46:37
It is unnecessary to store the actual type here -
sergei
2014/11/26 10:34:43
I would use `isFrame` because it's not necessary t
|
| + }; |
| + std::map</*url*/std::string, RequestInfo> mapping; |
|
Wladimir Palant
2014/11/25 15:46:37
How about |using URL = std::string| so that you ca
sergei
2014/11/26 10:34:43
Added typedef for `Url` and `Urls`.
|
| std::list<std::string> cachedUrls; |
| }; |
| } |