summaryrefslogtreecommitdiffstats
path: root/chrome/browser/search_engines/template_url_service.h
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-10 20:17:55 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-10 20:17:55 +0000
commit3954c3a76994f8e3a8eec65f4d90580ba8ab0e80 (patch)
tree638d7ff635e7bda3f037785a2096f36ed7bb21c7 /chrome/browser/search_engines/template_url_service.h
parent6fae79736f73e541b0ec3951adb1c4f83ba7428e (diff)
downloadchromium_src-3954c3a76994f8e3a8eec65f4d90580ba8ab0e80.zip
chromium_src-3954c3a76994f8e3a8eec65f4d90580ba8ab0e80.tar.gz
chromium_src-3954c3a76994f8e3a8eec65f4d90580ba8ab0e80.tar.bz2
More misc. cleanups to minimize future refactoring diffs:
* Fix indentation * Slightly more const-correct TemplateURLData functions * Use EXPECT_XXX() where possible, but ASSERT_XXX() to avoid crashes on expectation failure * Remove unneeded #include * Simplify AlternateErrorPageTabObserver slightly by having constructor take a Profile * Shorter/simpler code * Fix ordering in some places to be more consistent (e.g. matching member declaration order) * Add some DCHECK()s to make more explicit some conditions that will become important later Also, template_url_service.cc has some functional changes: * GetTemplateURLForXXX() functions now return correct values when asked for the default search URL before the model has successfully loaded. I wound up needing this later to fix some case, but I forget what now; the change seems more correct anyway. * Similarly, UnregisterExtensionKeyword() now works correctly if called before loading has finished * RegisterExtensionKeyword() now does nothing when there's already a keyword for that extension, as the comments in the header claim. I'd think this wouldn't actually matter in normal use as I think extension upgrades first unregister the old extension? (I don't remember if I checked that, though) * Don't try to set an extension keyword as default -- this would be a bad UX as these are inherently async. I don't think this should have been possible anyway except maybe if there was some kind of unintentional overlap between extensions and policy?? * Don't try to save extension keywords to disk or sync them (as the extension system should be responsible for registering them if necessary on startup in both these cases). We already avoided syncing these, I just added checks in more places; I no longer recall if we had code to avoid persisting these to disk, I don't seem to see any at the moment. (sky?) BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/10033017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131619 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/search_engines/template_url_service.h')
-rw-r--r--chrome/browser/search_engines/template_url_service.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/chrome/browser/search_engines/template_url_service.h b/chrome/browser/search_engines/template_url_service.h
index 5fcfe74..2ce807d 100644
--- a/chrome/browser/search_engines/template_url_service.h
+++ b/chrome/browser/search_engines/template_url_service.h
@@ -406,6 +406,8 @@ class TemplateURLService : public WebDataServiceConsumer,
// Updates the information in |existing_turl| using the information from
// |new_values|, but the ID for |existing_turl| is retained.
// Notifying observers is the responsibility of the caller.
+ // NOTE: This should not be called with an extension keyword as there are no
+ // updates needed in that case.
void UpdateNoNotify(const TemplateURL* existing_turl,
const TemplateURL& new_values);
@@ -444,8 +446,11 @@ class TemplateURLService : public WebDataServiceConsumer,
// Adds a new TemplateURL to this model. TemplateURLService will own the
// reference, and delete it when the TemplateURL is removed.
+ // If |newly_adding| is false, we assume that this TemplateURL was already
+ // part of the model in the past, and therefore we don't need to do things
+ // like assign it an ID or notify sync.
// Caller is responsible for notifying observers.
- void AddNoNotify(TemplateURL* template_url);
+ void AddNoNotify(TemplateURL* template_url, bool newly_adding);
// Removes the keyword from the model. This deletes the supplied TemplateURL.
// This fails if the supplied template_url is the default search provider.