Refactoring proxy, part 2

This commit is contained in:
bao-qian
2016-06-19 16:18:43 +01:00
parent 764a372e9f
commit 3efeb4a0a6
41 changed files with 98 additions and 146 deletions

View File

@@ -6,24 +6,18 @@ namespace Wox.Plugin.WebSearch.SuggestionSources
public abstract class SuggestionSource
{
public virtual string Domain { get; set; }
public IHttpProxy Proxy { get; set; }
public SuggestionSource(IHttpProxy httpProxy)
{
Proxy = httpProxy;
}
public abstract Task<List<string>> GetSuggestions(string query);
public static SuggestionSource GetSuggestionSource(string name, PluginInitContext context)
public static SuggestionSource GetSuggestionSource(string name)
{
switch (name.ToLower())
{
case "google":
return new Google(context.Proxy);
return new Google();
case "baidu":
return new Baidu(context.Proxy);
return new Baidu();
default:
return null;