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.
5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_PROVIDER_H_
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_PROVIDER_H_
8 #include "base/basictypes.h"
9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/scoped_vector.h"
12 #include "base/strings/string16.h"
16 class ChromeSearchResult
;
18 class SearchProvider
{
20 typedef ScopedVector
<ChromeSearchResult
> Results
;
21 typedef base::Closure ResultChangedCallback
;
24 virtual ~SearchProvider();
26 // Invoked to start a query.
27 virtual void Start(const base::string16
& query
) = 0;
29 // Invoked to stop the current query and no more results changes.
30 virtual void Stop() = 0;
32 void set_result_changed_callback(const ResultChangedCallback
& callback
) {
33 result_changed_callback_
= callback
;
36 const Results
& results() const { return results_
; }
39 // Interface for the derived class to generate search results.
40 void Add(scoped_ptr
<ChromeSearchResult
> result
);
44 void FireResultChanged();
46 ResultChangedCallback result_changed_callback_
;
49 DISALLOW_COPY_AND_ASSIGN(SearchProvider
);
52 } // namespace app_list
54 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_SEARCH_PROVIDER_H_