app_search_provider.h revision 3551c9c881056c480085172ff9840cab31610854
190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)// found in the LICENSE file.
490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_
690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#define CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_
790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "base/basictypes.h"
990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "base/memory/scoped_vector.h"
1090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "chrome/browser/ui/app_list/search/search_provider.h"
1190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "content/public/browser/notification_observer.h"
1290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "content/public/browser/notification_registrar.h"
1390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
1490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class AppListControllerDelegate;
153551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)class ExtensionService;
163551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)class ExtensionSet;
1790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class Profile;
1890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
1990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace app_list {
2090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class AppSearchProvider : public SearchProvider,
2290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                          public content::NotificationObserver {
2390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) public:
2490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  AppSearchProvider(Profile* profile,
2590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                    AppListControllerDelegate* list_controller);
2690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  virtual ~AppSearchProvider();
2790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
2890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // SearchProvider overrides:
2990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  virtual void Start(const base::string16& query) OVERRIDE;
3090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  virtual void Stop() OVERRIDE;
3190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
3290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) private:
3390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  class App;
3490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  typedef ScopedVector<App> Apps;
3590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
363551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Adds extensions to apps container if they should be displayed.
373551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void AddApps(const ExtensionSet* extensions, ExtensionService* service);
3890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  void RefreshApps();
3990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
4090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // content::NotificationObserver overrides:
4190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  virtual void Observe(int type,
4290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                       const content::NotificationSource& source,
4390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)                       const content::NotificationDetails& details) OVERRIDE;
4490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
4590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  Profile* profile_;
4690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  AppListControllerDelegate* list_controller_;
4790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  content::NotificationRegistrar registrar_;
4890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
4990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  Apps apps_;
5090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
5190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(AppSearchProvider);
5290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)};
5390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
5490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}  // namespace app_list
5590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
5690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#endif  // CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_
57