summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-25 11:21:26 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-25 11:21:26 +0000
commitbfc5de23b0ebb5b89ff46a2c476111f9163e1cc2 (patch)
treeaf48b9bd681413343aedb1b52342c309c88a4468
parent87ae6d0fc76ad312a0a080765dd4aa07485c094b (diff)
downloadchromium_src-bfc5de23b0ebb5b89ff46a2c476111f9163e1cc2.zip
chromium_src-bfc5de23b0ebb5b89ff46a2c476111f9163e1cc2.tar.gz
chromium_src-bfc5de23b0ebb5b89ff46a2c476111f9163e1cc2.tar.bz2
Always ask the user when adding a search engine from JS.
When adding a search provider from JS, and the autogenerated keyword clashes with an existing search engine, ask the user. BUG=15060 TEST=as described in the bug Review URL: http://codereview.chromium.org/2155001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48143 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/search_engines/template_url_fetcher.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/chrome/browser/search_engines/template_url_fetcher.cc b/chrome/browser/search_engines/template_url_fetcher.cc
index 3e8815e6..fe80f09 100644
--- a/chrome/browser/search_engines/template_url_fetcher.cc
+++ b/chrome/browser/search_engines/template_url_fetcher.cc
@@ -124,14 +124,18 @@ void TemplateURLFetcher::RequestDelegate::OnURLFetchComplete(
!model || !model->loaded() ||
!model->CanReplaceKeyword(keyword_, template_url->url()->url(),
&existing_url)) {
- // TODO(pamg): If we're coming from JS (not autodetected) and this URL
- // already exists in the model, consider bringing up the
- // EditKeywordController to edit it. This would be helpful feedback in
+ if (autodetected_ || !model || !model->loaded()) {
+ fetcher_->RequestCompleted(this);
+ // WARNING: RequestCompleted deletes us.
+ return;
+ }
+ // If we're coming from JS (neither autodetected nor failure to load the
+ // template URL model) and this URL already exists in the model, we bring
+ // up the EditKeywordController to edit it. This is helpful feedback in
// the case of clicking a button twice, and annoying in the case of a
// page that calls AddSearchProvider() in JS without a user action.
- fetcher_->RequestCompleted(this);
- // WARNING: RequestCompleted deletes us.
- return;
+ keyword_.clear();
+ existing_url = NULL;
}
if (existing_url)