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

Side by Side Diff: components/omnibox/browser/search_provider.cc

Issue 2725333004: Omnibox - Cleanup From Recent Changelists (Closed)
Patch Set: DCHECK(done_) Created 3 years, 9 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "components/omnibox/browser/search_provider.h" 5 #include "components/omnibox/browser/search_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 if (!minimal_changes || 264 if (!minimal_changes ||
265 !providers_.equal(default_provider_keyword, keyword_provider_keyword)) { 265 !providers_.equal(default_provider_keyword, keyword_provider_keyword)) {
266 // Cancel any in-flight suggest requests. 266 // Cancel any in-flight suggest requests.
267 if (!done_) 267 if (!done_)
268 Stop(false, false); 268 Stop(false, false);
269 } 269 }
270 270
271 providers_.set(default_provider_keyword, keyword_provider_keyword); 271 providers_.set(default_provider_keyword, keyword_provider_keyword);
272 272
273 if (input.from_omnibox_focus()) { 273 if (input.from_omnibox_focus()) {
274 // Don't display any suggestions for on-focus requests. Stop any pending 274 // Don't display any suggestions for on-focus requests.
275 // requests here (there likely aren't yet, though it doesn't hurt to be safe 275 DCHECK(done_);
276 // so that we can create a new request later in this flow (to warm-up the
277 // suggest server by alerting it that the user is likely about to start
278 // typing).
279 StopSuggest();
280 ClearAllResults(); 276 ClearAllResults();
281 } else if (input.text().empty()) { 277 } else if (input.text().empty()) {
282 // User typed "?" alone. Give them a placeholder result indicating what 278 // User typed "?" alone. Give them a placeholder result indicating what
283 // this syntax does. 279 // this syntax does.
284 if (default_provider) { 280 if (default_provider) {
285 AutocompleteMatch match; 281 AutocompleteMatch match;
286 match.provider = this; 282 match.provider = this;
287 match.contents.assign(l10n_util::GetStringUTF16(IDS_EMPTY_KEYWORD_VALUE)); 283 match.contents.assign(l10n_util::GetStringUTF16(IDS_EMPTY_KEYWORD_VALUE));
288 match.contents_class.push_back( 284 match.contents_class.push_back(
289 ACMatchClassification(0, ACMatchClassification::NONE)); 285 ACMatchClassification(0, ACMatchClassification::NONE));
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 for (MatchMap::const_iterator i(map.begin()); i != map.end(); ++i) 1515 for (MatchMap::const_iterator i(map.begin()); i != map.end(); ++i)
1520 matches.push_back(i->second); 1516 matches.push_back(i->second);
1521 std::sort(matches.begin(), matches.end(), &AutocompleteMatch::MoreRelevant); 1517 std::sort(matches.begin(), matches.end(), &AutocompleteMatch::MoreRelevant);
1522 1518
1523 // If there is a top scoring entry, find the corresponding answer. 1519 // If there is a top scoring entry, find the corresponding answer.
1524 if (!matches.empty()) 1520 if (!matches.empty())
1525 return answers_cache_.GetTopAnswerEntry(matches[0].contents); 1521 return answers_cache_.GetTopAnswerEntry(matches[0].contents);
1526 1522
1527 return AnswersQueryData(); 1523 return AnswersQueryData();
1528 } 1524 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/search_provider.h ('k') | components/omnibox/browser/zero_suggest_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698