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

Unified Diff: chrome/browser/autocomplete/url_prefix.cc

Issue 312423003: Cleanup AutocompleteInput and AutocompleteProvider Functions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Return a std::pair 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autocomplete/url_prefix.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/url_prefix.cc
diff --git a/chrome/browser/autocomplete/url_prefix.cc b/chrome/browser/autocomplete/url_prefix.cc
index 8a49f2c95836b2bbd741e3adde99861e5d4bca98..730f1a2277cfd08a6712c9fc550faf74b8055061 100644
--- a/chrome/browser/autocomplete/url_prefix.cc
+++ b/chrome/browser/autocomplete/url_prefix.cc
@@ -7,7 +7,6 @@
#include "base/basictypes.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/autocomplete/autocomplete_input.h"
namespace {
@@ -78,24 +77,22 @@ bool URLPrefix::PrefixMatch(const URLPrefix& prefix,
// static
size_t URLPrefix::GetInlineAutocompleteOffset(
- const AutocompleteInput& input,
- const AutocompleteInput& fixed_up_input,
+ const base::string16& input,
+ const base::string16& fixed_up_input,
const bool allow_www_prefix_without_scheme,
const base::string16& text) {
const URLPrefix* best_prefix = allow_www_prefix_without_scheme ?
- BestURLPrefixWithWWWCase(text, input.text()) :
- BestURLPrefix(text, input.text());
- const base::string16* matching_string = &input.text();
+ BestURLPrefixWithWWWCase(text, input) : BestURLPrefix(text, input);
+ const base::string16* matching_string = &input;
// If we failed to find a best_prefix initially, try again using a fixed-up
// version of the user input. This is especially useful to get about: URLs
// to inline against chrome:// shortcuts. (about: URLs are fixed up to the
// chrome:// scheme.)
- if ((best_prefix == NULL) && !fixed_up_input.text().empty() &&
- (fixed_up_input.text() != input.text())) {
+ if (!best_prefix && !fixed_up_input.empty() && (fixed_up_input != input)) {
best_prefix = allow_www_prefix_without_scheme ?
- BestURLPrefixWithWWWCase(text, fixed_up_input.text()) :
- BestURLPrefix(text, fixed_up_input.text());
- matching_string = &fixed_up_input.text();
+ BestURLPrefixWithWWWCase(text, fixed_up_input) :
+ BestURLPrefix(text, fixed_up_input);
+ matching_string = &fixed_up_input;
}
return (best_prefix != NULL) ?
(best_prefix->prefix.length() + matching_string->length()) :
« no previous file with comments | « chrome/browser/autocomplete/url_prefix.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698