diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-07 01:31:54 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-07 01:31:54 +0000 |
commit | 573889f2660f7a961adac4b81caf632a467f2134 (patch) | |
tree | 9a3e74a378ef2d7bcea0a88cb2d7a20a4343090e /chrome/browser/search_engines/search_host_to_urls_map.cc | |
parent | 7d8b707e12ac0a18491c2810269167226cd95deb (diff) | |
download | chromium_src-573889f2660f7a961adac4b81caf632a467f2134.zip chromium_src-573889f2660f7a961adac4b81caf632a467f2134.tar.gz chromium_src-573889f2660f7a961adac4b81caf632a467f2134.tar.bz2 |
Reland r131019: Move most TemplateURL data members to a new struct, TemplateURLData. This allows us to eliminate the TemplateURL NULL constructor, most public non-const TemplateURL functions, and most TemplateURL friend declarations.
This is also a necessary precursor to changing TemplateURLService's APIs to convert most "const TemplateURL*" cases to "TemplateURL*", which I'll explain once I actually make the change.
There is some awkwardness here around keywords, as keyword autogeneration requires a TemplateURL but the state bits are kept on TemplateURLData. This will go away in the future when I remove keyword autogeneration from TemplateURL entirely.
This differs from r131019 in that it fixes a memory error in chrome/browser/search_engines/util.cc:MergeEnginesFromPrepopulateData() where when we updated the vector to contain a new TemplateURL*, we didn't also update |default_search_engine| to point at the new URL if necessary.
BUG=none
TEST=none
TBR=sky,mnissler,atwilson
Review URL: https://chromiumcodereview.appspot.com/10021008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131224 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/search_engines/search_host_to_urls_map.cc')
-rw-r--r-- | chrome/browser/search_engines/search_host_to_urls_map.cc | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/chrome/browser/search_engines/search_host_to_urls_map.cc b/chrome/browser/search_engines/search_host_to_urls_map.cc index 3810f06..de42cc3 100644 --- a/chrome/browser/search_engines/search_host_to_urls_map.cc +++ b/chrome/browser/search_engines/search_host_to_urls_map.cc @@ -59,23 +59,6 @@ void SearchHostToURLsMap::Remove(const TemplateURL* template_url) { host_to_urls_map_.erase(host_to_urls_map_.find(host)); } -void SearchHostToURLsMap::Update(const TemplateURL* existing_turl, - const TemplateURL& new_values, - const SearchTermsData& search_terms_data) { - DCHECK(initialized_); - DCHECK(existing_turl); - - Remove(existing_turl); - - // Use the information from new_values but preserve existing_turl's id. - TemplateURLID previous_id = existing_turl->id(); - TemplateURL* modifiable_turl = const_cast<TemplateURL*>(existing_turl); - *modifiable_turl = new_values; - modifiable_turl->set_id(previous_id); - - Add(existing_turl, search_terms_data); -} - void SearchHostToURLsMap::UpdateGoogleBaseURLs( const SearchTermsData& search_terms_data) { DCHECK(initialized_); |