| OLD | NEW |
| 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.h" | 5 #include "components/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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 std::string url(HandleReplacements(search_terms_args, search_terms_data, | 349 std::string url(HandleReplacements(search_terms_args, search_terms_data, |
| 350 post_content)); | 350 post_content)); |
| 351 | 351 |
| 352 GURL gurl(url); | 352 GURL gurl(url); |
| 353 if (!gurl.is_valid()) | 353 if (!gurl.is_valid()) |
| 354 return url; | 354 return url; |
| 355 | 355 |
| 356 std::vector<std::string> query_params; | 356 std::vector<std::string> query_params; |
| 357 if (search_terms_args.append_extra_query_params) { | 357 if (search_terms_args.append_extra_query_params) { |
| 358 std::string extra_params( | 358 std::string extra_params( |
| 359 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 359 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 360 switches::kExtraSearchQueryParams)); | 360 switches::kExtraSearchQueryParams)); |
| 361 if (!extra_params.empty()) | 361 if (!extra_params.empty()) |
| 362 query_params.push_back(extra_params); | 362 query_params.push_back(extra_params); |
| 363 } | 363 } |
| 364 if (!search_terms_args.suggest_query_params.empty()) | 364 if (!search_terms_args.suggest_query_params.empty()) |
| 365 query_params.push_back(search_terms_args.suggest_query_params); | 365 query_params.push_back(search_terms_args.suggest_query_params); |
| 366 if (!gurl.query().empty()) | 366 if (!gurl.query().empty()) |
| 367 query_params.push_back(gurl.query()); | 367 query_params.push_back(gurl.query()); |
| 368 | 368 |
| 369 if (query_params.empty()) | 369 if (query_params.empty()) |
| (...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 // patterns. This means that given patterns | 1464 // patterns. This means that given patterns |
| 1465 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], | 1465 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], |
| 1466 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would | 1466 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would |
| 1467 // return false. This is important for at least Google, where such URLs | 1467 // return false. This is important for at least Google, where such URLs |
| 1468 // are invalid. | 1468 // are invalid. |
| 1469 return !search_terms->empty(); | 1469 return !search_terms->empty(); |
| 1470 } | 1470 } |
| 1471 } | 1471 } |
| 1472 return false; | 1472 return false; |
| 1473 } | 1473 } |
| OLD | NEW |