summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/autocomplete_unittest.cc8
-rw-r--r--chrome/browser/autocomplete/keyword_provider.cc7
-rw-r--r--chrome/browser/autocomplete/keyword_provider_unittest.cc2
-rw-r--r--chrome/browser/autocomplete/search_provider.cc10
-rw-r--r--chrome/browser/autocomplete/search_provider.h6
-rw-r--r--chrome/browser/autocomplete/search_provider_unittest.cc4
6 files changed, 18 insertions, 19 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_unittest.cc b/chrome/browser/autocomplete/autocomplete_unittest.cc
index 9caf94b..b008294 100644
--- a/chrome/browser/autocomplete/autocomplete_unittest.cc
+++ b/chrome/browser/autocomplete/autocomplete_unittest.cc
@@ -184,7 +184,7 @@ void AutocompleteProviderTest::
// Reset the default TemplateURL.
TemplateURLData data;
data.SetURL("http://defaultturl/{searchTerms}");
- TemplateURL* default_t_url = new TemplateURL(data);
+ TemplateURL* default_t_url = new TemplateURL(&profile_, data);
TemplateURLService* turl_model =
TemplateURLServiceFactory::GetForProfile(&profile_);
turl_model->Add(default_t_url);
@@ -196,7 +196,7 @@ void AutocompleteProviderTest::
data.short_name = ASCIIToUTF16("k");
data.SetKeyword(ASCIIToUTF16("k"));
data.SetURL("http://keyword/{searchTerms}");
- TemplateURL* keyword_t_url = new TemplateURL(data);
+ TemplateURL* keyword_t_url = new TemplateURL(&profile_, data);
turl_model->Add(keyword_t_url);
ASSERT_NE(0, keyword_t_url->id());
@@ -228,7 +228,7 @@ void AutocompleteProviderTest::
data.short_name = ASCIIToUTF16("foo.com");
data.SetKeyword(ASCIIToUTF16("foo.com"));
data.SetURL("http://foo.com/{searchTerms}");
- TemplateURL* keyword_t_url = new TemplateURL(data);
+ TemplateURL* keyword_t_url = new TemplateURL(&profile_, data);
turl_model->Add(keyword_t_url);
ASSERT_NE(0, keyword_t_url->id());
@@ -236,7 +236,7 @@ void AutocompleteProviderTest::
data.short_name = ASCIIToUTF16("bar.com");
data.SetKeyword(ASCIIToUTF16("bar.com"));
data.SetURL("http://bar.com/{searchTerms}");
- keyword_t_url = new TemplateURL(data);
+ keyword_t_url = new TemplateURL(&profile_, data);
turl_model->Add(keyword_t_url);
ASSERT_NE(0, keyword_t_url->id());
diff --git a/chrome/browser/autocomplete/keyword_provider.cc b/chrome/browser/autocomplete/keyword_provider.cc
index df2d00e..8c707b7 100644
--- a/chrome/browser/autocomplete/keyword_provider.cc
+++ b/chrome/browser/autocomplete/keyword_provider.cc
@@ -394,9 +394,8 @@ void KeywordProvider::FillInURLAndContents(
// input, but we rely on later canonicalization functions to do more
// fixup to make the URL valid if necessary.
DCHECK(element_ref.SupportsReplacement());
- match->destination_url = GURL(element_ref.ReplaceSearchTermsUsingProfile(
- profile, remaining_input, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE,
- string16()));
+ match->destination_url = GURL(element_ref.ReplaceSearchTerms(
+ remaining_input, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
std::vector<size_t> content_param_offsets;
match->contents.assign(l10n_util::GetStringFUTF16(message_id,
element->short_name(),
@@ -437,7 +436,7 @@ AutocompleteMatch KeywordProvider::CreateAutocompleteMatch(
DCHECK(model);
// Get keyword data from data store.
const TemplateURL* element = model->GetTemplateURLForKeyword(keyword);
- DCHECK(element && !element->url().empty());
+ DCHECK(element);
const bool supports_replacement = element->url_ref().SupportsReplacement();
// Create an edit entry of "[keyword] [remaining input]". This is helpful
diff --git a/chrome/browser/autocomplete/keyword_provider_unittest.cc b/chrome/browser/autocomplete/keyword_provider_unittest.cc
index dd3a2e9..685608d 100644
--- a/chrome/browser/autocomplete/keyword_provider_unittest.cc
+++ b/chrome/browser/autocomplete/keyword_provider_unittest.cc
@@ -205,7 +205,7 @@ TEST_F(KeywordProviderTest, AddKeyword) {
string16 keyword(ASCIIToUTF16("foo"));
data.SetKeyword(keyword);
data.SetURL("http://www.google.com/foo?q={searchTerms}");
- TemplateURL* template_url = new TemplateURL(data);
+ TemplateURL* template_url = new TemplateURL(NULL, data);
model_->Add(template_url);
ASSERT_TRUE(template_url == model_->GetTemplateURLForKeyword(keyword));
}
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index 90a0309..35ebbfc 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -89,6 +89,7 @@ bool SearchProvider::query_suggest_immediately_ = false;
SearchProvider::SearchProvider(ACProviderListener* listener, Profile* profile)
: AutocompleteProvider(listener, profile, "Search"),
+ providers_(profile),
suggest_results_pending_(0),
have_suggest_results_(false),
instant_finalized_(false) {
@@ -461,9 +462,8 @@ content::URLFetcher* SearchProvider::CreateSuggestFetcher(
const string16& text) {
DCHECK(suggestions_url.SupportsReplacement());
content::URLFetcher* fetcher = content::URLFetcher::Create(id,
- GURL(suggestions_url.ReplaceSearchTermsUsingProfile(
- profile_, text, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE,
- string16())),
+ GURL(suggestions_url.ReplaceSearchTerms(text,
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16())),
content::URLFetcher::GET, this);
fetcher->SetRequestContext(profile_->GetRequestContext());
fetcher->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES);
@@ -906,8 +906,8 @@ void SearchProvider::AddMatchToMap(const string16& query_string,
const TemplateURLRef& search_url = provider.url_ref();
DCHECK(search_url.SupportsReplacement());
- match.destination_url = GURL(search_url.ReplaceSearchTermsUsingProfile(
- profile_, query_string, accepted_suggestion, input_text));
+ match.destination_url = GURL(search_url.ReplaceSearchTerms(query_string,
+ accepted_suggestion, input_text));
// Search results don't look like URLs.
match.transition = is_keyword ?
diff --git a/chrome/browser/autocomplete/search_provider.h b/chrome/browser/autocomplete/search_provider.h
index 188ae3f..d4ab56e 100644
--- a/chrome/browser/autocomplete/search_provider.h
+++ b/chrome/browser/autocomplete/search_provider.h
@@ -90,9 +90,9 @@ class SearchProvider : public AutocompleteProvider,
// . The keyword provider. This is used if the user has typed in a keyword.
class Providers {
public:
- Providers()
- : cached_default_provider_(TemplateURLData()),
- cached_keyword_provider_(TemplateURLData()),
+ explicit Providers(Profile* profile)
+ : cached_default_provider_(profile, TemplateURLData()),
+ cached_keyword_provider_(profile, TemplateURLData()),
default_provider_(NULL),
keyword_provider_(NULL) {
}
diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc
index e6e3a3d..976e3cd 100644
--- a/chrome/browser/autocomplete/search_provider_unittest.cc
+++ b/chrome/browser/autocomplete/search_provider_unittest.cc
@@ -125,7 +125,7 @@ void SearchProviderTest::SetUp() {
data.short_name = ASCIIToUTF16("t");
data.SetURL("http://defaultturl/{searchTerms}");
data.suggestions_url = "http://defaultturl2/{searchTerms}";
- default_t_url_ = new TemplateURL(data);
+ default_t_url_ = new TemplateURL(&profile_, data);
turl_model->Add(default_t_url_);
turl_model->SetDefaultSearchProvider(default_t_url_);
TemplateURLID default_provider_id = default_t_url_->id();
@@ -139,7 +139,7 @@ void SearchProviderTest::SetUp() {
data.SetKeyword(ASCIIToUTF16("k"));
data.SetURL("http://keyword/{searchTerms}");
data.suggestions_url = "http://suggest_keyword/{searchTerms}";
- keyword_t_url_ = new TemplateURL(data);
+ keyword_t_url_ = new TemplateURL(&profile_, data);
turl_model->Add(keyword_t_url_);
ASSERT_NE(0, keyword_t_url_->id());