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

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

Issue 126052: Fixes bug where keyword editor would end up prefixing all keyword urls... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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/autocomplete/search_provider.cc » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/keyword_provider.h" 5 #include "chrome/browser/autocomplete/keyword_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 AutocompleteMatch::ClassifyLocationInString(0, match->contents.length(), 204 AutocompleteMatch::ClassifyLocationInString(0, match->contents.length(),
205 match->contents.length(), ACMatchClassification::NONE, 205 match->contents.length(), ACMatchClassification::NONE,
206 &match->contents_class); 206 &match->contents_class);
207 } 207 }
208 } else { 208 } else {
209 // Create destination URL by escaping user input and substituting into 209 // Create destination URL by escaping user input and substituting into
210 // keyword template URL. The escaping here handles whitespace in user 210 // keyword template URL. The escaping here handles whitespace in user
211 // input, but we rely on later canonicalization functions to do more 211 // input, but we rely on later canonicalization functions to do more
212 // fixup to make the URL valid if necessary. 212 // fixup to make the URL valid if necessary.
213 DCHECK(element->url()->SupportsReplacement()); 213 DCHECK(element->url()->SupportsReplacement());
214 match->destination_url = element->url()->ReplaceSearchTerms( 214 match->destination_url = GURL(WideToUTF8(element->url()->ReplaceSearchTerms(
215 *element, remaining_input, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, 215 *element, remaining_input, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE,
216 std::wstring()); 216 std::wstring())));
217 std::vector<size_t> content_param_offsets; 217 std::vector<size_t> content_param_offsets;
218 match->contents.assign(l10n_util::GetStringF(IDS_KEYWORD_SEARCH, 218 match->contents.assign(l10n_util::GetStringF(IDS_KEYWORD_SEARCH,
219 element->short_name(), 219 element->short_name(),
220 remaining_input, 220 remaining_input,
221 &content_param_offsets)); 221 &content_param_offsets));
222 if (content_param_offsets.size() == 2) { 222 if (content_param_offsets.size() == 2) {
223 AutocompleteMatch::ClassifyLocationInString(content_param_offsets[1], 223 AutocompleteMatch::ClassifyLocationInString(content_param_offsets[1],
224 remaining_input.length(), match->contents.length(), 224 remaining_input.length(), match->contents.length(),
225 ACMatchClassification::NONE, &match->contents_class); 225 ACMatchClassification::NONE, &match->contents_class);
226 } else { 226 } else {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 AutocompleteMatch::ClassifyLocationInString(kKeywordDesc.find(L"%s"), 300 AutocompleteMatch::ClassifyLocationInString(kKeywordDesc.find(L"%s"),
301 prefix_length, 301 prefix_length,
302 result.description.length(), 302 result.description.length(),
303 ACMatchClassification::DIM, 303 ACMatchClassification::DIM,
304 &result.description_class); 304 &result.description_class);
305 305
306 result.transition = PageTransition::KEYWORD; 306 result.transition = PageTransition::KEYWORD;
307 307
308 return result; 308 return result;
309 } 309 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/search_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698