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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_vector.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/scoped_observer.h"
12 #include "extensions/browser/extension_registry_observer.h"
13 #include "ui/app_list/search_provider.h"
15 class AppListControllerDelegate
;
22 namespace extensions
{
23 class ExtensionRegistry
;
29 class AppListItemList
;
32 class AppSearchProviderTest
;
35 class AppSearchProvider
: public SearchProvider
,
36 public extensions::ExtensionRegistryObserver
{
38 AppSearchProvider(Profile
* profile
,
39 AppListControllerDelegate
* list_controller
,
40 scoped_ptr
<base::Clock
> clock
,
41 AppListItemList
* top_level_item_list
);
42 ~AppSearchProvider() override
;
44 // SearchProvider overrides:
45 void Start(bool is_voice_query
, const base::string16
& query
) override
;
50 typedef ScopedVector
<App
> Apps
;
54 // Adds extensions to apps container if they should be displayed.
55 void AddApps(const extensions::ExtensionSet
& extensions
);
58 // extensions::ExtensionRegistryObserver overrides:
59 void OnExtensionLoaded(content::BrowserContext
* browser_context
,
60 const extensions::Extension
* extension
) override
;
61 void OnExtensionUninstalled(content::BrowserContext
* browser_context
,
62 const extensions::Extension
* extension
,
63 extensions::UninstallReason reason
) override
;
66 AppListControllerDelegate
* list_controller_
;
68 base::string16 query_
;
70 ScopedObserver
<extensions::ExtensionRegistry
,
71 extensions::ExtensionRegistryObserver
>
72 extension_registry_observer_
;
76 AppListItemList
* top_level_item_list_
;
78 scoped_ptr
<base::Clock
> clock_
;
79 base::WeakPtrFactory
<AppSearchProvider
> update_results_factory_
;
81 DISALLOW_COPY_AND_ASSIGN(AppSearchProvider
);
84 } // namespace app_list
86 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_