| 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 DCHECK(!i->is_post_param); | 828 DCHECK(!i->is_post_param); |
| 829 if (!search_terms_args.assisted_query_stats.empty()) { | 829 if (!search_terms_args.assisted_query_stats.empty()) { |
| 830 // Get the base URL without substituting AQS to avoid infinite | 830 // Get the base URL without substituting AQS to avoid infinite |
| 831 // recursion. We need the URL to find out if it meets all | 831 // recursion. We need the URL to find out if it meets all |
| 832 // AQS requirements (e.g. HTTPS protocol check). | 832 // AQS requirements (e.g. HTTPS protocol check). |
| 833 // See TemplateURLRef::SearchTermsArgs for more details. | 833 // See TemplateURLRef::SearchTermsArgs for more details. |
| 834 SearchTermsArgs search_terms_args_without_aqs(search_terms_args); | 834 SearchTermsArgs search_terms_args_without_aqs(search_terms_args); |
| 835 search_terms_args_without_aqs.assisted_query_stats.clear(); | 835 search_terms_args_without_aqs.assisted_query_stats.clear(); |
| 836 GURL base_url(ReplaceSearchTermsUsingTermsData( | 836 GURL base_url(ReplaceSearchTermsUsingTermsData( |
| 837 search_terms_args_without_aqs, search_terms_data, NULL)); | 837 search_terms_args_without_aqs, search_terms_data, NULL)); |
| 838 if (base_url.SchemeIs(content::kHttpsScheme)) { | 838 if (base_url.SchemeIs(url::kHttpsScheme)) { |
| 839 HandleReplacement( | 839 HandleReplacement( |
| 840 "aqs", search_terms_args.assisted_query_stats, *i, &url); | 840 "aqs", search_terms_args.assisted_query_stats, *i, &url); |
| 841 } | 841 } |
| 842 } | 842 } |
| 843 break; | 843 break; |
| 844 | 844 |
| 845 case GOOGLE_BASE_URL: | 845 case GOOGLE_BASE_URL: |
| 846 DCHECK(!i->is_post_param); | 846 DCHECK(!i->is_post_param); |
| 847 HandleReplacement( | 847 HandleReplacement( |
| 848 std::string(), search_terms_data.GoogleBaseURLValue(), *i, &url); | 848 std::string(), search_terms_data.GoogleBaseURLValue(), *i, &url); |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 // patterns. This means that given patterns | 1330 // patterns. This means that given patterns |
| 1331 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], | 1331 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], |
| 1332 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would | 1332 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would |
| 1333 // return false. This is important for at least Google, where such URLs | 1333 // return false. This is important for at least Google, where such URLs |
| 1334 // are invalid. | 1334 // are invalid. |
| 1335 return !search_terms->empty(); | 1335 return !search_terms->empty(); |
| 1336 } | 1336 } |
| 1337 } | 1337 } |
| 1338 return false; | 1338 return false; |
| 1339 } | 1339 } |
| OLD | NEW |