Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: ui/app_list/search_controller.cc

Issue 796293002: App list voice searches now prioritize exact-match web results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/app_list/search_controller.h ('k') | ui/app_list/search_result.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
21 21
22 // Maximum time (in milliseconds) to wait to the search providers to finish. 22 // Maximum time (in milliseconds) to wait to the search providers to finish.
23 const int kStopTimeMS = 1500; 23 const int kStopTimeMS = 1500;
24 } 24 }
25 25
26 namespace app_list { 26 namespace app_list {
27 27
28 SearchController::SearchController(SearchBoxModel* search_box, 28 SearchController::SearchController(SearchBoxModel* search_box,
29 AppListModel::SearchResults* results, 29 AppListModel::SearchResults* results,
30 History* history) 30 History* history)
31 : search_box_(search_box), 31 : search_box_(search_box),
32 dispatching_query_(false), 32 dispatching_query_(false),
33 mixer_(new Mixer(results)), 33 mixer_(new Mixer(results)),
34 history_(history) { 34 history_(history),
35 is_voice_query_(false) {
35 mixer_->Init(); 36 mixer_->Init();
36 } 37 }
37 38
38 SearchController::~SearchController() { 39 SearchController::~SearchController() {
39 } 40 }
40 41
41 void SearchController::Start() { 42 void SearchController::Start(bool is_voice_query) {
42 Stop(); 43 Stop();
43 44
44 base::string16 query; 45 base::string16 query;
45 base::TrimWhitespace(search_box_->text(), base::TRIM_ALL, &query); 46 base::TrimWhitespace(search_box_->text(), base::TRIM_ALL, &query);
46 47
47 dispatching_query_ = true; 48 dispatching_query_ = true;
48 for (Providers::iterator it = providers_.begin(); 49 for (Providers::iterator it = providers_.begin();
49 it != providers_.end(); 50 it != providers_.end();
50 ++it) { 51 ++it) {
51 (*it)->Start(query); 52 (*it)->Start(query);
52 } 53 }
53 dispatching_query_ = false; 54 dispatching_query_ = false;
54 55
56 is_voice_query_ = is_voice_query;
57
55 OnResultsChanged(); 58 OnResultsChanged();
56 59
57 stop_timer_.Start(FROM_HERE, 60 stop_timer_.Start(FROM_HERE,
58 base::TimeDelta::FromMilliseconds(kStopTimeMS), 61 base::TimeDelta::FromMilliseconds(kStopTimeMS),
59 base::Bind(&SearchController::Stop, 62 base::Bind(&SearchController::Stop,
60 base::Unretained(this))); 63 base::Unretained(this)));
61 } 64 }
62 65
63 void SearchController::Stop() { 66 void SearchController::Stop() {
64 stop_timer_.Stop(); 67 stop_timer_.Stop();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 void SearchController::OnResultsChanged() { 104 void SearchController::OnResultsChanged() {
102 if (dispatching_query_) 105 if (dispatching_query_)
103 return; 106 return;
104 107
105 KnownResults known_results; 108 KnownResults known_results;
106 if (history_ && history_->IsReady()) { 109 if (history_ && history_->IsReady()) {
107 history_->GetKnownResults(base::UTF16ToUTF8(search_box_->text())) 110 history_->GetKnownResults(base::UTF16ToUTF8(search_box_->text()))
108 ->swap(known_results); 111 ->swap(known_results);
109 } 112 }
110 113
111 mixer_->MixAndPublish(known_results); 114 mixer_->MixAndPublish(is_voice_query_, known_results);
112 } 115 }
113 116
114 } // namespace app_list 117 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/search_controller.h ('k') | ui/app_list/search_result.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698