| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ATHENA_MAIN_URL_SEARCH_PROVIDER_H_ | 5 #ifndef ATHENA_MAIN_URL_SEARCH_PROVIDER_H_ |
| 6 #define ATHENA_MAIN_URL_SEARCH_PROVIDER_H_ | 6 #define ATHENA_MAIN_URL_SEARCH_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "components/autocomplete/autocomplete_input.h" |
| 10 #include "net/url_request/url_fetcher_delegate.h" |
| 9 #include "ui/app_list/search_provider.h" | 11 #include "ui/app_list/search_provider.h" |
| 10 | 12 |
| 11 class TemplateURLService; | 13 class TemplateURLService; |
| 12 | 14 |
| 13 namespace content { | 15 namespace content { |
| 14 class BrowserContext; | 16 class BrowserContext; |
| 15 } | 17 } |
| 16 | 18 |
| 17 namespace athena { | 19 namespace athena { |
| 18 | 20 |
| 19 // A sample search provider. | 21 // A sample search provider. |
| 20 class UrlSearchProvider : public app_list::SearchProvider { | 22 class UrlSearchProvider : public app_list::SearchProvider, |
| 23 public net::URLFetcherDelegate { |
| 21 public: | 24 public: |
| 22 UrlSearchProvider(content::BrowserContext* browser_context); | 25 UrlSearchProvider(content::BrowserContext* browser_context); |
| 23 virtual ~UrlSearchProvider(); | 26 virtual ~UrlSearchProvider(); |
| 24 | 27 |
| 25 // Overridden from app_list::SearchProvider | 28 // Overridden from app_list::SearchProvider |
| 26 virtual void Start(const base::string16& query) OVERRIDE; | 29 virtual void Start(const base::string16& query) OVERRIDE; |
| 27 virtual void Stop() OVERRIDE; | 30 virtual void Stop() OVERRIDE; |
| 28 | 31 |
| 32 // Overridden from net::URLFetcherDelegate. |
| 33 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
| 34 |
| 29 private: | 35 private: |
| 36 void StartFetchingSuggestions(); |
| 37 |
| 30 content::BrowserContext* browser_context_; | 38 content::BrowserContext* browser_context_; |
| 31 | 39 |
| 32 // TODO(mukai): This should be provided through BrowserContextKeyedService. | 40 // TODO(mukai): This should be provided through BrowserContextKeyedService. |
| 33 scoped_ptr<TemplateURLService> template_url_service_; | 41 scoped_ptr<TemplateURLService> template_url_service_; |
| 34 | 42 |
| 43 AutocompleteInput input_; |
| 44 scoped_ptr<net::URLFetcher> suggestion_fetcher_; |
| 45 bool should_fetch_suggestions_again_; |
| 46 |
| 35 DISALLOW_COPY_AND_ASSIGN(UrlSearchProvider); | 47 DISALLOW_COPY_AND_ASSIGN(UrlSearchProvider); |
| 36 }; | 48 }; |
| 37 | 49 |
| 38 } // namespace athena | 50 } // namespace athena |
| 39 | 51 |
| 40 #endif // ATHENA_MAIN_URL_SEARCH_PROVIDER_H_ | 52 #endif // ATHENA_MAIN_URL_SEARCH_PROVIDER_H_ |
| OLD | NEW |