| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 200 |
| 201 // TemplateURLRef::SearchTermsArgs -------------------------------------------- | 201 // TemplateURLRef::SearchTermsArgs -------------------------------------------- |
| 202 | 202 |
| 203 TemplateURLRef::SearchTermsArgs::SearchTermsArgs( | 203 TemplateURLRef::SearchTermsArgs::SearchTermsArgs( |
| 204 const base::string16& search_terms) | 204 const base::string16& search_terms) |
| 205 : search_terms(search_terms), | 205 : search_terms(search_terms), |
| 206 input_type(metrics::OmniboxInputType::INVALID), | 206 input_type(metrics::OmniboxInputType::INVALID), |
| 207 accepted_suggestion(NO_SUGGESTIONS_AVAILABLE), | 207 accepted_suggestion(NO_SUGGESTIONS_AVAILABLE), |
| 208 cursor_position(base::string16::npos), | 208 cursor_position(base::string16::npos), |
| 209 omnibox_start_margin(-1), | 209 omnibox_start_margin(-1), |
| 210 page_classification(AutocompleteInput::INVALID_SPEC), | 210 page_classification(metrics::OmniboxEventProto::INVALID_SPEC), |
| 211 bookmark_bar_pinned(false), | 211 bookmark_bar_pinned(false), |
| 212 append_extra_query_params(false), | 212 append_extra_query_params(false), |
| 213 force_instant_results(false), | 213 force_instant_results(false), |
| 214 from_app_list(false), | 214 from_app_list(false), |
| 215 contextual_search_params(ContextualSearchParams()) { | 215 contextual_search_params(ContextualSearchParams()) { |
| 216 } | 216 } |
| 217 | 217 |
| 218 TemplateURLRef::SearchTermsArgs::~SearchTermsArgs() { | 218 TemplateURLRef::SearchTermsArgs::~SearchTermsArgs() { |
| 219 } | 219 } |
| 220 | 220 |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 DCHECK(!i->is_post_param); | 1003 DCHECK(!i->is_post_param); |
| 1004 if (search_terms_args.accepted_suggestion >= 0 || | 1004 if (search_terms_args.accepted_suggestion >= 0 || |
| 1005 !search_terms_args.assisted_query_stats.empty()) { | 1005 !search_terms_args.assisted_query_stats.empty()) { |
| 1006 HandleReplacement( | 1006 HandleReplacement( |
| 1007 "oq", base::UTF16ToUTF8(encoded_original_query), *i, &url); | 1007 "oq", base::UTF16ToUTF8(encoded_original_query), *i, &url); |
| 1008 } | 1008 } |
| 1009 break; | 1009 break; |
| 1010 | 1010 |
| 1011 case GOOGLE_PAGE_CLASSIFICATION: | 1011 case GOOGLE_PAGE_CLASSIFICATION: |
| 1012 if (search_terms_args.page_classification != | 1012 if (search_terms_args.page_classification != |
| 1013 AutocompleteInput::INVALID_SPEC) { | 1013 metrics::OmniboxEventProto::INVALID_SPEC) { |
| 1014 HandleReplacement( | 1014 HandleReplacement( |
| 1015 "pgcl", base::IntToString(search_terms_args.page_classification), | 1015 "pgcl", base::IntToString(search_terms_args.page_classification), |
| 1016 *i, &url); | 1016 *i, &url); |
| 1017 } | 1017 } |
| 1018 break; | 1018 break; |
| 1019 | 1019 |
| 1020 case GOOGLE_RLZ: { | 1020 case GOOGLE_RLZ: { |
| 1021 DCHECK(!i->is_post_param); | 1021 DCHECK(!i->is_post_param); |
| 1022 // On platforms that don't have RLZ, we still want this branch | 1022 // On platforms that don't have RLZ, we still want this branch |
| 1023 // to happen so that we replace the RLZ template with the | 1023 // to happen so that we replace the RLZ template with the |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 // patterns. This means that given patterns | 1409 // patterns. This means that given patterns |
| 1410 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], | 1410 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], |
| 1411 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would | 1411 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would |
| 1412 // return false. This is important for at least Google, where such URLs | 1412 // return false. This is important for at least Google, where such URLs |
| 1413 // are invalid. | 1413 // are invalid. |
| 1414 return !search_terms->empty(); | 1414 return !search_terms->empty(); |
| 1415 } | 1415 } |
| 1416 } | 1416 } |
| 1417 return false; | 1417 return false; |
| 1418 } | 1418 } |
| OLD | NEW |