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

Side by Side Diff: src/plugin/PluginUtil.cpp

Issue 5652794446970880: Rely on libadblockplus for domain extraction (Closed)
Patch Set: Use libadblockplus for domain extraction in APP as well Created April 22, 2014, 7:48 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 #include <algorithm> 2 #include <algorithm>
3 #include <stdexcept> 3 #include <stdexcept>
4 #include <vector> 4 #include <vector>
5 5
6 #include "../shared/Utils.h" 6 #include "../shared/Utils.h"
7 #include "PluginUtil.h" 7 #include "PluginUtil.h"
8 #include "PluginSettings.h" 8 #include "PluginSettings.h"
9 9
10 BString::BString(const std::wstring& value) 10 BString::BString(const std::wstring& value)
(...skipping 25 matching lines...) Expand all
36 { 36 {
37 return FileUrl(HtmlFolderPath() + L"firstRun.html"); 37 return FileUrl(HtmlFolderPath() + L"firstRun.html");
38 } 38 }
39 39
40 std::wstring FileUrl(const std::wstring& path) 40 std::wstring FileUrl(const std::wstring& path)
41 { 41 {
42 std::wstring url = path; 42 std::wstring url = path;
43 std::replace(url.begin(), url.end(), L'\\', L'/'); 43 std::replace(url.begin(), url.end(), L'\\', L'/');
44 return L"file:///" + url; 44 return L"file:///" + url;
45 } 45 }
46
47 CString ExtractDomain(const CString& url)
48 {
49 int pos = 0;
50 if (url.Find('/', pos) >= 0)
51 url.Tokenize(L"/", pos);
52 CString domain = url.Tokenize(L"/", pos);
53 domain.MakeLower();
54 return domain;
55 }
OLDNEW

Powered by Google App Engine
This is Rietveld