OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_UI_APP_LIST_SEARCH_OMNIBOX_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_OMNIBOX_PROVIDER_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_OMNIBOX_PROVIDER_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_OMNIBOX_PROVIDER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" | 10 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" |
11 #include "ui/app_list/search_provider.h" | 11 #include "ui/app_list/search_provider.h" |
12 | 12 |
| 13 class AppListControllerDelegate; |
13 class AutocompleteController; | 14 class AutocompleteController; |
14 class AutocompleteResult; | 15 class AutocompleteResult; |
15 class Profile; | 16 class Profile; |
16 | 17 |
17 namespace app_list { | 18 namespace app_list { |
18 | 19 |
19 // OmniboxProvider wraps AutocompleteController to provide omnibox results. | 20 // OmniboxProvider wraps AutocompleteController to provide omnibox results. |
20 class OmniboxProvider : public SearchProvider, | 21 class OmniboxProvider : public SearchProvider, |
21 public AutocompleteControllerDelegate { | 22 public AutocompleteControllerDelegate { |
22 public: | 23 public: |
23 explicit OmniboxProvider(Profile* profile); | 24 explicit OmniboxProvider(Profile* profile, |
| 25 AppListControllerDelegate* list_controller); |
24 virtual ~OmniboxProvider(); | 26 virtual ~OmniboxProvider(); |
25 | 27 |
26 // SearchProvider overrides: | 28 // SearchProvider overrides: |
27 virtual void Start(const base::string16& query) override; | 29 virtual void Start(const base::string16& query) override; |
28 virtual void Stop() override; | 30 virtual void Stop() override; |
29 | 31 |
30 private: | 32 private: |
31 // Populates result list from AutocompleteResult. | 33 // Populates result list from AutocompleteResult. |
32 void PopulateFromACResult(const AutocompleteResult& result); | 34 void PopulateFromACResult(const AutocompleteResult& result); |
33 | 35 |
34 // AutocompleteControllerDelegate overrides: | 36 // AutocompleteControllerDelegate overrides: |
35 virtual void OnResultChanged(bool default_match_changed) override; | 37 virtual void OnResultChanged(bool default_match_changed) override; |
36 | 38 |
37 Profile* profile_; | 39 Profile* profile_; |
| 40 AppListControllerDelegate* list_controller_; |
38 | 41 |
39 // The omnibox AutocompleteController that collects/sorts/dup- | 42 // The omnibox AutocompleteController that collects/sorts/dup- |
40 // eliminates the results as they come in. | 43 // eliminates the results as they come in. |
41 scoped_ptr<AutocompleteController> controller_; | 44 scoped_ptr<AutocompleteController> controller_; |
42 | 45 |
43 DISALLOW_COPY_AND_ASSIGN(OmniboxProvider); | 46 DISALLOW_COPY_AND_ASSIGN(OmniboxProvider); |
44 }; | 47 }; |
45 | 48 |
46 } // namespace app_list | 49 } // namespace app_list |
47 | 50 |
48 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_OMNIBOX_PROVIDER_H_ | 51 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_OMNIBOX_PROVIDER_H_ |
OLD | NEW |