From ec3d1456bdbfd7d7806e51dd1e59088f691495ec Mon Sep 17 00:00:00 2001 From: "jochen@chromium.org" Date: Thu, 18 Feb 2010 10:02:26 +0000 Subject: Actually delete databases in CookiesTreeModel. BUG=34633 TEST=delete a database while it's opened in the renderer Review URL: http://codereview.chromium.org/600104 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39346 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/browsing_data_database_helper.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'chrome/browser/browsing_data_database_helper.cc') diff --git a/chrome/browser/browsing_data_database_helper.cc b/chrome/browser/browsing_data_database_helper.cc index addbf93..47489a5 100644 --- a/chrome/browser/browsing_data_database_helper.cc +++ b/chrome/browser/browsing_data_database_helper.cc @@ -8,17 +8,16 @@ #include "base/message_loop.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/profile.h" +#include "net/base/net_errors.h" #include "third_party/WebKit/WebKit/chromium/public/WebCString.h" #include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" -#include "webkit/database/database_tracker.h" #include "webkit/glue/webkit_glue.h" BrowsingDataDatabaseHelper::BrowsingDataDatabaseHelper(Profile* profile) - : profile_(profile), + : tracker_(profile->GetDatabaseTracker()), completion_callback_(NULL), is_fetching_(false) { - DCHECK(profile_); } BrowsingDataDatabaseHelper::~BrowsingDataDatabaseHelper() { @@ -52,9 +51,7 @@ void BrowsingDataDatabaseHelper::DeleteDatabase(const std::string& origin, void BrowsingDataDatabaseHelper::FetchDatabaseInfoInFileThread() { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); std::vector origins_info; - scoped_refptr tracker = - profile_->GetDatabaseTracker(); - if (tracker.get() && tracker->GetAllOriginsInfo(&origins_info)) { + if (tracker_.get() && tracker_->GetAllOriginsInfo(&origins_info)) { for (std::vector::const_iterator ori = origins_info.begin(); ori != origins_info.end(); ++ori) { scoped_ptr web_security_origin( @@ -64,7 +61,7 @@ void BrowsingDataDatabaseHelper::FetchDatabaseInfoInFileThread() { ori->GetAllDatabaseNames(&databases); for (std::vector::const_iterator db = databases.begin(); db != databases.end(); ++db) { - FilePath file_path = tracker->GetFullDBFilePath(ori->GetOrigin(), *db); + FilePath file_path = tracker_->GetFullDBFilePath(ori->GetOrigin(), *db); file_util::FileInfo file_info; if (file_util::GetFileInfo(file_path, &file_info)) { database_info_.push_back(DatabaseInfo( @@ -98,5 +95,7 @@ void BrowsingDataDatabaseHelper::DeleteDatabaseInFileThread( const std::string& origin, const std::string& name) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); - // TODO(jochen): delete the given database. + if (!tracker_.get()) + return; + tracker_->DeleteDatabase(UTF8ToUTF16(origin), UTF8ToUTF16(name), NULL); } -- cgit v1.1