OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/app_list/search_controller.h" | 5 #include "ui/app_list/search_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 void SearchController::InvokeResultAction(SearchResult* result, | 95 void SearchController::InvokeResultAction(SearchResult* result, |
96 int action_index, | 96 int action_index, |
97 int event_flags) { | 97 int event_flags) { |
98 // TODO(xiyuan): Hook up with user learning. | 98 // TODO(xiyuan): Hook up with user learning. |
99 result->InvokeAction(action_index, event_flags); | 99 result->InvokeAction(action_index, event_flags); |
100 } | 100 } |
101 | 101 |
102 size_t SearchController::AddGroup(size_t max_results, double boost) { | 102 size_t SearchController::AddGroup(size_t max_results, |
103 return mixer_->AddGroup(max_results, boost); | 103 double boost, |
| 104 double multiplier) { |
| 105 return mixer_->AddGroup(max_results, boost, multiplier); |
104 } | 106 } |
105 | 107 |
106 size_t SearchController::AddOmniboxGroup(size_t max_results, double boost) { | 108 size_t SearchController::AddOmniboxGroup(size_t max_results, |
107 return mixer_->AddOmniboxGroup(max_results, boost); | 109 double boost, |
| 110 double multiplier) { |
| 111 return mixer_->AddOmniboxGroup(max_results, boost, multiplier); |
108 } | 112 } |
109 | 113 |
110 void SearchController::AddProvider(size_t group_id, | 114 void SearchController::AddProvider(size_t group_id, |
111 scoped_ptr<SearchProvider> provider) { | 115 scoped_ptr<SearchProvider> provider) { |
112 provider->set_result_changed_callback(base::Bind( | 116 provider->set_result_changed_callback(base::Bind( |
113 &SearchController::OnResultsChanged, | 117 &SearchController::OnResultsChanged, |
114 base::Unretained(this))); | 118 base::Unretained(this))); |
115 mixer_->AddProviderToGroup(group_id, provider.get()); | 119 mixer_->AddProviderToGroup(group_id, provider.get()); |
116 providers_.push_back(provider.release()); // Takes ownership. | 120 providers_.push_back(provider.release()); // Takes ownership. |
117 } | 121 } |
118 | 122 |
119 void SearchController::OnResultsChanged() { | 123 void SearchController::OnResultsChanged() { |
120 if (dispatching_query_) | 124 if (dispatching_query_) |
121 return; | 125 return; |
122 | 126 |
123 KnownResults known_results; | 127 KnownResults known_results; |
124 if (history_ && history_->IsReady()) { | 128 if (history_ && history_->IsReady()) { |
125 history_->GetKnownResults(base::UTF16ToUTF8(search_box_->text())) | 129 history_->GetKnownResults(base::UTF16ToUTF8(search_box_->text())) |
126 ->swap(known_results); | 130 ->swap(known_results); |
127 } | 131 } |
128 | 132 |
129 mixer_->MixAndPublish(is_voice_query_, known_results); | 133 mixer_->MixAndPublish(is_voice_query_, known_results); |
130 } | 134 } |
131 | 135 |
132 } // namespace app_list | 136 } // namespace app_list |
OLD | NEW |