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

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

Issue 1171333003: Move net::FormatUrl and friends outside of //net and into //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again now that CQ is fixed Created 5 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
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/browser/autocomplete_result.h" 5 #include "components/omnibox/browser/autocomplete_result.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "components/metrics/proto/omnibox_event.pb.h" 13 #include "components/metrics/proto/omnibox_event.pb.h"
14 #include "components/metrics/proto/omnibox_input_type.pb.h" 14 #include "components/metrics/proto/omnibox_input_type.pb.h"
15 #include "components/omnibox/browser/autocomplete_input.h" 15 #include "components/omnibox/browser/autocomplete_input.h"
16 #include "components/omnibox/browser/autocomplete_match.h" 16 #include "components/omnibox/browser/autocomplete_match.h"
17 #include "components/omnibox/browser/autocomplete_provider.h" 17 #include "components/omnibox/browser/autocomplete_provider.h"
18 #include "components/omnibox/browser/omnibox_field_trial.h" 18 #include "components/omnibox/browser/omnibox_field_trial.h"
19 #include "components/omnibox/browser/omnibox_switches.h" 19 #include "components/omnibox/browser/omnibox_switches.h"
20 #include "components/search/search.h" 20 #include "components/search/search.h"
21 #include "components/url_fixer/url_fixer.h" 21 #include "components/url_formatter/url_fixer.h"
22 22
23 using metrics::OmniboxEventProto; 23 using metrics::OmniboxEventProto;
24 24
25 namespace { 25 namespace {
26 26
27 // This class implements a special version of AutocompleteMatch::MoreRelevant 27 // This class implements a special version of AutocompleteMatch::MoreRelevant
28 // that allows matches of particular types to be demoted in AutocompleteResult. 28 // that allows matches of particular types to be demoted in AutocompleteResult.
29 class CompareWithDemoteByType { 29 class CompareWithDemoteByType {
30 public: 30 public:
31 CompareWithDemoteByType( 31 CompareWithDemoteByType(
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 } else { 243 } else {
244 DCHECK_NE(metrics::OmniboxInputType::FORCED_QUERY, input.type()) 244 DCHECK_NE(metrics::OmniboxInputType::FORCED_QUERY, input.type())
245 << debug_info; 245 << debug_info;
246 // If the user explicitly typed a scheme, the default match should 246 // If the user explicitly typed a scheme, the default match should
247 // have the same scheme. 247 // have the same scheme.
248 if ((input.type() == metrics::OmniboxInputType::URL) && 248 if ((input.type() == metrics::OmniboxInputType::URL) &&
249 input.parts().scheme.is_nonempty()) { 249 input.parts().scheme.is_nonempty()) {
250 const std::string& in_scheme = base::UTF16ToUTF8(input.scheme()); 250 const std::string& in_scheme = base::UTF16ToUTF8(input.scheme());
251 const std::string& dest_scheme = 251 const std::string& dest_scheme =
252 default_match_->destination_url.scheme(); 252 default_match_->destination_url.scheme();
253 DCHECK(url_fixer::IsEquivalentScheme(in_scheme, dest_scheme)) 253 DCHECK(url_formatter::IsEquivalentScheme(in_scheme, dest_scheme))
254 << debug_info; 254 << debug_info;
255 } 255 }
256 } 256 }
257 } 257 }
258 } 258 }
259 259
260 // Set the alternate nav URL. 260 // Set the alternate nav URL.
261 alternate_nav_url_ = (default_match_ == matches_.end()) ? 261 alternate_nav_url_ = (default_match_ == matches_.end()) ?
262 GURL() : ComputeAlternateNavUrl(input, *default_match_); 262 GURL() : ComputeAlternateNavUrl(input, *default_match_);
263 } 263 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 i != old_matches.rend() && delta > 0; ++i) { 448 i != old_matches.rend() && delta > 0; ++i) {
449 if (!HasMatchByDestination(*i, new_matches)) { 449 if (!HasMatchByDestination(*i, new_matches)) {
450 AutocompleteMatch match = *i; 450 AutocompleteMatch match = *i;
451 match.relevance = std::min(max_relevance, match.relevance); 451 match.relevance = std::min(max_relevance, match.relevance);
452 match.from_previous = true; 452 match.from_previous = true;
453 matches_.push_back(match); 453 matches_.push_back(match);
454 delta--; 454 delta--;
455 } 455 }
456 } 456 }
457 } 457 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/autocomplete_provider.cc ('k') | components/omnibox/browser/bookmark_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698