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

Side by Side Diff: chrome/browser/autocomplete/history_url_provider.cc

Issue 349153006: Port HistoryService::QueryRedirects{From,To} to CancelableTaskTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/history/history_backend.h » ('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 (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 "chrome/browser/autocomplete/history_url_provider.h" 5 #include "chrome/browser/autocomplete/history_url_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 } 1080 }
1081 1081
1082 void HistoryURLProvider::CullRedirects(history::HistoryBackend* backend, 1082 void HistoryURLProvider::CullRedirects(history::HistoryBackend* backend,
1083 history::HistoryMatches* matches, 1083 history::HistoryMatches* matches,
1084 size_t max_results) const { 1084 size_t max_results) const {
1085 for (size_t source = 0; 1085 for (size_t source = 0;
1086 (source < matches->size()) && (source < max_results); ) { 1086 (source < matches->size()) && (source < max_results); ) {
1087 const GURL& url = (*matches)[source].url_info.url(); 1087 const GURL& url = (*matches)[source].url_info.url();
1088 // TODO(brettw) this should go away when everything uses GURL. 1088 // TODO(brettw) this should go away when everything uses GURL.
1089 history::RedirectList redirects; 1089 history::RedirectList redirects;
1090 backend->GetMostRecentRedirectsFrom(url, &redirects); 1090 backend->QueryRedirectsFrom(url, &redirects);
1091 if (!redirects.empty()) { 1091 if (!redirects.empty()) {
1092 // Remove all but the first occurrence of any of these redirects in the 1092 // Remove all but the first occurrence of any of these redirects in the
1093 // search results. We also must add the URL we queried for, since it may 1093 // search results. We also must add the URL we queried for, since it may
1094 // not be the first match and we'd want to remove it. 1094 // not be the first match and we'd want to remove it.
1095 // 1095 //
1096 // For example, when A redirects to B and our matches are [A, X, B], 1096 // For example, when A redirects to B and our matches are [A, X, B],
1097 // we'll get B as the redirects from, and we want to remove the second 1097 // we'll get B as the redirects from, and we want to remove the second
1098 // item of that pair, removing B. If A redirects to B and our matches are 1098 // item of that pair, removing B. If A redirects to B and our matches are
1099 // [B, X, A], we'll want to remove A instead. 1099 // [B, X, A], we'll want to remove A instead.
1100 redirects.push_back(url); 1100 redirects.push_back(url);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, 1196 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0,
1197 match.contents.length(), ACMatchClassification::URL, 1197 match.contents.length(), ACMatchClassification::URL,
1198 &match.contents_class); 1198 &match.contents_class);
1199 } 1199 }
1200 match.description = info.title(); 1200 match.description = info.title();
1201 match.description_class = 1201 match.description_class =
1202 ClassifyDescription(params.input.text(), match.description); 1202 ClassifyDescription(params.input.text(), match.description);
1203 RecordAdditionalInfoFromUrlRow(info, &match); 1203 RecordAdditionalInfoFromUrlRow(info, &match);
1204 return match; 1204 return match;
1205 } 1205 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/history/history_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698