blob: 314cc286938a4aea24039bf43258aa58517dc3bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// Copyright (c) 2012 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 CHROME_BROWSER_UI_APP_LIST_SEARCH_BUILDER_H_
#define CHROME_BROWSER_UI_APP_LIST_SEARCH_BUILDER_H_
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/autocomplete/autocomplete_controller_delegate.h"
#include "ui/app_list/app_list_model.h"
namespace app_list {
class SearchBoxModel;
class SearchResult;
}
class AppListController;
class AutocompleteController;
class AutocompleteResult;
class Profile;
// SearchBuilder creates app list search results via AutoCompleteController.
class SearchBuilder : public AutocompleteControllerDelegate {
public:
SearchBuilder(Profile* profile,
app_list::SearchBoxModel* search_box,
app_list::AppListModel::SearchResults* results,
AppListController* list_controller);
virtual ~SearchBuilder();
void StartSearch();
void StopSearch();
// Opens |result|.
void OpenResult(const app_list::SearchResult& result, int event_flags);
// Invokes a custom action on |result|. |action_index| corresponds to the
// index of the selected icon in |result.action_icons()|.
void InvokeResultAction(const app_list::SearchResult& result,
int action_index,
int event_flags);
private:
// Populates result list from AutocompleteResult.
void PopulateFromACResult(const AutocompleteResult& result);
// AutocompleteControllerDelegate overrides:
virtual void OnResultChanged(bool default_match_changed) OVERRIDE;
Profile* profile_;
// Sub models of AppListModel that represent search box and result list.
app_list::SearchBoxModel* search_box_;
app_list::AppListModel::SearchResults* results_;
// The omnibox AutocompleteController that collects/sorts/dup-
// eliminates the results as they come in.
scoped_ptr<AutocompleteController> controller_;
// The controller of the app list. Owned by the app list delegate.
AppListController* list_controller_;
DISALLOW_COPY_AND_ASSIGN(SearchBuilder);
};
#endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_BUILDER_H_
|