diff options
author | levin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 23:23:26 +0000 |
---|---|---|
committer | levin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 23:23:26 +0000 |
commit | 10e0adff3c1f0bd8d53b504f2e64ff60cb5570da (patch) | |
tree | aa62cd3b3f62f41c94e1252c3c0e784fda210e1b /chrome/browser/search_engines/template_url_model.cc | |
parent | 2f6d086da79c737bc2a0ee3023ca80c608c75d19 (diff) | |
download | chromium_src-10e0adff3c1f0bd8d53b504f2e64ff60cb5570da.zip chromium_src-10e0adff3c1f0bd8d53b504f2e64ff60cb5570da.tar.gz chromium_src-10e0adff3c1f0bd8d53b504f2e64ff60cb5570da.tar.bz2 |
Prepare to load search provider information directly on the I/O thread.
BUG=38475
TEST=unit_tests --gtest_filter=Temp*:Search*:Key*
Review URL: http://codereview.chromium.org/3250011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58098 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/search_engines/template_url_model.cc')
-rw-r--r-- | chrome/browser/search_engines/template_url_model.cc | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc index b5cf1df..5a119e2 100644 --- a/chrome/browser/search_engines/template_url_model.cc +++ b/chrome/browser/search_engines/template_url_model.cc @@ -97,7 +97,6 @@ TemplateURLModel::~TemplateURLModel() { service_->CancelRequest(load_handle_); } - provider_map_->RemoveAll(); STLDeleteElements(&template_urls_); } @@ -236,7 +235,7 @@ const TemplateURL* TemplateURLModel::GetTemplateURLForKeyword( const TemplateURL* TemplateURLModel::GetTemplateURLForHost( const std::string& host) const { - return provider_map_->GetTemplateURLForHost(host); + return provider_map_.GetTemplateURLForHost(host); } void TemplateURLModel::Add(TemplateURL* template_url) { @@ -425,7 +424,6 @@ void TemplateURLModel::SetDefaultSearchProvider(const TemplateURL* url) { service_->SetDefaultSearchProvider(url); if (loaded_) { - provider_map_->SetDefault(url); FOR_EACH_OBSERVER(TemplateURLModelObserver, model_observers_, OnTemplateURLModelChanged()); } @@ -602,7 +600,6 @@ void TemplateURLModel::Init(const Initializer* initializers, } registrar_.Add(this, NotificationType::GOOGLE_URL_UPDATED, NotificationService::AllSources()); - provider_map_ = new SearchHostToURLsMap(); if (num_initializers > 0) { // This path is only hit by test code and is used to simulate a loaded @@ -647,7 +644,7 @@ void TemplateURLModel::RemoveFromMaps(const TemplateURL* template_url) { if (!template_url->keyword().empty()) keyword_to_template_map_.erase(template_url->keyword()); if (loaded_) - provider_map_->Remove(template_url); + provider_map_.Remove(template_url); } void TemplateURLModel::RemoveFromKeywordMapByPointer( @@ -668,7 +665,7 @@ void TemplateURLModel::AddToMaps(const TemplateURL* template_url) { if (!template_url->keyword().empty()) keyword_to_template_map_[template_url->keyword()] = template_url; if (loaded_) - provider_map_->Add(template_url); + provider_map_.Add(template_url); } void TemplateURLModel::SetTemplateURLs(const std::vector<TemplateURL*>& urls) { @@ -699,7 +696,7 @@ void TemplateURLModel::SetTemplateURLs(const std::vector<TemplateURL*>& urls) { void TemplateURLModel::ChangeToLoadedState() { DCHECK(!loaded_); - provider_map_->Init(template_urls_, default_search_provider_); + provider_map_.Init(template_urls_); loaded_ = true; } @@ -815,7 +812,7 @@ void TemplateURLModel::RegisterPrefs(PrefService* prefs) { bool TemplateURLModel::CanReplaceKeywordForHost( const std::string& host, const TemplateURL** to_replace) { - const TemplateURLSet* urls = provider_map_->GetURLsForHost(host); + const TemplateURLSet* urls = provider_map_.GetURLsForHost(host); if (urls) { for (TemplateURLSet::const_iterator i = urls->begin(); i != urls->end(); ++i) { @@ -849,7 +846,7 @@ void TemplateURLModel::Update(const TemplateURL* existing_turl, keyword_to_template_map_.erase(existing_turl->keyword()); // This call handles copying over the values (while retaining the id). - provider_map_->Update(existing_turl, new_values); + provider_map_.Update(existing_turl, new_values); if (!existing_turl->keyword().empty()) keyword_to_template_map_[existing_turl->keyword()] = existing_turl; @@ -881,7 +878,7 @@ void TemplateURLModel::UpdateKeywordSearchTermsForURL( } const TemplateURLSet* urls_for_host = - provider_map_->GetURLsForHost(row.url().host()); + provider_map_.GetURLsForHost(row.url().host()); if (!urls_for_host) return; @@ -1007,7 +1004,7 @@ void TemplateURLModel::GoogleBaseURLChanged() { } if (something_changed && loaded_) { - provider_map_->UpdateGoogleBaseURLs(); + provider_map_.UpdateGoogleBaseURLs(); FOR_EACH_OBSERVER(TemplateURLModelObserver, model_observers_, OnTemplateURLModelChanged()); } |