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

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

Issue 353223002: Omnibox: Fix URL-What-You-Typed Allowed-To-Be-Default-Match Issues (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove extra << Created 6 years, 5 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/search_provider.h" 5 #include "chrome/browser/autocomplete/search_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 match.fill_into_edit.substr(inline_autocomplete_offset); 1121 match.fill_into_edit.substr(inline_autocomplete_offset);
1122 } 1122 }
1123 // An inlineable navsuggestion can only be the default match when there 1123 // An inlineable navsuggestion can only be the default match when there
1124 // is no keyword provider active, lest it appear first and break the user 1124 // is no keyword provider active, lest it appear first and break the user
1125 // out of keyword mode. It can also only be default if either the inline 1125 // out of keyword mode. It can also only be default if either the inline
1126 // autocompletion is empty or we're not preventing inline autocompletion. 1126 // autocompletion is empty or we're not preventing inline autocompletion.
1127 // Finally, if we have an inlineable navsuggestion with an inline completion 1127 // Finally, if we have an inlineable navsuggestion with an inline completion
1128 // that we're not preventing, make sure we didn't trim any whitespace. 1128 // that we're not preventing, make sure we didn't trim any whitespace.
1129 // We don't want to claim http://foo.com/bar is inlineable against the 1129 // We don't want to claim http://foo.com/bar is inlineable against the
1130 // input "foo.com/b ". 1130 // input "foo.com/b ".
1131 match.allowed_to_be_default_match = navigation.IsInlineable(input) && 1131 match.allowed_to_be_default_match = (prefix != NULL) &&
1132 (providers_.GetKeywordProviderURL() == NULL) && 1132 (providers_.GetKeywordProviderURL() == NULL) &&
1133 (match.inline_autocompletion.empty() || 1133 (match.inline_autocompletion.empty() ||
1134 (!input_.prevent_inline_autocomplete() && !trimmed_whitespace)); 1134 (!input_.prevent_inline_autocomplete() && !trimmed_whitespace));
1135 match.EnsureUWYTIsAllowedToBeDefault(
1136 input_.canonicalized_url(), providers_.template_url_service());
1135 1137
1136 match.contents = navigation.match_contents(); 1138 match.contents = navigation.match_contents();
1137 match.contents_class = navigation.match_contents_class(); 1139 match.contents_class = navigation.match_contents_class();
1138 match.description = navigation.description(); 1140 match.description = navigation.description();
1139 AutocompleteMatch::ClassifyMatchInString(input, match.description, 1141 AutocompleteMatch::ClassifyMatchInString(input, match.description,
1140 ACMatchClassification::NONE, &match.description_class); 1142 ACMatchClassification::NONE, &match.description_class);
1141 1143
1142 match.RecordAdditionalInfo( 1144 match.RecordAdditionalInfo(
1143 kRelevanceFromServerKey, 1145 kRelevanceFromServerKey,
1144 navigation.relevance_from_server() ? kTrue : kFalse); 1146 navigation.relevance_from_server() ? kTrue : kFalse);
(...skipping 20 matching lines...) Expand all
1165 // Make the base64 encoded value URL and filename safe(see RFC 3548). 1167 // Make the base64 encoded value URL and filename safe(see RFC 3548).
1166 std::replace(current_token_.begin(), current_token_.end(), '+', '-'); 1168 std::replace(current_token_.begin(), current_token_.end(), '+', '-');
1167 std::replace(current_token_.begin(), current_token_.end(), '/', '_'); 1169 std::replace(current_token_.begin(), current_token_.end(), '/', '_');
1168 } 1170 }
1169 1171
1170 // Extend expiration time another 60 seconds. 1172 // Extend expiration time another 60 seconds.
1171 token_expiration_time_ = current_time + base::TimeDelta::FromSeconds(60); 1173 token_expiration_time_ = current_time + base::TimeDelta::FromSeconds(60);
1172 1174
1173 return current_token_; 1175 return current_token_;
1174 } 1176 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698