Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / app_list / search / app_search_provider.h
blobd2ce5fdaabe21d5cb31a240c04c1c8be51dc3bfd
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;
16 class Profile;
18 namespace base {
19 class Clock;
22 namespace extensions {
23 class ExtensionRegistry;
24 class ExtensionSet;
27 namespace app_list {
29 class AppListItemList;
31 namespace test {
32 class AppSearchProviderTest;
35 class AppSearchProvider : public SearchProvider,
36 public extensions::ExtensionRegistryObserver {
37 public:
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;
46 void Stop() override;
48 private:
49 class App;
50 typedef ScopedVector<App> Apps;
52 void UpdateResults();
54 // Adds extensions to apps container if they should be displayed.
55 void AddApps(const extensions::ExtensionSet& extensions);
56 void RefreshApps();
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;
65 Profile* profile_;
66 AppListControllerDelegate* list_controller_;
68 base::string16 query_;
70 ScopedObserver<extensions::ExtensionRegistry,
71 extensions::ExtensionRegistryObserver>
72 extension_registry_observer_;
74 Apps apps_;
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_