app_search_provider.h revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
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. 4 5#ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_ 6#define CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_ 7 8#include "base/basictypes.h" 9#include "base/memory/scoped_vector.h" 10#include "chrome/browser/ui/app_list/search/search_provider.h" 11#include "content/public/browser/notification_observer.h" 12#include "content/public/browser/notification_registrar.h" 13 14class AppListControllerDelegate; 15class ExtensionService; 16class Profile; 17 18namespace extensions { 19class ExtensionSet; 20} 21 22namespace app_list { 23 24class AppSearchProvider : public SearchProvider, 25 public content::NotificationObserver { 26 public: 27 AppSearchProvider(Profile* profile, 28 AppListControllerDelegate* list_controller); 29 virtual ~AppSearchProvider(); 30 31 // SearchProvider overrides: 32 virtual void Start(const base::string16& query) OVERRIDE; 33 virtual void Stop() OVERRIDE; 34 35 private: 36 class App; 37 typedef ScopedVector<App> Apps; 38 39 // Adds extensions to apps container if they should be displayed. 40 void AddApps(const extensions::ExtensionSet& extensions); 41 void RefreshApps(); 42 43 // content::NotificationObserver overrides: 44 virtual void Observe(int type, 45 const content::NotificationSource& source, 46 const content::NotificationDetails& details) OVERRIDE; 47 48 Profile* profile_; 49 AppListControllerDelegate* list_controller_; 50 content::NotificationRegistrar registrar_; 51 52 Apps apps_; 53 54 DISALLOW_COPY_AND_ASSIGN(AppSearchProvider); 55}; 56 57} // namespace app_list 58 59#endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_ 60