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

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

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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
« no previous file with comments | « components/omnibox/autocomplete_match.cc ('k') | components/omnibox/base_search_provider.cc » ('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 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 i->Validate(); 366 i->Validate();
367 } 367 }
368 #endif 368 #endif
369 369
370 // static 370 // static
371 GURL AutocompleteResult::ComputeAlternateNavUrl( 371 GURL AutocompleteResult::ComputeAlternateNavUrl(
372 const AutocompleteInput& input, 372 const AutocompleteInput& input,
373 const AutocompleteMatch& match) { 373 const AutocompleteMatch& match) {
374 return ((input.type() == metrics::OmniboxInputType::UNKNOWN) && 374 return ((input.type() == metrics::OmniboxInputType::UNKNOWN) &&
375 (AutocompleteMatch::IsSearchType(match.type)) && 375 (AutocompleteMatch::IsSearchType(match.type)) &&
376 (match.transition != content::PAGE_TRANSITION_KEYWORD) && 376 (match.transition != ui::PAGE_TRANSITION_KEYWORD) &&
377 (input.canonicalized_url() != match.destination_url)) ? 377 (input.canonicalized_url() != match.destination_url)) ?
378 input.canonicalized_url() : GURL(); 378 input.canonicalized_url() : GURL();
379 } 379 }
380 380
381 void AutocompleteResult::DedupMatchesByDestination( 381 void AutocompleteResult::DedupMatchesByDestination(
382 OmniboxEventProto::PageClassification page_classification, 382 OmniboxEventProto::PageClassification page_classification,
383 bool set_duplicate_matches, 383 bool set_duplicate_matches,
384 ACMatches* matches) { 384 ACMatches* matches) {
385 DestinationSort destination_sort(page_classification); 385 DestinationSort destination_sort(page_classification);
386 // Sort matches such that duplicate matches are consecutive. 386 // Sort matches such that duplicate matches are consecutive.
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 i != old_matches.rend() && delta > 0; ++i) { 457 i != old_matches.rend() && delta > 0; ++i) {
458 if (!HasMatchByDestination(*i, new_matches)) { 458 if (!HasMatchByDestination(*i, new_matches)) {
459 AutocompleteMatch match = *i; 459 AutocompleteMatch match = *i;
460 match.relevance = std::min(max_relevance, match.relevance); 460 match.relevance = std::min(max_relevance, match.relevance);
461 match.from_previous = true; 461 match.from_previous = true;
462 matches_.push_back(match); 462 matches_.push_back(match);
463 delta--; 463 delta--;
464 } 464 }
465 } 465 }
466 } 466 }
OLDNEW
« no previous file with comments | « components/omnibox/autocomplete_match.cc ('k') | components/omnibox/base_search_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698