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::SearchTermsArgs( | 201 TemplateURLRef::SearchTermsArgs::SearchTermsArgs( |
202 const base::string16& search_terms) | 202 const base::string16& search_terms) |
203 : search_terms(search_terms), | 203 : search_terms(search_terms), |
204 accepted_suggestion(NO_SUGGESTIONS_AVAILABLE), | 204 accepted_suggestion(NO_SUGGESTIONS_AVAILABLE), |
205 cursor_position(base::string16::npos), | 205 cursor_position(base::string16::npos), |
206 omnibox_start_margin(-1), | 206 omnibox_start_margin(-1), |
207 page_classification(AutocompleteInput::INVALID_SPEC), | 207 page_classification(AutocompleteInput::INVALID_SPEC), |
208 bookmark_bar_pinned(false), | 208 bookmark_bar_pinned(false), |
209 append_extra_query_params(false), | 209 append_extra_query_params(false), |
210 force_instant_results(false) { | 210 force_instant_results(false), |
| 211 from_app_list(false) { |
211 } | 212 } |
212 | 213 |
213 TemplateURLRef::SearchTermsArgs::~SearchTermsArgs() { | 214 TemplateURLRef::SearchTermsArgs::~SearchTermsArgs() { |
214 } | 215 } |
215 | 216 |
216 | 217 |
217 // TemplateURLRef ------------------------------------------------------------- | 218 // TemplateURLRef ------------------------------------------------------------- |
218 | 219 |
219 TemplateURLRef::TemplateURLRef(TemplateURL* owner, Type type) | 220 TemplateURLRef::TemplateURLRef(TemplateURL* owner, Type type) |
220 : owner_(owner), | 221 : owner_(owner), |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 *i, &url); | 940 *i, &url); |
940 } | 941 } |
941 break; | 942 break; |
942 | 943 |
943 case GOOGLE_RLZ: { | 944 case GOOGLE_RLZ: { |
944 DCHECK(!i->is_post_param); | 945 DCHECK(!i->is_post_param); |
945 // On platforms that don't have RLZ, we still want this branch | 946 // On platforms that don't have RLZ, we still want this branch |
946 // to happen so that we replace the RLZ template with the | 947 // to happen so that we replace the RLZ template with the |
947 // empty string. (If we don't handle this case, we hit a | 948 // empty string. (If we don't handle this case, we hit a |
948 // NOTREACHED below.) | 949 // NOTREACHED below.) |
949 base::string16 rlz_string = search_terms_data.GetRlzParameterValue(); | 950 base::string16 rlz_string = search_terms_data.GetRlzParameterValue( |
| 951 search_terms_args.from_app_list); |
950 if (!rlz_string.empty()) { | 952 if (!rlz_string.empty()) { |
951 HandleReplacement("rlz", base::UTF16ToUTF8(rlz_string), *i, &url); | 953 HandleReplacement("rlz", base::UTF16ToUTF8(rlz_string), *i, &url); |
952 } | 954 } |
953 break; | 955 break; |
954 } | 956 } |
955 | 957 |
956 case GOOGLE_SEARCH_CLIENT: { | 958 case GOOGLE_SEARCH_CLIENT: { |
957 DCHECK(!i->is_post_param); | 959 DCHECK(!i->is_post_param); |
958 std::string client = search_terms_data.GetSearchClient(); | 960 std::string client = search_terms_data.GetSearchClient(); |
959 if (!client.empty()) | 961 if (!client.empty()) |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 // patterns. This means that given patterns | 1334 // patterns. This means that given patterns |
1333 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], | 1335 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], |
1334 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would | 1336 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would |
1335 // return false. This is important for at least Google, where such URLs | 1337 // return false. This is important for at least Google, where such URLs |
1336 // are invalid. | 1338 // are invalid. |
1337 return !search_terms->empty(); | 1339 return !search_terms->empty(); |
1338 } | 1340 } |
1339 } | 1341 } |
1340 return false; | 1342 return false; |
1341 } | 1343 } |
OLD | NEW |