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
3 // found in the LICENSE file.
5 #include "components/search_engines/template_url_data.h"
8 #include "base/i18n/case_conversion.h"
9 #include "base/logging.h"
10 #include "base/strings/string_util.h"
11 #include "base/strings/utf_string_conversions.h"
13 TemplateURLData::TemplateURLData()
14 : show_in_default_list(false),
15 safe_for_autoreplace(false),
17 date_created(base::Time::Now()),
18 last_modified(base::Time::Now()),
19 created_by_policy(false),
22 sync_guid(base::GenerateGUID()),
23 keyword_(base::ASCIIToUTF16("dummy")),
27 TemplateURLData::~TemplateURLData() {
30 void TemplateURLData::SetShortName(const base::string16
& short_name
) {
31 DCHECK(!short_name
.empty());
33 // Remove tabs, carriage returns, and the like, as they can corrupt
34 // how the short name is displayed.
35 short_name_
= base::CollapseWhitespace(short_name
, true);
38 void TemplateURLData::SetKeyword(const base::string16
& keyword
) {
39 DCHECK(!keyword
.empty());
41 // Case sensitive keyword matching is confusing. As such, we force all
42 // keywords to be lower case.
43 keyword_
= base::i18n::ToLower(keyword
);
46 void TemplateURLData::SetURL(const std::string
& url
) {