summaryrefslogtreecommitdiffstats
path: root/chrome/browser/search_engines/template_url_model.cc
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-18 00:19:44 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-18 00:19:44 +0000
commitb3b2d6e76a2cfbb02933298c565d3718b0288774 (patch)
tree548c4d8fe0b7c7d22c44e045a61c7719977359cc /chrome/browser/search_engines/template_url_model.cc
parent5786d3d3a7cd151fb5dc0aa2f1f0d84460fb6cdf (diff)
downloadchromium_src-b3b2d6e76a2cfbb02933298c565d3718b0288774.zip
chromium_src-b3b2d6e76a2cfbb02933298c565d3718b0288774.tar.gz
chromium_src-b3b2d6e76a2cfbb02933298c565d3718b0288774.tar.bz2
Fixes two related bugs:
. If we can't init the web db a dialog is shown to the user. . If we can't init the web db the default search provider no longer becomes NULL. BUG=28374 TEST=none Review URL: http://codereview.chromium.org/501090 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34901 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.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc
index cbad64a..a356ad0 100644
--- a/chrome/browser/search_engines/template_url_model.cc
+++ b/chrome/browser/search_engines/template_url_model.cc
@@ -59,6 +59,7 @@ class TemplateURLModel::LessWithPrefix {
TemplateURLModel::TemplateURLModel(Profile* profile)
: profile_(profile),
loaded_(false),
+ load_failed_(false),
load_handle_(0),
default_search_provider_(NULL),
next_id_(1) {
@@ -70,6 +71,7 @@ TemplateURLModel::TemplateURLModel(const Initializer* initializers,
const int count)
: profile_(NULL),
loaded_(true),
+ load_failed_(false),
load_handle_(0),
service_(NULL),
default_search_provider_(NULL),
@@ -521,7 +523,7 @@ void TemplateURLModel::SetDefaultSearchProvider(const TemplateURL* url) {
}
const TemplateURL* TemplateURLModel::GetDefaultSearchProvider() {
- if (loaded_)
+ if (loaded_ && !load_failed_)
return default_search_provider_;
if (!prefs_default_search_provider_.get()) {
@@ -576,8 +578,10 @@ void TemplateURLModel::OnWebDataServiceRequestDone(
load_handle_ = 0;
if (!result) {
- // Results are null if the database went away.
+ // Results are null if the database went away or (most likely) wasn't
+ // loaded.
loaded_ = true;
+ load_failed_ = true;
NotifyLoaded();
return;
}