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/scoped_observer.h"
11 #include "extensions/browser/extension_registry_observer.h"
12 #include "ui/app_list/search_provider.h"
14 class AppListControllerDelegate
;
17 namespace extensions
{
18 class ExtensionRegistry
;
25 class AppSearchProviderTest
;
28 class AppSearchProvider
: public SearchProvider
,
29 public extensions::ExtensionRegistryObserver
{
31 AppSearchProvider(Profile
* profile
,
32 AppListControllerDelegate
* list_controller
);
33 virtual ~AppSearchProvider();
35 // SearchProvider overrides:
36 virtual void Start(const base::string16
& query
) override
;
37 virtual void Stop() override
;
41 typedef ScopedVector
<App
> Apps
;
43 friend test::AppSearchProviderTest
;
45 void StartImpl(const base::Time
& current_time
, const base::string16
& query
);
47 // Adds extensions to apps container if they should be displayed.
48 void AddApps(const extensions::ExtensionSet
& extensions
);
51 // extensions::ExtensionRegistryObserver overrides:
52 virtual void OnExtensionLoaded(
53 content::BrowserContext
* browser_context
,
54 const extensions::Extension
* extension
) override
;
55 virtual void OnExtensionUninstalled(
56 content::BrowserContext
* browser_context
,
57 const extensions::Extension
* extension
,
58 extensions::UninstallReason reason
) override
;
61 AppListControllerDelegate
* list_controller_
;
63 ScopedObserver
<extensions::ExtensionRegistry
,
64 extensions::ExtensionRegistryObserver
>
65 extension_registry_observer_
;
69 DISALLOW_COPY_AND_ASSIGN(AppSearchProvider
);
72 } // namespace app_list
74 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_