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