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

Side by Side Diff: chrome/browser/ui/app_list/search/search_controller.cc

Issue 379333005: Allow AppSearchProvider to provide recommendations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: const Created 6 years, 4 months 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 | Annotate | Revision Log
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 "chrome/browser/ui/app_list/search/search_controller.h" 5 #include "chrome/browser/ui/app_list/search/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 17 matching lines...) Expand all
28 #include "grit/generated_resources.h" 28 #include "grit/generated_resources.h"
29 #include "grit/theme_resources.h" 29 #include "grit/theme_resources.h"
30 #include "ui/app_list/search_box_model.h" 30 #include "ui/app_list/search_box_model.h"
31 #include "ui/app_list/speech_ui_model.h" 31 #include "ui/app_list/speech_ui_model.h"
32 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
33 #include "ui/base/resource/resource_bundle.h" 33 #include "ui/base/resource/resource_bundle.h"
34 34
35 namespace { 35 namespace {
36 const char kAppListSearchResultOpenTypeHistogram[] = 36 const char kAppListSearchResultOpenTypeHistogram[] =
37 "Apps.AppListSearchResultOpenType"; 37 "Apps.AppListSearchResultOpenType";
38
39 // Maximum time (in milliseconds) to wait to the search providers to finish.
40 const int kStopTimeMS = 1500;
38 } 41 }
39 42
40 namespace app_list { 43 namespace app_list {
41 44
42 SearchController::SearchController(Profile* profile, 45 SearchController::SearchController(Profile* profile,
43 SearchBoxModel* search_box, 46 SearchBoxModel* search_box,
44 AppListModel::SearchResults* results, 47 AppListModel::SearchResults* results,
45 SpeechUIModel* speech_ui, 48 SpeechUIModel* speech_ui,
46 AppListControllerDelegate* list_controller) 49 AppListControllerDelegate* list_controller)
47 : profile_(profile), 50 : profile_(profile),
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 dispatching_query_ = true; 105 dispatching_query_ = true;
103 for (Providers::iterator it = providers_.begin(); 106 for (Providers::iterator it = providers_.begin();
104 it != providers_.end(); 107 it != providers_.end();
105 ++it) { 108 ++it) {
106 (*it)->Start(query); 109 (*it)->Start(query);
107 } 110 }
108 dispatching_query_ = false; 111 dispatching_query_ = false;
109 112
110 OnResultsChanged(); 113 OnResultsChanged();
111 114
112 // Maximum time (in milliseconds) to wait to the search providers to finish.
113 const int kStopTimeMS = 1500;
114 stop_timer_.Start(FROM_HERE, 115 stop_timer_.Start(FROM_HERE,
115 base::TimeDelta::FromMilliseconds(kStopTimeMS), 116 base::TimeDelta::FromMilliseconds(kStopTimeMS),
116 base::Bind(&SearchController::Stop, 117 base::Bind(&SearchController::Stop,
117 base::Unretained(this))); 118 base::Unretained(this)));
118 } 119 }
119 120
120 void SearchController::Stop() { 121 void SearchController::Stop() {
121 stop_timer_.Stop(); 122 stop_timer_.Stop();
122 123
123 for (Providers::iterator it = providers_.begin(); 124 for (Providers::iterator it = providers_.begin();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 176 }
176 177
177 void SearchController::OnSpeechRecognitionStateChanged( 178 void SearchController::OnSpeechRecognitionStateChanged(
178 SpeechRecognitionState new_state) { 179 SpeechRecognitionState new_state) {
179 search_box_->SetHintText(l10n_util::GetStringUTF16( 180 search_box_->SetHintText(l10n_util::GetStringUTF16(
180 (new_state == SPEECH_RECOGNITION_HOTWORD_LISTENING) ? 181 (new_state == SPEECH_RECOGNITION_HOTWORD_LISTENING) ?
181 IDS_SEARCH_BOX_HOTWORD_HINT : IDS_SEARCH_BOX_HINT)); 182 IDS_SEARCH_BOX_HOTWORD_HINT : IDS_SEARCH_BOX_HINT));
182 } 183 }
183 184
184 } // namespace app_list 185 } // namespace app_list
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/search/app_search_provider_unittest.cc ('k') | ui/app_list/search_result.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698