| 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_data.h" | 5 #include "components/search_engines/template_url_data.h" |
| 6 | 6 |
| 7 #include "base/guid.h" | 7 #include "base/guid.h" |
| 8 #include "base/i18n/case_conversion.h" | 8 #include "base/i18n/case_conversion.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 | 11 |
| 12 TemplateURLData::TemplateURLData() | 12 TemplateURLData::TemplateURLData() |
| 13 : show_in_default_list(false), | 13 : has_custom_keyword(false), |
| 14 show_in_default_list(false), |
| 14 safe_for_autoreplace(false), | 15 safe_for_autoreplace(false), |
| 15 id(0), | 16 id(0), |
| 16 date_created(base::Time::Now()), | 17 date_created(base::Time::Now()), |
| 17 last_modified(base::Time::Now()), | 18 last_modified(base::Time::Now()), |
| 18 created_by_policy(false), | 19 created_by_policy(false), |
| 19 usage_count(0), | 20 usage_count(0), |
| 20 prepopulate_id(0), | 21 prepopulate_id(0), |
| 21 sync_guid(base::GenerateGUID()), | 22 sync_guid(base::GenerateGUID()), |
| 22 keyword_(base::ASCIIToUTF16("dummy")), | 23 keyword_(base::ASCIIToUTF16("dummy")), |
| 23 url_("x") { | 24 url_("x") { |
| 24 } | 25 } |
| 25 | 26 |
| 26 TemplateURLData::~TemplateURLData() { | 27 TemplateURLData::~TemplateURLData() { |
| 27 } | 28 } |
| 28 | 29 |
| 29 void TemplateURLData::SetKeyword(const base::string16& keyword) { | 30 void TemplateURLData::SetKeyword(const base::string16& keyword) { |
| 30 DCHECK(!keyword.empty()); | 31 DCHECK(!keyword.empty()); |
| 31 | 32 |
| 32 // Case sensitive keyword matching is confusing. As such, we force all | 33 // Case sensitive keyword matching is confusing. As such, we force all |
| 33 // keywords to be lower case. | 34 // keywords to be lower case. |
| 34 keyword_ = base::i18n::ToLower(keyword); | 35 keyword_ = base::i18n::ToLower(keyword); |
| 35 } | 36 } |
| 36 | 37 |
| 37 void TemplateURLData::SetURL(const std::string& url) { | 38 void TemplateURLData::SetURL(const std::string& url) { |
| 38 DCHECK(!url.empty()); | 39 DCHECK(!url.empty()); |
| 39 url_ = url; | 40 url_ = url; |
| 40 } | 41 } |
| OLD | NEW |