| 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 { |
| 23 | 23 |
| 24 namespace test { |
| 25 class AppSearchProviderTest; |
| 26 } |
| 27 |
| 24 class AppSearchProvider : public SearchProvider, | 28 class AppSearchProvider : public SearchProvider, |
| 25 public extensions::ExtensionRegistryObserver { | 29 public extensions::ExtensionRegistryObserver { |
| 26 public: | 30 public: |
| 27 AppSearchProvider(Profile* profile, | 31 AppSearchProvider(Profile* profile, |
| 28 AppListControllerDelegate* list_controller); | 32 AppListControllerDelegate* list_controller); |
| 29 virtual ~AppSearchProvider(); | 33 virtual ~AppSearchProvider(); |
| 30 | 34 |
| 31 // SearchProvider overrides: | 35 // SearchProvider overrides: |
| 32 virtual void Start(const base::string16& query) OVERRIDE; | 36 virtual void Start(const base::string16& query) OVERRIDE; |
| 33 virtual void Stop() OVERRIDE; | 37 virtual void Stop() OVERRIDE; |
| 34 | 38 |
| 35 private: | 39 private: |
| 36 class App; | 40 class App; |
| 37 typedef ScopedVector<App> Apps; | 41 typedef ScopedVector<App> Apps; |
| 38 | 42 |
| 43 friend test::AppSearchProviderTest; |
| 44 |
| 45 void StartImpl(const base::Time& current_time, const base::string16& query); |
| 46 |
| 39 // Adds extensions to apps container if they should be displayed. | 47 // Adds extensions to apps container if they should be displayed. |
| 40 void AddApps(const extensions::ExtensionSet& extensions); | 48 void AddApps(const extensions::ExtensionSet& extensions); |
| 41 void RefreshApps(); | 49 void RefreshApps(); |
| 42 | 50 |
| 43 // extensions::ExtensionRegistryObserver overrides: | 51 // extensions::ExtensionRegistryObserver overrides: |
| 44 virtual void OnExtensionLoaded( | 52 virtual void OnExtensionLoaded( |
| 45 content::BrowserContext* browser_context, | 53 content::BrowserContext* browser_context, |
| 46 const extensions::Extension* extension) OVERRIDE; | 54 const extensions::Extension* extension) OVERRIDE; |
| 47 virtual void OnExtensionUninstalled( | 55 virtual void OnExtensionUninstalled( |
| 48 content::BrowserContext* browser_context, | 56 content::BrowserContext* browser_context, |
| 49 const extensions::Extension* extension, | 57 const extensions::Extension* extension, |
| 50 extensions::UninstallReason reason) OVERRIDE; | 58 extensions::UninstallReason reason) OVERRIDE; |
| 51 | 59 |
| 52 Profile* profile_; | 60 Profile* profile_; |
| 53 AppListControllerDelegate* list_controller_; | 61 AppListControllerDelegate* list_controller_; |
| 54 | 62 |
| 55 ScopedObserver<extensions::ExtensionRegistry, | 63 ScopedObserver<extensions::ExtensionRegistry, |
| 56 extensions::ExtensionRegistryObserver> | 64 extensions::ExtensionRegistryObserver> |
| 57 extension_registry_observer_; | 65 extension_registry_observer_; |
| 58 | 66 |
| 59 Apps apps_; | 67 Apps apps_; |
| 60 | 68 |
| 61 DISALLOW_COPY_AND_ASSIGN(AppSearchProvider); | 69 DISALLOW_COPY_AND_ASSIGN(AppSearchProvider); |
| 62 }; | 70 }; |
| 63 | 71 |
| 64 } // namespace app_list | 72 } // namespace app_list |
| 65 | 73 |
| 66 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_ | 74 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_ |
| OLD | NEW |