summaryrefslogtreecommitdiffstats
path: root/ui/app_list/search_provider.h
diff options
context:
space:
mode:
authormukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-13 21:52:53 +0000
committermukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-13 21:52:53 +0000
commit59828d3af3f80d5d88c669f58a731a0283864d12 (patch)
tree88eaf68db32ce79c54ba2265f633a6c4ed2e5e66 /ui/app_list/search_provider.h
parent9c67c2986d663cd3556326e84bcbba465bde6ad6 (diff)
downloadchromium_src-59828d3af3f80d5d88c669f58a731a0283864d12.zip
chromium_src-59828d3af3f80d5d88c669f58a731a0283864d12.tar.gz
chromium_src-59828d3af3f80d5d88c669f58a731a0283864d12.tar.bz2
Export SearchProvider interface to ui/app_list and use it in athena.
BUG=380444, 380875 R=oshima@chromium.org, xiyuan@chromium.org TEST=compile succeeds, manually check behavior Review URL: https://codereview.chromium.org/331523002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277094 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/app_list/search_provider.h')
-rw-r--r--ui/app_list/search_provider.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/ui/app_list/search_provider.h b/ui/app_list/search_provider.h
new file mode 100644
index 0000000..f8ebfd0
--- /dev/null
+++ b/ui/app_list/search_provider.h
@@ -0,0 +1,58 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_APP_LIST_SEARCH_PROVIDER_H_
+#define UI_APP_LIST_SEARCH_PROVIDER_H_
+
+#include "base/basictypes.h"
+#include "base/callback.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
+#include "base/strings/string16.h"
+#include "ui/app_list/app_list_export.h"
+
+namespace app_list {
+
+class SearchResult;
+
+class APP_LIST_EXPORT SearchProvider {
+ public:
+ typedef ScopedVector<SearchResult> Results;
+ typedef base::Closure ResultChangedCallback;
+
+ SearchProvider();
+ virtual ~SearchProvider();
+
+ // Invoked to start a query.
+ virtual void Start(const base::string16& query) = 0;
+
+ // Invoked to stop the current query and no more results changes.
+ virtual void Stop() = 0;
+
+ void set_result_changed_callback(const ResultChangedCallback& callback) {
+ result_changed_callback_ = callback;
+ }
+
+ // TODO(mukai): Fix the ownership and copying of the results.
+ void ReleaseResult(std::vector<SearchResult*>* results);
+
+ const Results& results() const { return results_; }
+
+ protected:
+ // Interface for the derived class to generate search results.
+ void Add(scoped_ptr<SearchResult> result);
+ void ClearResults();
+
+ private:
+ void FireResultChanged();
+
+ ResultChangedCallback result_changed_callback_;
+ Results results_;
+
+ DISALLOW_COPY_AND_ASSIGN(SearchProvider);
+};
+
+} // namespace app_list
+
+#endif // UI_APP_LIST_SEARCH_PROVIDER_H_