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

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: fix crashes on about: schemes 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 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 match.fill_into_edit.substr(inline_autocomplete_offset); 1122 match.fill_into_edit.substr(inline_autocomplete_offset);
1123 } 1123 }
1124 // An inlineable navsuggestion can only be the default match when there 1124 // An inlineable navsuggestion can only be the default match when there
1125 // is no keyword provider active, lest it appear first and break the user 1125 // is no keyword provider active, lest it appear first and break the user
1126 // out of keyword mode. It can also only be default if either the inline 1126 // out of keyword mode. It can also only be default if either the inline
1127 // autocompletion is empty or we're not preventing inline autocompletion. 1127 // autocompletion is empty or we're not preventing inline autocompletion.
1128 // Finally, if we have an inlineable navsuggestion with an inline completion 1128 // Finally, if we have an inlineable navsuggestion with an inline completion
1129 // that we're not preventing, make sure we didn't trim any whitespace. 1129 // that we're not preventing, make sure we didn't trim any whitespace.
1130 // We don't want to claim http://foo.com/bar is inlineable against the 1130 // We don't want to claim http://foo.com/bar is inlineable against the
1131 // input "foo.com/b ". 1131 // input "foo.com/b ".
1132 match.allowed_to_be_default_match = navigation.IsInlineable(input) && 1132 match.allowed_to_be_default_match = (prefix != NULL) &&
1133 (providers_.GetKeywordProviderURL() == NULL) && 1133 (providers_.GetKeywordProviderURL() == NULL) &&
1134 (match.inline_autocompletion.empty() || 1134 (match.inline_autocompletion.empty() ||
1135 (!input_.prevent_inline_autocomplete() && !trimmed_whitespace)); 1135 (!input_.prevent_inline_autocomplete() && !trimmed_whitespace));
1136 match.EnsureUWYTIsAllowedToBeDefault(
1137 input_.canonicalized_url(), providers_.template_url_service());
1136 1138
1137 match.contents = navigation.match_contents(); 1139 match.contents = navigation.match_contents();
1138 match.contents_class = navigation.match_contents_class(); 1140 match.contents_class = navigation.match_contents_class();
1139 match.description = navigation.description(); 1141 match.description = navigation.description();
1140 AutocompleteMatch::ClassifyMatchInString(input, match.description, 1142 AutocompleteMatch::ClassifyMatchInString(input, match.description,
1141 ACMatchClassification::NONE, &match.description_class); 1143 ACMatchClassification::NONE, &match.description_class);
1142 1144
1143 match.RecordAdditionalInfo( 1145 match.RecordAdditionalInfo(
1144 kRelevanceFromServerKey, 1146 kRelevanceFromServerKey,
1145 navigation.relevance_from_server() ? kTrue : kFalse); 1147 navigation.relevance_from_server() ? kTrue : kFalse);
(...skipping 20 matching lines...) Expand all
1166 // Make the base64 encoded value URL and filename safe(see RFC 3548). 1168 // Make the base64 encoded value URL and filename safe(see RFC 3548).
1167 std::replace(current_token_.begin(), current_token_.end(), '+', '-'); 1169 std::replace(current_token_.begin(), current_token_.end(), '+', '-');
1168 std::replace(current_token_.begin(), current_token_.end(), '/', '_'); 1170 std::replace(current_token_.begin(), current_token_.end(), '/', '_');
1169 } 1171 }
1170 1172
1171 // Extend expiration time another 60 seconds. 1173 // Extend expiration time another 60 seconds.
1172 token_expiration_time_ = current_time + base::TimeDelta::FromSeconds(60); 1174 token_expiration_time_ = current_time + base::TimeDelta::FromSeconds(60);
1173 1175
1174 return current_token_; 1176 return current_token_;
1175 } 1177 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698