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

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

Issue 1260033005: Revert of Move net::FormatUrl and friends outside of //net and into //components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 (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/history_quick_provider.h" 5 #include "components/omnibox/browser/history_quick_provider.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/debug/crash_logging.h" 10 #include "base/debug/crash_logging.h"
(...skipping 10 matching lines...) Expand all
21 #include "components/metrics/proto/omnibox_input_type.pb.h" 21 #include "components/metrics/proto/omnibox_input_type.pb.h"
22 #include "components/omnibox/browser/autocomplete_match_type.h" 22 #include "components/omnibox/browser/autocomplete_match_type.h"
23 #include "components/omnibox/browser/autocomplete_provider_client.h" 23 #include "components/omnibox/browser/autocomplete_provider_client.h"
24 #include "components/omnibox/browser/autocomplete_result.h" 24 #include "components/omnibox/browser/autocomplete_result.h"
25 #include "components/omnibox/browser/history_url_provider.h" 25 #include "components/omnibox/browser/history_url_provider.h"
26 #include "components/omnibox/browser/in_memory_url_index.h" 26 #include "components/omnibox/browser/in_memory_url_index.h"
27 #include "components/omnibox/browser/in_memory_url_index_types.h" 27 #include "components/omnibox/browser/in_memory_url_index_types.h"
28 #include "components/omnibox/browser/omnibox_field_trial.h" 28 #include "components/omnibox/browser/omnibox_field_trial.h"
29 #include "components/search_engines/template_url.h" 29 #include "components/search_engines/template_url.h"
30 #include "components/search_engines/template_url_service.h" 30 #include "components/search_engines/template_url_service.h"
31 #include "components/url_formatter/url_formatter.h"
32 #include "net/base/escape.h" 31 #include "net/base/escape.h"
32 #include "net/base/net_util.h"
33 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 33 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
34 #include "url/third_party/mozilla/url_parse.h" 34 #include "url/third_party/mozilla/url_parse.h"
35 #include "url/url_util.h" 35 #include "url/url_util.h"
36 36
37 namespace { 37 namespace {
38 38
39 // Used to help investigate bug 464926. NOTE: This value is defined multiple 39 // Used to help investigate bug 464926. NOTE: This value is defined multiple
40 // places in the codebase due to layering issues. DO NOT change the value here 40 // places in the codebase due to layering issues. DO NOT change the value here
41 // without changing it in all other places that it is defined in the codebase 41 // without changing it in all other places that it is defined in the codebase
42 // (search for |kBug464926CrashKey|). 42 // (search for |kBug464926CrashKey|).
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 AutocompleteMatch match( 214 AutocompleteMatch match(
215 this, score, !!info.visit_count(), 215 this, score, !!info.visit_count(),
216 history_match.url_matches.empty() ? 216 history_match.url_matches.empty() ?
217 AutocompleteMatchType::HISTORY_TITLE : 217 AutocompleteMatchType::HISTORY_TITLE :
218 AutocompleteMatchType::HISTORY_URL); 218 AutocompleteMatchType::HISTORY_URL);
219 match.typed_count = info.typed_count(); 219 match.typed_count = info.typed_count();
220 match.destination_url = info.url(); 220 match.destination_url = info.url();
221 DCHECK(match.destination_url.is_valid()); 221 DCHECK(match.destination_url.is_valid());
222 222
223 // Format the URL autocomplete presentation. 223 // Format the URL autocomplete presentation.
224 const url_formatter::FormatUrlTypes format_types = 224 const net::FormatUrlTypes format_types = net::kFormatUrlOmitAll &
225 url_formatter::kFormatUrlOmitAll & 225 ~(!history_match.match_in_scheme ? 0 : net::kFormatUrlOmitHTTP);
226 ~(!history_match.match_in_scheme ? 0 : url_formatter::kFormatUrlOmitHTTP);
227 match.fill_into_edit = 226 match.fill_into_edit =
228 AutocompleteInput::FormattedStringWithEquivalentMeaning( 227 AutocompleteInput::FormattedStringWithEquivalentMeaning(
229 info.url(), url_formatter::FormatUrl( 228 info.url(),
230 info.url(), languages_, format_types, 229 net::FormatUrl(info.url(), languages_, format_types,
231 net::UnescapeRule::SPACES, nullptr, nullptr, nullptr), 230 net::UnescapeRule::SPACES, NULL, NULL, NULL),
232 client()->GetSchemeClassifier()); 231 client()->GetSchemeClassifier());
233 std::vector<size_t> offsets = 232 std::vector<size_t> offsets =
234 OffsetsFromTermMatches(history_match.url_matches); 233 OffsetsFromTermMatches(history_match.url_matches);
235 base::OffsetAdjuster::Adjustments adjustments; 234 base::OffsetAdjuster::Adjustments adjustments;
236 match.contents = url_formatter::FormatUrlWithAdjustments( 235 match.contents = net::FormatUrlWithAdjustments(
237 info.url(), languages_, format_types, net::UnescapeRule::SPACES, nullptr, 236 info.url(), languages_, format_types, net::UnescapeRule::SPACES, NULL,
238 nullptr, &adjustments); 237 NULL, &adjustments);
239 base::OffsetAdjuster::AdjustOffsets(adjustments, &offsets); 238 base::OffsetAdjuster::AdjustOffsets(adjustments, &offsets);
240 TermMatches new_matches = 239 TermMatches new_matches =
241 ReplaceOffsetsInTermMatches(history_match.url_matches, offsets); 240 ReplaceOffsetsInTermMatches(history_match.url_matches, offsets);
242 match.contents_class = 241 match.contents_class =
243 SpansFromTermMatch(new_matches, match.contents.length(), true); 242 SpansFromTermMatch(new_matches, match.contents.length(), true);
244 243
245 // Set |inline_autocompletion| and |allowed_to_be_default_match| if possible. 244 // Set |inline_autocompletion| and |allowed_to_be_default_match| if possible.
246 if (history_match.can_inline) { 245 if (history_match.can_inline) {
247 base::debug::ScopedCrashKey crash_info( 246 base::debug::ScopedCrashKey crash_info(
248 kBug464926CrashKey, 247 kBug464926CrashKey,
(...skipping 24 matching lines...) Expand all
273 match.description = info.title(); 272 match.description = info.title();
274 match.description_class = SpansFromTermMatch( 273 match.description_class = SpansFromTermMatch(
275 history_match.title_matches, match.description.length(), false); 274 history_match.title_matches, match.description.length(), false);
276 275
277 match.RecordAdditionalInfo("typed count", info.typed_count()); 276 match.RecordAdditionalInfo("typed count", info.typed_count());
278 match.RecordAdditionalInfo("visit count", info.visit_count()); 277 match.RecordAdditionalInfo("visit count", info.visit_count());
279 match.RecordAdditionalInfo("last visit", info.last_visit()); 278 match.RecordAdditionalInfo("last visit", info.last_visit());
280 279
281 return match; 280 return match;
282 } 281 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/builtin_provider.cc ('k') | components/omnibox/browser/history_url_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698