Chromium Code Reviews| 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_APP_SEARCH_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/scoped_observer.h" | 10 #include "base/scoped_observer.h" |
| 11 #include "extensions/browser/extension_registry_observer.h" | 11 #include "extensions/browser/extension_registry_observer.h" |
| 12 #include "ui/app_list/search_provider.h" | 12 #include "ui/app_list/search_provider.h" |
| 13 | 13 |
| 14 class AppListControllerDelegate; | 14 class AppListControllerDelegate; |
| 15 class Profile; | 15 class Profile; |
| 16 | 16 |
| 17 namespace extensions { | 17 namespace extensions { |
| 18 class ExtensionRegistry; | 18 class ExtensionRegistry; |
| 19 class ExtensionSet; | 19 class ExtensionSet; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace app_list { | 22 namespace app_list { |
|
Matt Giuca
2014/07/23 01:53:19
nit: blank line after this.
calamity
2014/07/28 02:55:27
Done.
| |
| 23 namespace test { | |
| 24 class AppSearchProviderTest; | |
| 25 } | |
| 23 | 26 |
| 24 class AppSearchProvider : public SearchProvider, | 27 class AppSearchProvider : public SearchProvider, |
| 25 public extensions::ExtensionRegistryObserver { | 28 public extensions::ExtensionRegistryObserver { |
| 26 public: | 29 public: |
| 27 AppSearchProvider(Profile* profile, | 30 AppSearchProvider(Profile* profile, |
| 28 AppListControllerDelegate* list_controller); | 31 AppListControllerDelegate* list_controller); |
| 29 virtual ~AppSearchProvider(); | 32 virtual ~AppSearchProvider(); |
| 30 | 33 |
| 31 // SearchProvider overrides: | 34 // SearchProvider overrides: |
| 32 virtual void Start(const base::string16& query) OVERRIDE; | 35 virtual void Start(const base::string16& query) OVERRIDE; |
| 33 virtual void Stop() OVERRIDE; | 36 virtual void Stop() OVERRIDE; |
| 34 | 37 |
| 35 private: | 38 private: |
| 36 class App; | 39 class App; |
| 37 typedef ScopedVector<App> Apps; | 40 typedef ScopedVector<App> Apps; |
| 38 | 41 |
| 42 friend test::AppSearchProviderTest; | |
| 43 | |
| 44 void StartImpl(const base::Time& current_time, const base::string16& query); | |
| 45 | |
| 39 // Adds extensions to apps container if they should be displayed. | 46 // Adds extensions to apps container if they should be displayed. |
| 40 void AddApps(const extensions::ExtensionSet& extensions); | 47 void AddApps(const extensions::ExtensionSet& extensions); |
| 41 void RefreshApps(); | 48 void RefreshApps(); |
| 42 | 49 |
| 43 // extensions::ExtensionRegistryObserver overrides: | 50 // extensions::ExtensionRegistryObserver overrides: |
| 44 virtual void OnExtensionLoaded( | 51 virtual void OnExtensionLoaded( |
| 45 content::BrowserContext* browser_context, | 52 content::BrowserContext* browser_context, |
| 46 const extensions::Extension* extension) OVERRIDE; | 53 const extensions::Extension* extension) OVERRIDE; |
| 47 virtual void OnExtensionUninstalled( | 54 virtual void OnExtensionUninstalled( |
| 48 content::BrowserContext* browser_context, | 55 content::BrowserContext* browser_context, |
| 49 const extensions::Extension* extension) OVERRIDE; | 56 const extensions::Extension* extension) OVERRIDE; |
| 50 | 57 |
| 51 Profile* profile_; | 58 Profile* profile_; |
| 52 AppListControllerDelegate* list_controller_; | 59 AppListControllerDelegate* list_controller_; |
| 53 | 60 |
| 54 ScopedObserver<extensions::ExtensionRegistry, | 61 ScopedObserver<extensions::ExtensionRegistry, |
| 55 extensions::ExtensionRegistryObserver> | 62 extensions::ExtensionRegistryObserver> |
| 56 extension_registry_observer_; | 63 extension_registry_observer_; |
| 57 | 64 |
| 58 Apps apps_; | 65 Apps apps_; |
| 59 | 66 |
| 60 DISALLOW_COPY_AND_ASSIGN(AppSearchProvider); | 67 DISALLOW_COPY_AND_ASSIGN(AppSearchProvider); |
| 61 }; | 68 }; |
| 62 | 69 |
| 63 } // namespace app_list | 70 } // namespace app_list |
| 64 | 71 |
| 65 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_ | 72 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_ |
| OLD | NEW |