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

Side by Side Diff: src/shared/ContentType.cpp

Issue 5316782940225536: Issue 1557 - Update to the recent libadblockplus to reduce additional updates in the logic later. (Closed)
Patch Set: fix accoring to comments Created Jan. 13, 2015, 12:59 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
« src/plugin/AdblockPlusClient.cpp ('K') | « src/shared/ContentType.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include "ContentType.h"
2
3 // Based on impl from libadblockplus
Eric 2015/01/13 17:29:36 Again, why not just use the existing implementatio
sergei 2015/01/28 13:44:45 I've tried it and the size is indeed suspiciously
Oleksandr 2015/01/29 15:36:30 While I personally agree that it would be best to
4
5 using AdblockPlus::FilterEngine;
6
7 namespace
8 {
9 typedef std::map<FilterEngine::ContentType, std::string> ContentTypeMap;
10 ContentTypeMap CreateContentTypeMap()
11 {
12 ContentTypeMap contentTypes;
13 contentTypes[FilterEngine::CONTENT_TYPE_OTHER] = "OTHER";
14 contentTypes[FilterEngine::CONTENT_TYPE_SCRIPT] = "SCRIPT";
15 contentTypes[FilterEngine::CONTENT_TYPE_IMAGE] = "IMAGE";
16 contentTypes[FilterEngine::CONTENT_TYPE_STYLESHEET] = "STYLESHEET";
17 contentTypes[FilterEngine::CONTENT_TYPE_OBJECT] = "OBJECT";
18 contentTypes[FilterEngine::CONTENT_TYPE_SUBDOCUMENT] = "SUBDOCUMENT";
19 contentTypes[FilterEngine::CONTENT_TYPE_DOCUMENT] = "DOCUMENT";
20 contentTypes[FilterEngine::CONTENT_TYPE_XMLHTTPREQUEST] = "XMLHTTPREQUEST";
21 contentTypes[FilterEngine::CONTENT_TYPE_OBJECT_SUBREQUEST] = "OBJECT_SUBREQU EST";
22 contentTypes[FilterEngine::CONTENT_TYPE_FONT] = "FONT";
23 contentTypes[FilterEngine::CONTENT_TYPE_MEDIA] = "MEDIA";
24 contentTypes[FilterEngine::CONTENT_TYPE_ELEMHIDE] = "ELEMHIDE";
25 return contentTypes;
26 }
27 const ContentTypeMap g_contentTypes = CreateContentTypeMap();
28 }
29
30 std::string ContentTypeToString(AdblockPlus::FilterEngine::ContentType contentTy pe)
31 {
32 ContentTypeMap::const_iterator it = g_contentTypes.find(contentType);
33 if (it != g_contentTypes.end())
34 return it->second;
35 throw std::invalid_argument("Argument is not a valid ContentType");
36 }
OLDNEW
« src/plugin/AdblockPlusClient.cpp ('K') | « src/shared/ContentType.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld