| Index: chrome/browser/webdata/web_data_service_base.cc
|
| diff --git a/chrome/browser/webdata/web_data_service_base.cc b/chrome/browser/webdata/web_data_service_base.cc
|
| index f81223317935bda5b16b8eb84a75f620cc15935a..aaf0d51a5bfe83646a33356f8b42e6076407c588 100644
|
| --- a/chrome/browser/webdata/web_data_service_base.cc
|
| +++ b/chrome/browser/webdata/web_data_service_base.cc
|
| @@ -9,7 +9,6 @@
|
| #include "base/stl_util.h"
|
| #include "base/threading/thread.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| -#include "chrome/browser/ui/profile_error_dialog.h"
|
| #include "chrome/browser/webdata/web_database_service.h"
|
| #include "chrome/common/chrome_constants.h"
|
| #include "chrome/common/chrome_notification_types.h"
|
| @@ -19,8 +18,6 @@
|
| #include "content/public/browser/notification_details.h"
|
| #include "content/public/browser/notification_service.h"
|
| #include "content/public/browser/notification_source.h"
|
| -#include "grit/chromium_strings.h"
|
| -#include "grit/generated_resources.h"
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| //
|
| @@ -32,8 +29,12 @@ using base::Bind;
|
| using base::Time;
|
| using content::BrowserThread;
|
|
|
| -WebDataServiceBase::WebDataServiceBase()
|
| - : db_loaded_(false) {
|
| +WebDataServiceBase::WebDataServiceBase(
|
| + scoped_refptr<WebDatabaseService> wdbs,
|
| + const ProfileErrorCallback& callback)
|
| + : wdbs_(wdbs),
|
| + db_loaded_(false),
|
| + profile_error_callback_(callback) {
|
| // WebDataService requires DB thread if instantiated.
|
| // Set WebDataServiceFactory::GetInstance()->SetTestingFactory(&profile, NULL)
|
| // if you do not want to instantiate WebDataService in your test.
|
| @@ -42,11 +43,12 @@ WebDataServiceBase::WebDataServiceBase()
|
|
|
| void WebDataServiceBase::ShutdownOnUIThread() {
|
| db_loaded_ = false;
|
| - ShutdownDatabase();
|
| + BrowserThread::PostTask(
|
| + BrowserThread::DB, FROM_HERE,
|
| + base::Bind(&WebDataServiceBase::ShutdownOnDBThread, this));
|
| }
|
|
|
| void WebDataServiceBase::Init(const base::FilePath& path) {
|
| - wdbs_.reset(new WebDatabaseService(path));
|
| wdbs_->LoadDatabase(Bind(&WebDataServiceBase::DatabaseInitOnDB, this));
|
| }
|
|
|
| @@ -82,8 +84,20 @@ WebDatabase* WebDataServiceBase::GetDatabase() {
|
| return wdbs_->GetDatabaseOnDB();
|
| }
|
|
|
| +base::SupportsUserData* WebDataServiceBase::GetDBUserData() {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
|
| + if (!db_thread_user_data_)
|
| + db_thread_user_data_.reset(new SupportsUserDataAggregatable());
|
| + return db_thread_user_data_.get();
|
| +}
|
| +
|
| WebDataServiceBase::~WebDataServiceBase() {
|
| - wdbs_.reset();
|
| + wdbs_ = NULL;
|
| +}
|
| +
|
| +void WebDataServiceBase::ShutdownOnDBThread() {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
|
| + db_thread_user_data_.reset();
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -93,9 +107,8 @@ WebDataServiceBase::~WebDataServiceBase() {
|
| ////////////////////////////////////////////////////////////////////////////////
|
|
|
| void WebDataServiceBase::DBInitFailed(sql::InitStatus sql_status) {
|
| - ShowProfileErrorDialog(
|
| - (sql_status == sql::INIT_FAILURE) ?
|
| - IDS_COULDNT_OPEN_PROFILE_ERROR : IDS_PROFILE_TOO_NEW_ERROR);
|
| + if (!profile_error_callback_.is_null())
|
| + profile_error_callback_.Run(sql_status);
|
| }
|
|
|
| void WebDataServiceBase::NotifyDatabaseLoadedOnUIThread() {
|
|
|