diff options
Diffstat (limited to 'chrome/browser/search_engines/template_url_model.cc')
| -rw-r--r-- | chrome/browser/search_engines/template_url_model.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc index e7bcb92..6c72f5f 100644 --- a/chrome/browser/search_engines/template_url_model.cc +++ b/chrome/browser/search_engines/template_url_model.cc @@ -308,7 +308,7 @@ void TemplateURLModel::RemoveAutoGeneratedSince(Time created_after) { RemoveAutoGeneratedBetween(created_after, Time()); } -void TemplateURLModel::RegisterExtensionKeyword(Extension* extension) { +void TemplateURLModel::RegisterExtensionKeyword(const Extension* extension) { // TODO(mpcomplete): disable the keyword when the extension is disabled. if (extension->omnibox_keyword().empty()) return; @@ -342,14 +342,14 @@ void TemplateURLModel::RegisterExtensionKeyword(Extension* extension) { NotifyObservers(); } -void TemplateURLModel::UnregisterExtensionKeyword(Extension* extension) { +void TemplateURLModel::UnregisterExtensionKeyword(const Extension* extension) { const TemplateURL* url = GetTemplateURLForExtension(extension); if (url) Remove(url); } const TemplateURL* TemplateURLModel::GetTemplateURLForExtension( - Extension* extension) const { + const Extension* extension) const { for (TemplateURLVector::const_iterator i = template_urls_.begin(); i != template_urls_.end(); ++i) { if ((*i)->IsExtensionKeyword() && (*i)->url()->GetHost() == extension->id()) @@ -606,8 +606,7 @@ void TemplateURLModel::SetKeywordSearchTermsForURL(const TemplateURL* t_url, profile_->GetHistoryService(Profile::EXPLICIT_ACCESS) : NULL; if (!history) return; - history->SetKeywordSearchTermsForURL(url, t_url->id(), - WideToUTF16Hack(term)); + history->SetKeywordSearchTermsForURL(url, t_url->id(), WideToUTF16Hack(term)); } void TemplateURLModel::Init(const Initializer* initializers, @@ -741,7 +740,7 @@ void TemplateURLModel::NotifyLoaded() { NotificationService::NoDetails()); for (size_t i = 0; i < pending_extension_ids_.size(); ++i) { - Extension* extension = profile_->GetExtensionsService()-> + const Extension* extension = profile_->GetExtensionsService()-> GetExtensionById(pending_extension_ids_[i], true); if (extension) RegisterExtensionKeyword(extension); @@ -1239,10 +1238,12 @@ void TemplateURLModel::RemoveNoNotify(const TemplateURL* template_url) { service_->RemoveKeyword(*template_url); if (profile_) { - HistoryService* history = - profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); - if (history) - history->DeleteAllSearchTermsForKeyword(template_url->id()); + Source<Profile> source(profile_); + TemplateURLID id = template_url->id(); + NotificationService::current()->Notify( + NotificationType::TEMPLATE_URL_REMOVED, + source, + Details<TemplateURLID>(&id)); } // We own the TemplateURL and need to delete it. |
