| 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/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 alternate_urls_list.GetString(i, &alternate_url); | 71 alternate_urls_list.GetString(i, &alternate_url); |
| 72 DCHECK(!alternate_url.empty()); | 72 DCHECK(!alternate_url.empty()); |
| 73 alternate_urls.push_back(alternate_url); | 73 alternate_urls.push_back(alternate_url); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 TemplateURLData::~TemplateURLData() { | 77 TemplateURLData::~TemplateURLData() { |
| 78 } | 78 } |
| 79 | 79 |
| 80 void TemplateURLData::SetShortName(const base::string16& short_name) { | 80 void TemplateURLData::SetShortName(const base::string16& short_name) { |
| 81 DCHECK(!short_name.empty()); | |
| 82 | |
| 83 // Remove tabs, carriage returns, and the like, as they can corrupt | 81 // Remove tabs, carriage returns, and the like, as they can corrupt |
| 84 // how the short name is displayed. | 82 // how the short name is displayed. |
| 85 short_name_ = base::CollapseWhitespace(short_name, true); | 83 short_name_ = base::CollapseWhitespace(short_name, true); |
| 86 } | 84 } |
| 87 | 85 |
| 88 void TemplateURLData::SetKeyword(const base::string16& keyword) { | 86 void TemplateURLData::SetKeyword(const base::string16& keyword) { |
| 89 DCHECK(!keyword.empty()); | 87 DCHECK(!keyword.empty()); |
| 90 | 88 |
| 91 // Case sensitive keyword matching is confusing. As such, we force all | 89 // Case sensitive keyword matching is confusing. As such, we force all |
| 92 // keywords to be lower case. | 90 // keywords to be lower case. |
| 93 keyword_ = base::i18n::ToLower(keyword); | 91 keyword_ = base::i18n::ToLower(keyword); |
| 94 } | 92 } |
| 95 | 93 |
| 96 void TemplateURLData::SetURL(const std::string& url) { | 94 void TemplateURLData::SetURL(const std::string& url) { |
| 97 DCHECK(!url.empty()); | 95 DCHECK(!url.empty()); |
| 98 url_ = url; | 96 url_ = url; |
| 99 } | 97 } |
| OLD | NEW |