app_search_provider.h revision 90dce4d38c5ff5333bea97d859d4e484e27edf0c
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 Profile;
16
17namespace app_list {
18
19class AppSearchProvider : public SearchProvider,
20                          public content::NotificationObserver {
21 public:
22  AppSearchProvider(Profile* profile,
23                    AppListControllerDelegate* list_controller);
24  virtual ~AppSearchProvider();
25
26  // SearchProvider overrides:
27  virtual void Start(const base::string16& query) OVERRIDE;
28  virtual void Stop() OVERRIDE;
29
30 private:
31  class App;
32  typedef ScopedVector<App> Apps;
33
34  void RefreshApps();
35
36  // content::NotificationObserver overrides:
37  virtual void Observe(int type,
38                       const content::NotificationSource& source,
39                       const content::NotificationDetails& details) OVERRIDE;
40
41  Profile* profile_;
42  AppListControllerDelegate* list_controller_;
43  content::NotificationRegistrar registrar_;
44
45  Apps apps_;
46
47  DISALLOW_COPY_AND_ASSIGN(AppSearchProvider);
48};
49
50}  // namespace app_list
51
52#endif  // CHROME_BROWSER_UI_APP_LIST_SEARCH_APP_SEARCH_PROVIDER_H_
53