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 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1269 if (TryEncoding(search_terms_args.search_terms, | 1269 if (TryEncoding(search_terms_args.search_terms, |
1270 search_terms_args.original_query, i->c_str(), | 1270 search_terms_args.original_query, i->c_str(), |
1271 is_in_query, encoded_terms, encoded_original_query)) { | 1271 is_in_query, encoded_terms, encoded_original_query)) { |
1272 *input_encoding = *i; | 1272 *input_encoding = *i; |
1273 return; | 1273 return; |
1274 } | 1274 } |
1275 } | 1275 } |
1276 NOTREACHED(); | 1276 NOTREACHED(); |
1277 } | 1277 } |
1278 | 1278 |
1279 void TemplateURL::CopyFrom(const TemplateURL& other) { | 1279 void TemplateURL::CopyFrom(const TemplateURLData& other) { |
1280 if (this == &other) | 1280 if (&data_ == &other) |
1281 return; | 1281 return; |
1282 | 1282 |
1283 profile_ = other.profile_; | 1283 data_ = other; |
Peter Kasting
2014/05/03 00:28:18
Not copying this seems highly error-prone. The pr
| |
1284 data_ = other.data_; | |
1285 url_ref_.InvalidateCachedValues(); | 1284 url_ref_.InvalidateCachedValues(); |
1286 suggestions_url_ref_.InvalidateCachedValues(); | 1285 suggestions_url_ref_.InvalidateCachedValues(); |
1287 instant_url_ref_.InvalidateCachedValues(); | 1286 instant_url_ref_.InvalidateCachedValues(); |
1288 SetPrepopulateId(other.data_.prepopulate_id); | 1287 SetPrepopulateId(other.prepopulate_id); |
1289 } | 1288 } |
1290 | 1289 |
1291 void TemplateURL::SetURL(const std::string& url) { | 1290 void TemplateURL::SetURL(const std::string& url) { |
1292 data_.SetURL(url); | 1291 data_.SetURL(url); |
1293 url_ref_.InvalidateCachedValues(); | 1292 url_ref_.InvalidateCachedValues(); |
1294 } | 1293 } |
1295 | 1294 |
1296 void TemplateURL::SetPrepopulateId(int id) { | 1295 void TemplateURL::SetPrepopulateId(int id) { |
1297 data_.prepopulate_id = id; | 1296 data_.prepopulate_id = id; |
1298 const bool prepopulated = id > 0; | 1297 const bool prepopulated = id > 0; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1330 // patterns. This means that given patterns | 1329 // patterns. This means that given patterns |
1331 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], | 1330 // [ "http://foo/#q={searchTerms}", "http://foo/?q={searchTerms}" ], |
1332 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would | 1331 // calling ExtractSearchTermsFromURL() on "http://foo/?q=bar#q=' would |
1333 // return false. This is important for at least Google, where such URLs | 1332 // return false. This is important for at least Google, where such URLs |
1334 // are invalid. | 1333 // are invalid. |
1335 return !search_terms->empty(); | 1334 return !search_terms->empty(); |
1336 } | 1335 } |
1337 } | 1336 } |
1338 return false; | 1337 return false; |
1339 } | 1338 } |
OLD | NEW |