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

Side by Side Diff: components/search_engines/template_url_service.cc

Issue 1841653003: Drop |languages| from {Format,Elide}Url* and IDNToUnicode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo in elide_url.cc Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/search_engines/template_url_service.h" 5 #include "components/search_engines/template_url_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 2167 matching lines...) Expand 10 before | Expand all | Expand 10 after
2178 if (!force) { 2178 if (!force) {
2179 // Already unique. 2179 // Already unique.
2180 if (!GetTemplateURLForKeyword(turl.keyword())) 2180 if (!GetTemplateURLForKeyword(turl.keyword()))
2181 return turl.keyword(); 2181 return turl.keyword();
2182 2182
2183 // First, try to return the generated keyword for the TemplateURL (except 2183 // First, try to return the generated keyword for the TemplateURL (except
2184 // for extensions, as their keywords are not associated with their URLs). 2184 // for extensions, as their keywords are not associated with their URLs).
2185 GURL gurl(turl.url()); 2185 GURL gurl(turl.url());
2186 if (gurl.is_valid() && 2186 if (gurl.is_valid() &&
2187 (turl.GetType() != TemplateURL::OMNIBOX_API_EXTENSION)) { 2187 (turl.GetType() != TemplateURL::OMNIBOX_API_EXTENSION)) {
2188 base::string16 keyword_candidate = TemplateURL::GenerateKeyword( 2188 base::string16 keyword_candidate = TemplateURL::GenerateKeyword(gurl);
2189 gurl, search_terms_data().GetAcceptLanguages());
2190 if (!GetTemplateURLForKeyword(keyword_candidate)) 2189 if (!GetTemplateURLForKeyword(keyword_candidate))
2191 return keyword_candidate; 2190 return keyword_candidate;
2192 } 2191 }
2193 } 2192 }
2194 2193
2195 // We try to uniquify the keyword by appending a special character to the end. 2194 // We try to uniquify the keyword by appending a special character to the end.
2196 // This is a best-effort approach where we try to preserve the original 2195 // This is a best-effort approach where we try to preserve the original
2197 // keyword and let the user do what they will after our attempt. 2196 // keyword and let the user do what they will after our attempt.
2198 base::string16 keyword_candidate(turl.keyword()); 2197 base::string16 keyword_candidate(turl.keyword());
2199 do { 2198 do {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
2436 2435
2437 if (most_recently_intalled_default) { 2436 if (most_recently_intalled_default) {
2438 base::AutoReset<DefaultSearchChangeOrigin> change_origin( 2437 base::AutoReset<DefaultSearchChangeOrigin> change_origin(
2439 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION); 2438 &dsp_change_origin_, DSP_CHANGE_OVERRIDE_SETTINGS_EXTENSION);
2440 default_search_manager_.SetExtensionControlledDefaultSearchEngine( 2439 default_search_manager_.SetExtensionControlledDefaultSearchEngine(
2441 most_recently_intalled_default->data()); 2440 most_recently_intalled_default->data());
2442 } else { 2441 } else {
2443 default_search_manager_.ClearExtensionControlledDefaultSearchEngine(); 2442 default_search_manager_.ClearExtensionControlledDefaultSearchEngine();
2444 } 2443 }
2445 } 2444 }
OLDNEW
« no previous file with comments | « components/search_engines/template_url_parser.cc ('k') | components/search_engines/template_url_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698