Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / athena / main / url_search_provider.h
index 6ee8301..632d01a 100644 (file)
@@ -5,8 +5,13 @@
 #ifndef ATHENA_MAIN_URL_SEARCH_PROVIDER_H_
 #define ATHENA_MAIN_URL_SEARCH_PROVIDER_H_
 
+#include "base/memory/scoped_ptr.h"
+#include "components/omnibox/autocomplete_input.h"
+#include "net/url_request/url_fetcher_delegate.h"
 #include "ui/app_list/search_provider.h"
 
+class TemplateURLService;
+
 namespace content {
 class BrowserContext;
 }
@@ -14,7 +19,8 @@ class BrowserContext;
 namespace athena {
 
 // A sample search provider.
-class UrlSearchProvider : public app_list::SearchProvider {
+class UrlSearchProvider : public app_list::SearchProvider,
+                          public net::URLFetcherDelegate {
  public:
   UrlSearchProvider(content::BrowserContext* browser_context);
   virtual ~UrlSearchProvider();
@@ -23,9 +29,21 @@ class UrlSearchProvider : public app_list::SearchProvider {
   virtual void Start(const base::string16& query) OVERRIDE;
   virtual void Stop() OVERRIDE;
 
+  // Overridden from net::URLFetcherDelegate.
+  virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
+
  private:
+  void StartFetchingSuggestions();
+
   content::BrowserContext* browser_context_;
 
+  // TODO(mukai): This should be provided through BrowserContextKeyedService.
+  scoped_ptr<TemplateURLService> template_url_service_;
+
+  AutocompleteInput input_;
+  scoped_ptr<net::URLFetcher> suggestion_fetcher_;
+  bool should_fetch_suggestions_again_;
+
   DISALLOW_COPY_AND_ASSIGN(UrlSearchProvider);
 };