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

Side by Side Diff: components/omnibox/autocomplete_result.cc

Issue 1154063003: removing ShouldHideTopMatch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changed deprecated var name Created 5 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/autocomplete_result.h" 5 #include "components/omnibox/autocomplete_result.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 const AutocompleteMatch& AutocompleteResult::match_at(size_t index) const { 287 const AutocompleteMatch& AutocompleteResult::match_at(size_t index) const {
288 DCHECK_LT(index, matches_.size()); 288 DCHECK_LT(index, matches_.size());
289 return matches_[index]; 289 return matches_[index];
290 } 290 }
291 291
292 AutocompleteMatch* AutocompleteResult::match_at(size_t index) { 292 AutocompleteMatch* AutocompleteResult::match_at(size_t index) {
293 DCHECK_LT(index, matches_.size()); 293 DCHECK_LT(index, matches_.size());
294 return &matches_[index]; 294 return &matches_[index];
295 } 295 }
296 296
297 bool AutocompleteResult::ShouldHideTopMatch() const {
298 return chrome::ShouldHideTopVerbatimMatch() &&
299 TopMatchIsStandaloneVerbatimMatch();
300 }
301
302 bool AutocompleteResult::TopMatchIsStandaloneVerbatimMatch() const { 297 bool AutocompleteResult::TopMatchIsStandaloneVerbatimMatch() const {
303 if (empty() || !match_at(0).IsVerbatimType()) 298 if (empty() || !match_at(0).IsVerbatimType())
304 return false; 299 return false;
305 300
306 // Skip any copied matches, under the assumption that they'll be expired and 301 // Skip any copied matches, under the assumption that they'll be expired and
307 // disappear. We don't want this disappearance to cause the visibility of the 302 // disappear. We don't want this disappearance to cause the visibility of the
308 // top match to change. 303 // top match to change.
309 for (const_iterator i(begin() + 1); i != end(); ++i) { 304 for (const_iterator i(begin() + 1); i != end(); ++i) {
310 if (!i->from_previous) 305 if (!i->from_previous)
311 return !i->IsVerbatimType(); 306 return !i->IsVerbatimType();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 i != old_matches.rend() && delta > 0; ++i) { 437 i != old_matches.rend() && delta > 0; ++i) {
443 if (!HasMatchByDestination(*i, new_matches)) { 438 if (!HasMatchByDestination(*i, new_matches)) {
444 AutocompleteMatch match = *i; 439 AutocompleteMatch match = *i;
445 match.relevance = std::min(max_relevance, match.relevance); 440 match.relevance = std::min(max_relevance, match.relevance);
446 match.from_previous = true; 441 match.from_previous = true;
447 matches_.push_back(match); 442 matches_.push_back(match);
448 delta--; 443 delta--;
449 } 444 }
450 } 445 }
451 } 446 }
OLDNEW
« no previous file with comments | « components/omnibox/autocomplete_result.h ('k') | components/omnibox/autocomplete_result_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698