Home | History | Annotate | Download | only in search_engines

Lines Matching refs:template_url

28 #include "components/search_engines/template_url.h"
540 bool TemplateURLService::Add(TemplateURL* template_url) {
542 if (!AddNoNotify(template_url, true))
548 void TemplateURLService::AddWithOverrides(TemplateURL* template_url,
554 template_url->data_.short_name = short_name;
555 template_url->data_.SetKeyword(keyword);
556 template_url->SetURL(url);
557 Add(template_url);
561 TemplateURL* template_url,
564 DCHECK(template_url);
565 DCHECK_EQ(kInvalidTemplateURLID, template_url->id());
569 template_url->show_in_default_list());
571 template_url->extension_info_.swap(info);
574 if (AddNoNotify(template_url, true)) {
575 if (template_url->extension_info_->wants_to_be_default_engine)
581 void TemplateURLService::Remove(TemplateURL* template_url) {
582 RemoveNoNotify(template_url);
901 const TemplateURL* template_url = GetTemplateURLForKeyword(keyword);
905 if (template_url) {
907 template_url->GetType() == TemplateURL::OMNIBOX_API_EXTENSION;
908 return template_url->AdjustedShortNameForLocaleDirection();
1455 TemplateURL* template_url = new TemplateURL(data);
1456 AddNoNotify(template_url, true);
1469 void TemplateURLService::RemoveFromMaps(TemplateURL* template_url) {
1470 const base::string16& keyword = template_url->keyword();
1472 if (keyword_to_template_map_[keyword] == template_url) {
1485 if ((turl != template_url) && (turl->keyword() == keyword) &&
1498 if (!template_url->sync_guid().empty())
1499 guid_to_template_map_.erase(template_url->sync_guid());
1502 provider_map_->Remove(template_url);
1506 void TemplateURLService::AddToMaps(TemplateURL* template_url) {
1508 template_url->GetType() == TemplateURL::OMNIBOX_API_EXTENSION;
1509 const base::string16& keyword = template_url->keyword();
1513 keyword_to_template_map_[keyword] = template_url;
1524 !CanReplace(template_url) : CanReplace(existing_url))
1525 keyword_to_template_map_[keyword] = template_url;
1528 if (!template_url->sync_guid().empty())
1529 guid_to_template_map_[template_url->sync_guid()] = template_url;
1532 provider_map_->Add(template_url, search_terms_data());
1692 TemplateURL* template_url,
1694 int prepopulate_id = template_url->prepopulate_id();
1695 if (template_url->prepopulate_id() == 0)
1705 MergeIntoPrepopulatedEngineData(template_url, prepopulated_urls[i]);
1706 template_url->CopyFrom(TemplateURL(*prepopulated_urls[i]));
1942 bool TemplateURLService::AddNoNotify(TemplateURL* template_url,
1944 DCHECK(template_url);
1947 DCHECK_EQ(kInvalidTemplateURLID, template_url->id());
1949 template_url) == template_urls_.end());
1950 template_url->data_.id = ++next_id_;
1953 template_url->ResetKeywordIfNecessary(search_terms_data(), false);
1954 // Check whether |template_url|'s keyword conflicts with any already in the
1957 GetTemplateURLForKeyword(template_url->keyword());
1959 // Check whether |template_url|'s keyword conflicts with any already in the
1971 DCHECK_NE(existing_keyword_turl, template_url);
1975 template_url->GetType();
1978 } else if (CanReplace(template_url) && are_same_type) {
1979 delete template_url;
1989 template_urls_.push_back(template_url);
1990 AddToMaps(template_url);
1993 (template_url->GetType() !=
1996 web_data_service_->AddKeyword(template_url->data());
1999 // template_url and add it to the guid_to_template_map_.
2001 template_url,
2008 void TemplateURLService::RemoveNoNotify(TemplateURL* template_url) {
2009 DCHECK(template_url != default_search_provider_);
2012 std::find(template_urls_.begin(), template_urls_.end(), template_url);
2016 RemoveFromMaps(template_url);
2021 if (template_url->GetType() != TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION) {
2023 web_data_service_->RemoveKeyword(template_url->id());
2027 template_url,
2035 client_->DeleteAllSearchTermsForKeyword(template_url->id());
2038 delete template_url;
2083 TemplateURL* template_url = *i;
2084 if (template_url->created_by_policy()) {
2086 TemplateURL::MatchesData(template_url, default_from_prefs,
2092 default_search_provider_ = template_url;
2099 RemoveFromMaps(template_url);
2102 web_data_service_->RemoveKeyword(template_url->id());
2103 delete template_url;
2288 TemplateURL* template_url = *i;
2289 DCHECK(template_url);
2290 if (template_url->sync_guid().empty() &&
2291 (template_url->GetType() !=
2293 template_url->data_.sync_guid = base::GenerateGUID();
2295 web_data_service_->UpdateKeyword(template_url->data());