NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / app_list / search / chrome_search_result.h
blob3d223109ec583cd30c4c303db6763f2e8c6fa1c5
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_CHROME_SEARCH_RESULT_H_
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_CHROME_SEARCH_RESULT_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "ui/app_list/search_result.h"
13 namespace app_list {
15 // The type of the search result. This is used for logging so do not change the
16 // order of this enum.
17 enum ChromeSearchResultType {
18 // A result that forwards an omnibox search result.
19 OMNIBOX_SEARCH_RESULT,
20 // An app result.
21 APP_SEARCH_RESULT,
22 // A search result from the webstore.
23 WEBSTORE_SEARCH_RESULT,
24 // A result that opens a webstore search.
25 SEARCH_WEBSTORE_SEARCH_RESULT,
26 // A result that opens a people search.
27 SEARCH_PEOPLE_SEARCH_RESULT,
28 SEARCH_RESULT_TYPE_BOUNDARY
31 // Base class of all search results. It provides an additional interface
32 // for SearchController to mix the results, duplicate a result from a
33 // SearchProvider and pass it to UI and invoke actions on the results when
34 // underlying UI is activated.
35 class ChromeSearchResult : public SearchResult {
36 public:
37 ChromeSearchResult() : relevance_(0.0) {}
38 virtual ~ChromeSearchResult() {}
40 // Opens the result.
41 virtual void Open(int event_flags) = 0;
43 // Invokes a custom action on the result.
44 virtual void InvokeAction(int action_index, int event_flags) = 0;
46 // Creates a copy of the result.
47 virtual scoped_ptr<ChromeSearchResult> Duplicate() = 0;
49 virtual ChromeSearchResultType GetType() = 0;
51 const std::string& id() const { return id_; }
52 double relevance() { return relevance_; }
54 protected:
55 void set_id(const std::string& id) { id_ = id; }
56 void set_relevance(double relevance) { relevance_ = relevance; }
58 private:
59 std::string id_;
60 double relevance_;
62 DISALLOW_COPY_AND_ASSIGN(ChromeSearchResult);
65 } // namespace app_list
67 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_CHROME_SEARCH_RESULT_H_