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/search_engines/template_url.h" | 5 #include "chrome/browser/search_engines/template_url.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 DCHECK(!i->is_post_param); | 796 DCHECK(!i->is_post_param); |
797 if (!search_terms_args.assisted_query_stats.empty()) { | 797 if (!search_terms_args.assisted_query_stats.empty()) { |
798 // Get the base URL without substituting AQS to avoid infinite | 798 // Get the base URL without substituting AQS to avoid infinite |
799 // recursion. We need the URL to find out if it meets all | 799 // recursion. We need the URL to find out if it meets all |
800 // AQS requirements (e.g. HTTPS protocol check). | 800 // AQS requirements (e.g. HTTPS protocol check). |
801 // See TemplateURLRef::SearchTermsArgs for more details. | 801 // See TemplateURLRef::SearchTermsArgs for more details. |
802 SearchTermsArgs search_terms_args_without_aqs(search_terms_args); | 802 SearchTermsArgs search_terms_args_without_aqs(search_terms_args); |
803 search_terms_args_without_aqs.assisted_query_stats.clear(); | 803 search_terms_args_without_aqs.assisted_query_stats.clear(); |
804 GURL base_url(ReplaceSearchTermsUsingTermsData( | 804 GURL base_url(ReplaceSearchTermsUsingTermsData( |
805 search_terms_args_without_aqs, search_terms_data, NULL)); | 805 search_terms_args_without_aqs, search_terms_data, NULL)); |
806 if (base_url.SchemeIs(chrome::kHttpsScheme)) { | 806 if (base_url.SchemeIs(content::kHttpsScheme)) { |
807 HandleReplacement( | 807 HandleReplacement( |
808 "aqs", search_terms_args.assisted_query_stats, *i, &url); | 808 "aqs", search_terms_args.assisted_query_stats, *i, &url); |
809 } | 809 } |
810 } | 810 } |
811 break; | 811 break; |
812 | 812 |
813 case GOOGLE_BASE_URL: | 813 case GOOGLE_BASE_URL: |
814 DCHECK(!i->is_post_param); | 814 DCHECK(!i->is_post_param); |
815 HandleReplacement( | 815 HandleReplacement( |
816 std::string(), search_terms_data.GoogleBaseURLValue(), *i, &url); | 816 std::string(), search_terms_data.GoogleBaseURLValue(), *i, &url); |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 // patterns. This means that given patterns | 1255 // patterns. This means that given patterns |
1256 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], | 1256 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], |
1257 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would | 1257 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would |
1258 // return false. This is important for at least Google, where such URLs | 1258 // return false. This is important for at least Google, where such URLs |
1259 // are invalid. | 1259 // are invalid. |
1260 return !search_terms->empty(); | 1260 return !search_terms->empty(); |
1261 } | 1261 } |
1262 } | 1262 } |
1263 return false; | 1263 return false; |
1264 } | 1264 } |
OLD | NEW |