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

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

Issue 2940973002: Omnibox UI Experiments: Implement scheme-trimming for suggested URLs. (Closed)
Patch Set: fix Created 3 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
« no previous file with comments | « components/omnibox/browser/titled_url_match_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/zero_suggest_provider.h" 5 #include "components/omnibox/browser/zero_suggest_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 AddMatchToMap(results[i], std::string(), i, false, false, map); 368 AddMatchToMap(results[i], std::string(), i, false, false, map);
369 } 369 }
370 370
371 AutocompleteMatch ZeroSuggestProvider::NavigationToMatch( 371 AutocompleteMatch ZeroSuggestProvider::NavigationToMatch(
372 const SearchSuggestionParser::NavigationResult& navigation) { 372 const SearchSuggestionParser::NavigationResult& navigation) {
373 AutocompleteMatch match(this, navigation.relevance(), false, 373 AutocompleteMatch match(this, navigation.relevance(), false,
374 navigation.type()); 374 navigation.type());
375 match.destination_url = navigation.url(); 375 match.destination_url = navigation.url();
376 376
377 // Zero suggest results should always omit protocols and never appear bold. 377 // Zero suggest results should always omit protocols and never appear bold.
378 match.contents = url_formatter::FormatUrl( 378 match.contents = AutocompleteMatch::FormatUrlForSuggestionDisplay(
379 navigation.url(), url_formatter::kFormatUrlOmitAll, 379 navigation.url(), true /* trim_scheme */, nullptr);
380 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr);
381 match.fill_into_edit += 380 match.fill_into_edit +=
382 AutocompleteInput::FormattedStringWithEquivalentMeaning( 381 AutocompleteInput::FormattedStringWithEquivalentMeaning(
383 navigation.url(), match.contents, client()->GetSchemeClassifier()); 382 navigation.url(), match.contents, client()->GetSchemeClassifier());
384 383
385 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, 384 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0,
386 match.contents.length(), ACMatchClassification::URL, 385 match.contents.length(), ACMatchClassification::URL,
387 &match.contents_class); 386 &match.contents_class);
388 387
389 match.description = 388 match.description =
390 AutocompleteMatch::SanitizeString(navigation.description()); 389 AutocompleteMatch::SanitizeString(navigation.description());
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 if (!json_data.empty()) { 599 if (!json_data.empty()) {
601 std::unique_ptr<base::Value> data( 600 std::unique_ptr<base::Value> data(
602 SearchSuggestionParser::DeserializeJsonData(json_data)); 601 SearchSuggestionParser::DeserializeJsonData(json_data));
603 if (data && ParseSuggestResults( 602 if (data && ParseSuggestResults(
604 *data, kDefaultZeroSuggestRelevance, false, &results_)) { 603 *data, kDefaultZeroSuggestRelevance, false, &results_)) {
605 ConvertResultsToAutocompleteMatches(); 604 ConvertResultsToAutocompleteMatches();
606 results_from_cache_ = !matches_.empty(); 605 results_from_cache_ = !matches_.empty();
607 } 606 }
608 } 607 }
609 } 608 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/titled_url_match_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698