2015-01-03 15:20:34 +08:00
|
|
|
|
using System.Collections.Generic;
|
2014-03-27 16:56:50 +08:00
|
|
|
|
|
2015-01-03 15:20:34 +08:00
|
|
|
|
namespace Wox.Plugin.WebSearch.SuggestionSources
|
2014-03-27 16:56:50 +08:00
|
|
|
|
{
|
2016-05-05 23:08:44 +08:00
|
|
|
|
public abstract class SuggestionSource
|
2014-03-27 16:56:50 +08:00
|
|
|
|
{
|
2016-05-05 23:08:44 +08:00
|
|
|
|
public virtual string Domain { get; set; }
|
2015-02-20 21:14:15 +08:00
|
|
|
|
public IHttpProxy Proxy { get; set; }
|
|
|
|
|
|
2016-05-05 23:08:44 +08:00
|
|
|
|
public SuggestionSource(IHttpProxy httpProxy)
|
2015-02-20 21:14:15 +08:00
|
|
|
|
{
|
|
|
|
|
Proxy = httpProxy;
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-27 16:56:50 +08:00
|
|
|
|
public abstract List<string> GetSuggestions(string query);
|
2016-05-05 23:08:44 +08:00
|
|
|
|
|
|
|
|
|
public static SuggestionSource GetSuggestionSource(string name, PluginInitContext context)
|
|
|
|
|
{
|
|
|
|
|
switch (name.ToLower())
|
|
|
|
|
{
|
|
|
|
|
case "google":
|
|
|
|
|
return new Google(context.Proxy);
|
|
|
|
|
|
|
|
|
|
case "baidu":
|
|
|
|
|
return new Baidu(context.Proxy);
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-03-27 16:56:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|