OLD | NEW |
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_service_factory.h" | 10 #include "chrome/browser/search_engines/template_url_service_factory.h" |
11 #include "components/search_engines/template_url.h" | 11 #include "components/search_engines/template_url.h" |
12 #include "components/search_engines/template_url_service.h" | 12 #include "components/search_engines/template_url_service.h" |
13 #include "components/url_fixer/url_fixer.h" | 13 #include "components/url_formatter/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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // Parse the string as a URL to determine the scheme. If we need to, add the | 135 // Parse the string as a URL to determine the scheme. If we need to, add the |
136 // scheme. As the scheme may be expanded (as happens with {google:baseURL}) | 136 // scheme. As the scheme may be expanded (as happens with {google:baseURL}) |
137 // we need to replace the search terms before testing for the scheme. | 137 // we need to replace the search terms before testing for the scheme. |
138 TemplateURLData data; | 138 TemplateURLData data; |
139 data.SetURL(url); | 139 data.SetURL(url); |
140 TemplateURL t_url(data); | 140 TemplateURL t_url(data); |
141 std::string expanded_url(t_url.url_ref().ReplaceSearchTerms( | 141 std::string expanded_url(t_url.url_ref().ReplaceSearchTerms( |
142 TemplateURLRef::SearchTermsArgs(base::ASCIIToUTF16("x")), | 142 TemplateURLRef::SearchTermsArgs(base::ASCIIToUTF16("x")), |
143 TemplateURLServiceFactory::GetForProfile(profile_)->search_terms_data())); | 143 TemplateURLServiceFactory::GetForProfile(profile_)->search_terms_data())); |
144 url::Parsed parts; | 144 url::Parsed parts; |
145 std::string scheme(url_fixer::SegmentURL(expanded_url, &parts)); | 145 std::string scheme(url_formatter::SegmentURL(expanded_url, &parts)); |
146 if (!parts.scheme.is_valid()) | 146 if (!parts.scheme.is_valid()) |
147 url.insert(0, scheme + "://"); | 147 url.insert(0, scheme + "://"); |
148 | 148 |
149 return url; | 149 return url; |
150 } | 150 } |
OLD | NEW |