summaryrefslogtreecommitdiffstats
path: root/chrome/browser/search_engines
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-29 23:14:02 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-29 23:14:02 +0000
commit9adb9693e8a90bb63be325dbb5d3391f47f839ba (patch)
tree555765afd7bc851de6f3a2bf4a35151435d58d77 /chrome/browser/search_engines
parent5b5a5c976aead85a87ced0847c068012d3979cae (diff)
downloadchromium_src-9adb9693e8a90bb63be325dbb5d3391f47f839ba.zip
chromium_src-9adb9693e8a90bb63be325dbb5d3391f47f839ba.tar.gz
chromium_src-9adb9693e8a90bb63be325dbb5d3391f47f839ba.tar.bz2
Part 3 of immutable Extension refactor.
Make ExtensionsService hold const Extension pointers only. This ensures that extensions can't be modified after they're created, and lets us share them between threads. BUG=56558 TEST=no functional change Review URL: http://codereview.chromium.org/4138006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64517 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/search_engines')
-rw-r--r--chrome/browser/search_engines/template_url_model.cc8
-rw-r--r--chrome/browser/search_engines/template_url_model.h7
2 files changed, 8 insertions, 7 deletions
diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc
index e7bcb92..5b5b02e 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())
@@ -741,7 +741,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);
diff --git a/chrome/browser/search_engines/template_url_model.h b/chrome/browser/search_engines/template_url_model.h
index ce9a874..a16bad7 100644
--- a/chrome/browser/search_engines/template_url_model.h
+++ b/chrome/browser/search_engines/template_url_model.h
@@ -144,16 +144,17 @@ class TemplateURLModel : public WebDataServiceConsumer,
// If the given extension has an omnibox keyword, adds a TemplateURL for that
// keyword. Only 1 keyword is allowed for a given extension. If the keyword
// already exists for this extension, does nothing.
- void RegisterExtensionKeyword(Extension* extension);
+ void RegisterExtensionKeyword(const Extension* extension);
// Removes the TemplateURL containing the keyword for the given extension,
// if any.
- void UnregisterExtensionKeyword(Extension* extension);
+ void UnregisterExtensionKeyword(const Extension* extension);
// Returns the TemplateURL associated with the keyword for this extension.
// This works by checking the extension ID, not the keyword, so it will work
// even if the user changed the keyword.
- const TemplateURL* GetTemplateURLForExtension(Extension* extension) const;
+ const TemplateURL* GetTemplateURLForExtension(
+ const Extension* extension) const;
// Returns the set of URLs describing the keywords. The elements are owned
// by TemplateURLModel and should not be deleted.