• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef ATHENA_MAIN_URL_SEARCH_PROVIDER_H_
6 #define ATHENA_MAIN_URL_SEARCH_PROVIDER_H_
7 
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "components/omnibox/autocomplete_input.h"
11 #include "components/omnibox/autocomplete_provider_listener.h"
12 #include "ui/app_list/search_provider.h"
13 
14 class AutocompleteProvider;
15 class TemplateURLService;
16 
17 namespace content {
18 class BrowserContext;
19 }
20 
21 namespace athena {
22 
23 // A sample search provider.
24 class UrlSearchProvider : public app_list::SearchProvider,
25                           public AutocompleteProviderListener {
26  public:
27   UrlSearchProvider(content::BrowserContext* browser_context);
28   virtual ~UrlSearchProvider();
29 
30   // Overridden from app_list::SearchProvider
31   virtual void Start(const base::string16& query) OVERRIDE;
32   virtual void Stop() OVERRIDE;
33 
34   // Overridden from AutocompleteProviderListener
35   virtual void OnProviderUpdate(bool updated_matches) OVERRIDE;
36 
37  private:
38   content::BrowserContext* browser_context_;
39 
40   // TODO(mukai): This should be provided through BrowserContextKeyedService.
41   scoped_ptr<TemplateURLService> template_url_service_;
42 
43   AutocompleteInput input_;
44   scoped_refptr<AutocompleteProvider> provider_;
45 
46   DISALLOW_COPY_AND_ASSIGN(UrlSearchProvider);
47 };
48 
49 }  // namespace athena
50 
51 #endif  // ATHENA_MAIN_URL_SEARCH_PROVIDER_H_
52