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

Side by Side Diff: chrome/browser/ui/search_engines/edit_search_engine_controller.cc

Issue 320253004: Componentize URLFixerUpper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win64 fix 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/ui/search_engines/edit_search_engine_controller.h" 5 #include "chrome/browser/ui/search_engines/edit_search_engine_controller.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/search_engines/template_url.h" 10 #include "chrome/browser/search_engines/template_url.h"
11 #include "chrome/browser/search_engines/template_url_service.h" 11 #include "chrome/browser/search_engines/template_url_service.h"
12 #include "chrome/browser/search_engines/template_url_service_factory.h" 12 #include "chrome/browser/search_engines/template_url_service_factory.h"
13 #include "chrome/common/net/url_fixer_upper.h" 13 #include "components/url_fixer/url_fixer.h"
14 #include "content/public/browser/user_metrics.h" 14 #include "content/public/browser/user_metrics.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 16
17 using base::UserMetricsAction; 17 using base::UserMetricsAction;
18 18
19 EditSearchEngineController::EditSearchEngineController( 19 EditSearchEngineController::EditSearchEngineController(
20 TemplateURL* template_url, 20 TemplateURL* template_url,
21 EditSearchEngineControllerDelegate* edit_keyword_delegate, 21 EditSearchEngineControllerDelegate* edit_keyword_delegate,
22 Profile* profile) 22 Profile* profile)
23 : template_url_(template_url), 23 : template_url_(template_url),
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 // Parse the string as a URL to determine the scheme. If we need to, add the 133 // Parse the string as a URL to determine the scheme. If we need to, add the
134 // scheme. As the scheme may be expanded (as happens with {google:baseURL}) 134 // scheme. As the scheme may be expanded (as happens with {google:baseURL})
135 // we need to replace the search terms before testing for the scheme. 135 // we need to replace the search terms before testing for the scheme.
136 TemplateURLData data; 136 TemplateURLData data;
137 data.SetURL(url); 137 data.SetURL(url);
138 TemplateURL t_url(profile_, data); 138 TemplateURL t_url(profile_, data);
139 std::string expanded_url(t_url.url_ref().ReplaceSearchTerms( 139 std::string expanded_url(t_url.url_ref().ReplaceSearchTerms(
140 TemplateURLRef::SearchTermsArgs(base::ASCIIToUTF16("x")))); 140 TemplateURLRef::SearchTermsArgs(base::ASCIIToUTF16("x"))));
141 url::Parsed parts; 141 url::Parsed parts;
142 std::string scheme(URLFixerUpper::SegmentURL(expanded_url, &parts)); 142 std::string scheme(url_fixer::SegmentURL(expanded_url, &parts));
143 if (!parts.scheme.is_valid()) 143 if (!parts.scheme.is_valid())
144 url.insert(0, scheme + "://"); 144 url.insert(0, scheme + "://");
145 145
146 return url; 146 return url;
147 } 147 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_edit_model.cc ('k') | chrome/browser/ui/startup/startup_browser_creator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698