summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browsing_data
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-07 17:08:22 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-07 17:08:22 +0000
commit69aa91ae3f86c865b909c0539cae56e329363216 (patch)
tree2d08d21d23046176c76a42273368b8ff557f7c04 /chrome/browser/browsing_data
parent85ad3220a81f2b4b13481af945a0ba48c6ee1a51 (diff)
downloadchromium_src-69aa91ae3f86c865b909c0539cae56e329363216.zip
chromium_src-69aa91ae3f86c865b909c0539cae56e329363216.tar.gz
chromium_src-69aa91ae3f86c865b909c0539cae56e329363216.tar.bz2
Implement delete methods for the various CannedBrowsingDataHelpers.
This will allow individual cookies and other site data to be deleted via the CookieTreeModel GUI. As a result of this change, updates to the various storage systems will be pushed to the canned helpers after creation of the CookieTreeModel. Also removes a pimpl for BrowsingDataIndexedDBHelper since no other canned helpers followed this pattern. BUG=168996 TEST=No visible changes yet. Deleters covered by unit tests. TBR=dbeam@chromium.org Review URL: https://codereview.chromium.org/124183002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243315 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browsing_data')
-rw-r--r--chrome/browser/browsing_data/browsing_data_appcache_helper.cc6
-rw-r--r--chrome/browser/browsing_data/browsing_data_appcache_helper.h1
-rw-r--r--chrome/browser/browsing_data/browsing_data_appcache_helper_unittest.cc26
-rw-r--r--chrome/browser/browsing_data/browsing_data_cookie_helper.cc10
-rw-r--r--chrome/browser/browsing_data/browsing_data_cookie_helper.h1
-rw-r--r--chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc29
-rw-r--r--chrome/browser/browsing_data/browsing_data_database_helper.cc31
-rw-r--r--chrome/browser/browsing_data/browsing_data_database_helper.h2
-rw-r--r--chrome/browser/browsing_data/browsing_data_database_helper_unittest.cc31
-rw-r--r--chrome/browser/browsing_data/browsing_data_file_system_helper.cc17
-rw-r--r--chrome/browser/browsing_data/browsing_data_file_system_helper.h6
-rw-r--r--chrome/browser/browsing_data/browsing_data_indexed_db_helper.cc119
-rw-r--r--chrome/browser/browsing_data/browsing_data_indexed_db_helper.h67
-rw-r--r--chrome/browser/browsing_data/browsing_data_indexed_db_helper_browsertest.cc13
-rw-r--r--chrome/browser/browsing_data/browsing_data_indexed_db_helper_unittest.cc49
-rw-r--r--chrome/browser/browsing_data/browsing_data_local_storage_helper.cc37
-rw-r--r--chrome/browser/browsing_data/browsing_data_local_storage_helper.h4
-rw-r--r--chrome/browser/browsing_data/browsing_data_local_storage_helper_unittest.cc21
-rw-r--r--chrome/browser/browsing_data/cookies_tree_model.cc4
-rw-r--r--chrome/browser/browsing_data/cookies_tree_model_unittest.cc2
-rw-r--r--chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.cc11
-rw-r--r--chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.h4
22 files changed, 307 insertions, 184 deletions
diff --git a/chrome/browser/browsing_data/browsing_data_appcache_helper.cc b/chrome/browser/browsing_data/browsing_data_appcache_helper.cc
index c50c13c..9810d02 100644
--- a/chrome/browser/browsing_data/browsing_data_appcache_helper.cc
+++ b/chrome/browser/browsing_data/browsing_data_appcache_helper.cc
@@ -153,4 +153,10 @@ void CannedBrowsingDataAppCacheHelper::StartFetching(
completion_callback.Run();
}
+void CannedBrowsingDataAppCacheHelper::DeleteAppCacheGroup(
+ const GURL& manifest_url) {
+ info_collection_->infos_by_origin.erase(manifest_url.GetOrigin());
+ BrowsingDataAppCacheHelper::DeleteAppCacheGroup(manifest_url);
+}
+
CannedBrowsingDataAppCacheHelper::~CannedBrowsingDataAppCacheHelper() {}
diff --git a/chrome/browser/browsing_data/browsing_data_appcache_helper.h b/chrome/browser/browsing_data/browsing_data_appcache_helper.h
index 6f3ac7a..8a23ba2 100644
--- a/chrome/browser/browsing_data/browsing_data_appcache_helper.h
+++ b/chrome/browser/browsing_data/browsing_data_appcache_helper.h
@@ -81,6 +81,7 @@ class CannedBrowsingDataAppCacheHelper : public BrowsingDataAppCacheHelper {
// BrowsingDataAppCacheHelper methods.
virtual void StartFetching(const base::Closure& completion_callback) OVERRIDE;
+ virtual void DeleteAppCacheGroup(const GURL& manifest_url) OVERRIDE;
private:
virtual ~CannedBrowsingDataAppCacheHelper();
diff --git a/chrome/browser/browsing_data/browsing_data_appcache_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_appcache_helper_unittest.cc
index b06f9ae..4589574 100644
--- a/chrome/browser/browsing_data/browsing_data_appcache_helper_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_appcache_helper_unittest.cc
@@ -31,6 +31,10 @@ class TestCompletionCallback {
} // namespace
class CannedBrowsingDataAppCacheHelperTest : public testing::Test {
+ public:
+ CannedBrowsingDataAppCacheHelperTest()
+ : thread_bundle_(content::TestBrowserThreadBundle::REAL_IO_THREAD) {}
+
content::TestBrowserThreadBundle thread_bundle_;
};
@@ -108,6 +112,28 @@ TEST_F(CannedBrowsingDataAppCacheHelperTest, Empty) {
ASSERT_TRUE(helper->empty());
}
+TEST_F(CannedBrowsingDataAppCacheHelperTest, Delete) {
+ TestingProfile profile;
+
+ GURL manifest1("http://example.com/manifest1.xml");
+ GURL manifest2("http://foo.example.com/manifest2.xml");
+ GURL manifest3("http://bar.example.com/manifest3.xml");
+
+ scoped_refptr<CannedBrowsingDataAppCacheHelper> helper(
+ new CannedBrowsingDataAppCacheHelper(&profile));
+
+ EXPECT_TRUE(helper->empty());
+ helper->AddAppCache(manifest1);
+ helper->AddAppCache(manifest2);
+ helper->AddAppCache(manifest3);
+ EXPECT_FALSE(helper->empty());
+ EXPECT_EQ(3u, helper->GetAppCacheCount());
+ helper->DeleteAppCacheGroup(manifest2);
+ EXPECT_EQ(2u, helper->GetAppCacheCount());
+ EXPECT_TRUE(helper->GetOriginAppCacheInfoMap().find(manifest2) ==
+ helper->GetOriginAppCacheInfoMap().end());
+}
+
TEST_F(CannedBrowsingDataAppCacheHelperTest, IgnoreExtensionsAndDevTools) {
TestingProfile profile;
diff --git a/chrome/browser/browsing_data/browsing_data_cookie_helper.cc b/chrome/browser/browsing_data/browsing_data_cookie_helper.cc
index 5551642..3d65a87 100644
--- a/chrome/browser/browsing_data/browsing_data_cookie_helper.cc
+++ b/chrome/browser/browsing_data/browsing_data_cookie_helper.cc
@@ -187,6 +187,16 @@ void CannedBrowsingDataCookieHelper::StartFetching(
callback.Run(cookie_list);
}
+void CannedBrowsingDataCookieHelper::DeleteCookie(
+ const net::CanonicalCookie& cookie) {
+ for (OriginCookieListMap::iterator it = origin_cookie_list_map_.begin();
+ it != origin_cookie_list_map_.end();
+ ++it) {
+ DeleteMatchingCookie(cookie, it->second);
+ }
+ BrowsingDataCookieHelper::DeleteCookie(cookie);
+}
+
bool CannedBrowsingDataCookieHelper::DeleteMatchingCookie(
const net::CanonicalCookie& add_cookie,
net::CookieList* cookie_list) {
diff --git a/chrome/browser/browsing_data/browsing_data_cookie_helper.h b/chrome/browser/browsing_data/browsing_data_cookie_helper.h
index a94c0c1..7d9315b 100644
--- a/chrome/browser/browsing_data/browsing_data_cookie_helper.h
+++ b/chrome/browser/browsing_data/browsing_data_cookie_helper.h
@@ -132,6 +132,7 @@ class CannedBrowsingDataCookieHelper : public BrowsingDataCookieHelper {
// BrowsingDataCookieHelper methods.
virtual void StartFetching(
const net::CookieMonster::GetCookieListCallback& callback) OVERRIDE;
+ virtual void DeleteCookie(const net::CanonicalCookie& cookie) OVERRIDE;
// Returns the number of stored cookies.
size_t GetCookieCount() const;
diff --git a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
index 7e02b83..faa861c 100644
--- a/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_cookie_helper_unittest.cc
@@ -217,6 +217,35 @@ TEST_F(BrowsingDataCookieHelperTest, DeleteCookie) {
base::RunLoop().RunUntilIdle();
}
+TEST_F(BrowsingDataCookieHelperTest, CannedDeleteCookie) {
+ CreateCookiesForTest();
+ scoped_refptr<CannedBrowsingDataCookieHelper> helper(
+ new CannedBrowsingDataCookieHelper(
+ testing_profile_->GetRequestContext()));
+
+ ASSERT_TRUE(helper->empty());
+
+ const GURL origin1("http://www.google.com");
+ const GURL origin2("http://www.gmail.google.com");
+ helper->AddChangedCookie(origin1, origin1, "A=1", net::CookieOptions());
+ helper->AddChangedCookie(origin2, origin2, "B=1", net::CookieOptions());
+
+ helper->StartFetching(
+ base::Bind(&BrowsingDataCookieHelperTest::FetchCallback,
+ base::Unretained(this)));
+ base::RunLoop().RunUntilIdle();
+
+ EXPECT_EQ(2u, helper->GetCookieCount());
+
+ helper->DeleteCookie(cookie_list_[0]);
+
+ EXPECT_EQ(1u, helper->GetCookieCount());
+ helper->StartFetching(
+ base::Bind(&BrowsingDataCookieHelperTest::DeleteCallback,
+ base::Unretained(this)));
+ base::RunLoop().RunUntilIdle();
+}
+
TEST_F(BrowsingDataCookieHelperTest, CannedDomainCookie) {
const GURL origin("http://www.google.com");
net::CookieList cookie;
diff --git a/chrome/browser/browsing_data/browsing_data_database_helper.cc b/chrome/browser/browsing_data/browsing_data_database_helper.cc
index 887d1c3..dbe28dd 100644
--- a/chrome/browser/browsing_data/browsing_data_database_helper.cc
+++ b/chrome/browser/browsing_data/browsing_data_database_helper.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/file_util.h"
-#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browsing_data/browsing_data_helper.h"
#include "chrome/browser/profiles/profile.h"
@@ -191,20 +190,16 @@ CannedBrowsingDataDatabaseHelper::GetPendingDatabaseInfo() {
void CannedBrowsingDataDatabaseHelper::StartFetching(
const base::Callback<void(const std::list<DatabaseInfo>&)>& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(!is_fetching_);
- DCHECK_EQ(false, callback.is_null());
-
- is_fetching_ = true;
- completion_callback_ = callback;
+ DCHECK(!callback.is_null());
- database_info_.clear();
+ std::list<DatabaseInfo> result;
for (std::set<PendingDatabaseInfo>::const_iterator
info = pending_database_info_.begin();
info != pending_database_info_.end(); ++info) {
DatabaseIdentifier identifier =
DatabaseIdentifier::CreateFromOrigin(info->origin);
- database_info_.push_back(DatabaseInfo(
+ result.push_back(DatabaseInfo(
identifier,
info->name,
info->description,
@@ -213,8 +208,24 @@ void CannedBrowsingDataDatabaseHelper::StartFetching(
}
BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&CannedBrowsingDataDatabaseHelper::NotifyInUIThread, this));
+ BrowserThread::UI, FROM_HERE, base::Bind(callback, result));
+}
+
+void CannedBrowsingDataDatabaseHelper::DeleteDatabase(
+ const std::string& origin_identifier,
+ const std::string& name) {
+ GURL origin =
+ webkit_database::DatabaseIdentifier::Parse(origin_identifier).ToOrigin();
+ for (std::set<PendingDatabaseInfo>::iterator it =
+ pending_database_info_.begin();
+ it != pending_database_info_.end();
+ ++it) {
+ if (it->origin == origin && it->name == name) {
+ pending_database_info_.erase(it);
+ break;
+ }
+ }
+ BrowsingDataDatabaseHelper::DeleteDatabase(origin_identifier, name);
}
CannedBrowsingDataDatabaseHelper::~CannedBrowsingDataDatabaseHelper() {}
diff --git a/chrome/browser/browsing_data/browsing_data_database_helper.h b/chrome/browser/browsing_data/browsing_data_database_helper.h
index 963f178..a769527 100644
--- a/chrome/browser/browsing_data/browsing_data_database_helper.h
+++ b/chrome/browser/browsing_data/browsing_data_database_helper.h
@@ -142,6 +142,8 @@ class CannedBrowsingDataDatabaseHelper : public BrowsingDataDatabaseHelper {
virtual void StartFetching(
const base::Callback<void(const std::list<DatabaseInfo>&)>& callback)
OVERRIDE;
+ virtual void DeleteDatabase(const std::string& origin_identifier,
+ const std::string& name) OVERRIDE;
private:
virtual ~CannedBrowsingDataDatabaseHelper();
diff --git a/chrome/browser/browsing_data/browsing_data_database_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_database_helper_unittest.cc
index 276cb89..0663ee0 100644
--- a/chrome/browser/browsing_data/browsing_data_database_helper_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_database_helper_unittest.cc
@@ -7,9 +7,12 @@
#include "chrome/test/base/testing_profile.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "webkit/common/database/database_identifier.h"
namespace {
+using webkit_database::DatabaseIdentifier;
+
class CannedBrowsingDataDatabaseHelperTest : public testing::Test {
content::TestBrowserThreadBundle thread_bundle_;
};
@@ -30,6 +33,34 @@ TEST_F(CannedBrowsingDataDatabaseHelperTest, Empty) {
ASSERT_TRUE(helper->empty());
}
+TEST_F(CannedBrowsingDataDatabaseHelperTest, Delete) {
+ TestingProfile profile;
+
+ const GURL origin1("http://host1:9000");
+ const char db1[] = "db1";
+
+ const GURL origin2("http://example.com");
+ const char db2[] = "db2";
+
+ const GURL origin3("http://foo.example.com");
+ const char db3[] = "db3";
+
+ scoped_refptr<CannedBrowsingDataDatabaseHelper> helper(
+ new CannedBrowsingDataDatabaseHelper(&profile));
+
+ EXPECT_TRUE(helper->empty());
+ helper->AddDatabase(origin1, db1, std::string());
+ helper->AddDatabase(origin2, db2, std::string());
+ helper->AddDatabase(origin3, db3, std::string());
+ EXPECT_EQ(3u, helper->GetDatabaseCount());
+ helper->DeleteDatabase(
+ DatabaseIdentifier::CreateFromOrigin(origin2).ToString(), db1);
+ EXPECT_EQ(3u, helper->GetDatabaseCount());
+ helper->DeleteDatabase(
+ DatabaseIdentifier::CreateFromOrigin(origin2).ToString(), db2);
+ EXPECT_EQ(2u, helper->GetDatabaseCount());
+}
+
TEST_F(CannedBrowsingDataDatabaseHelperTest, IgnoreExtensionsAndDevTools) {
TestingProfile profile;
diff --git a/chrome/browser/browsing_data/browsing_data_file_system_helper.cc b/chrome/browser/browsing_data/browsing_data_file_system_helper.cc
index 49b68d9..62c7ee4 100644
--- a/chrome/browser/browsing_data/browsing_data_file_system_helper.cc
+++ b/chrome/browser/browsing_data/browsing_data_file_system_helper.cc
@@ -7,7 +7,6 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
#include "base/sequenced_task_runner.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -255,20 +254,8 @@ size_t CannedBrowsingDataFileSystemHelper::GetFileSystemCount() const {
void CannedBrowsingDataFileSystemHelper::StartFetching(
const base::Callback<void(const std::list<FileSystemInfo>&)>& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(!is_fetching_);
- DCHECK_EQ(false, callback.is_null());
- is_fetching_ = true;
- completion_callback_ = callback;
+ DCHECK(!callback.is_null());
BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&CannedBrowsingDataFileSystemHelper::NotifyOnUIThread, this));
-}
-
-void CannedBrowsingDataFileSystemHelper::NotifyOnUIThread() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(is_fetching_);
- completion_callback_.Run(file_system_info_);
- completion_callback_.Reset();
- is_fetching_ = false;
+ BrowserThread::UI, FROM_HERE, base::Bind(callback, file_system_info_));
}
diff --git a/chrome/browser/browsing_data/browsing_data_file_system_helper.h b/chrome/browser/browsing_data/browsing_data_file_system_helper.h
index d0c1b6f..9e81157 100644
--- a/chrome/browser/browsing_data/browsing_data_file_system_helper.h
+++ b/chrome/browser/browsing_data/browsing_data_file_system_helper.h
@@ -46,7 +46,7 @@ class BrowsingDataFileSystemHelper
// Detailed information about a file system, including it's origin GURL,
// the amount of data (in bytes) for each sandboxed filesystem type.
struct FileSystemInfo {
- FileSystemInfo(const GURL& origin);
+ explicit FileSystemInfo(const GURL& origin);
~FileSystemInfo();
// The origin for which the information is relevant.
@@ -144,10 +144,6 @@ class CannedBrowsingDataFileSystemHelper
CannedBrowsingDataFileSystemHelper();
virtual ~CannedBrowsingDataFileSystemHelper();
- // Triggers the success callback as the end of a StartFetching workflow. This
- // must be called on the UI thread.
- void NotifyOnUIThread();
-
// Holds the current list of filesystems returned to the client. Access to
// |file_system_info_| is triggered indirectly via the UI thread and guarded
// by |is_fetching_|. This means |file_system_info_| is only accessed while
diff --git a/chrome/browser/browsing_data/browsing_data_indexed_db_helper.cc b/chrome/browser/browsing_data/browsing_data_indexed_db_helper.cc
index afbd30d..5b95e6d0 100644
--- a/chrome/browser/browsing_data/browsing_data_indexed_db_helper.cc
+++ b/chrome/browser/browsing_data/browsing_data_indexed_db_helper.cc
@@ -10,7 +10,6 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browsing_data/browsing_data_helper.h"
@@ -21,61 +20,17 @@ using content::BrowserThread;
using content::IndexedDBContext;
using content::IndexedDBInfo;
-namespace {
-
-class BrowsingDataIndexedDBHelperImpl : public BrowsingDataIndexedDBHelper {
- public:
- explicit BrowsingDataIndexedDBHelperImpl(
- IndexedDBContext* indexed_db_context);
-
- virtual void StartFetching(
- const base::Callback<void(const std::list<IndexedDBInfo>&)>&
- callback) OVERRIDE;
- virtual void DeleteIndexedDB(const GURL& origin) OVERRIDE;
-
- private:
- virtual ~BrowsingDataIndexedDBHelperImpl();
-
- // Enumerates all indexed database files in the IndexedDB thread.
- void FetchIndexedDBInfoInIndexedDBThread();
- // Notifies the completion callback in the UI thread.
- void NotifyInUIThread();
- // Delete a single indexed database in the IndexedDB thread.
- void DeleteIndexedDBInIndexedDBThread(const GURL& origin);
-
- scoped_refptr<IndexedDBContext> indexed_db_context_;
-
- // Access to |indexed_db_info_| is triggered indirectly via the UI thread and
- // guarded by |is_fetching_|. This means |indexed_db_info_| is only accessed
- // while |is_fetching_| is true. The flag |is_fetching_| is only accessed on
- // the UI thread.
- // In the context of this class |indexed_db_info_| is only accessed on the
- // context's IndexedDB thread.
- std::list<IndexedDBInfo> indexed_db_info_;
-
- // This only mutates on the UI thread.
- base::Callback<void(const std::list<IndexedDBInfo>&)> completion_callback_;
-
- // Indicates whether or not we're currently fetching information:
- // it's true when StartFetching() is called in the UI thread, and it's reset
- // after we notified the callback in the UI thread.
- // This only mutates on the UI thread.
- bool is_fetching_;
-
- DISALLOW_COPY_AND_ASSIGN(BrowsingDataIndexedDBHelperImpl);
-};
-
-BrowsingDataIndexedDBHelperImpl::BrowsingDataIndexedDBHelperImpl(
+BrowsingDataIndexedDBHelper::BrowsingDataIndexedDBHelper(
IndexedDBContext* indexed_db_context)
: indexed_db_context_(indexed_db_context),
is_fetching_(false) {
DCHECK(indexed_db_context_.get());
}
-BrowsingDataIndexedDBHelperImpl::~BrowsingDataIndexedDBHelperImpl() {
+BrowsingDataIndexedDBHelper::~BrowsingDataIndexedDBHelper() {
}
-void BrowsingDataIndexedDBHelperImpl::StartFetching(
+void BrowsingDataIndexedDBHelper::StartFetching(
const base::Callback<void(const std::list<IndexedDBInfo>&)>& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!is_fetching_);
@@ -86,22 +41,22 @@ void BrowsingDataIndexedDBHelperImpl::StartFetching(
indexed_db_context_->TaskRunner()->PostTask(
FROM_HERE,
base::Bind(
- &BrowsingDataIndexedDBHelperImpl::FetchIndexedDBInfoInIndexedDBThread,
+ &BrowsingDataIndexedDBHelper::FetchIndexedDBInfoInIndexedDBThread,
this));
}
-void BrowsingDataIndexedDBHelperImpl::DeleteIndexedDB(
+void BrowsingDataIndexedDBHelper::DeleteIndexedDB(
const GURL& origin) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
indexed_db_context_->TaskRunner()->PostTask(
FROM_HERE,
base::Bind(
- &BrowsingDataIndexedDBHelperImpl::DeleteIndexedDBInIndexedDBThread,
+ &BrowsingDataIndexedDBHelper::DeleteIndexedDBInIndexedDBThread,
this,
origin));
}
-void BrowsingDataIndexedDBHelperImpl::FetchIndexedDBInfoInIndexedDBThread() {
+void BrowsingDataIndexedDBHelper::FetchIndexedDBInfoInIndexedDBThread() {
DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread());
std::vector<IndexedDBInfo> origins = indexed_db_context_->GetAllOriginsInfo();
for (std::vector<IndexedDBInfo>::const_iterator iter = origins.begin();
@@ -115,10 +70,10 @@ void BrowsingDataIndexedDBHelperImpl::FetchIndexedDBInfoInIndexedDBThread() {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- base::Bind(&BrowsingDataIndexedDBHelperImpl::NotifyInUIThread, this));
+ base::Bind(&BrowsingDataIndexedDBHelper::NotifyInUIThread, this));
}
-void BrowsingDataIndexedDBHelperImpl::NotifyInUIThread() {
+void BrowsingDataIndexedDBHelper::NotifyInUIThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(is_fetching_);
completion_callback_.Run(indexed_db_info_);
@@ -126,21 +81,12 @@ void BrowsingDataIndexedDBHelperImpl::NotifyInUIThread() {
is_fetching_ = false;
}
-void BrowsingDataIndexedDBHelperImpl::DeleteIndexedDBInIndexedDBThread(
+void BrowsingDataIndexedDBHelper::DeleteIndexedDBInIndexedDBThread(
const GURL& origin) {
DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread());
indexed_db_context_->DeleteForOrigin(origin);
}
-} // namespace
-
-
-// static
-BrowsingDataIndexedDBHelper* BrowsingDataIndexedDBHelper::Create(
- IndexedDBContext* indexed_db_context) {
- return new BrowsingDataIndexedDBHelperImpl(indexed_db_context);
-}
-
CannedBrowsingDataIndexedDBHelper::
PendingIndexedDBInfo::PendingIndexedDBInfo(const GURL& origin,
const base::string16& name)
@@ -159,8 +105,9 @@ bool CannedBrowsingDataIndexedDBHelper::PendingIndexedDBInfo::operator<(
return origin < other.origin;
}
-CannedBrowsingDataIndexedDBHelper::CannedBrowsingDataIndexedDBHelper()
- : is_fetching_(false) {
+CannedBrowsingDataIndexedDBHelper::CannedBrowsingDataIndexedDBHelper(
+ content::IndexedDBContext* context)
+ : BrowsingDataIndexedDBHelper(context) {
}
CannedBrowsingDataIndexedDBHelper::~CannedBrowsingDataIndexedDBHelper() {}
@@ -168,7 +115,7 @@ CannedBrowsingDataIndexedDBHelper::~CannedBrowsingDataIndexedDBHelper() {}
CannedBrowsingDataIndexedDBHelper* CannedBrowsingDataIndexedDBHelper::Clone() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
CannedBrowsingDataIndexedDBHelper* clone =
- new CannedBrowsingDataIndexedDBHelper();
+ new CannedBrowsingDataIndexedDBHelper(indexed_db_context_);
clone->pending_indexed_db_info_ = pending_indexed_db_info_;
clone->indexed_db_info_ = indexed_db_info_;
@@ -204,32 +151,30 @@ CannedBrowsingDataIndexedDBHelper::GetIndexedDBInfo() const {
void CannedBrowsingDataIndexedDBHelper::StartFetching(
const base::Callback<void(const std::list<IndexedDBInfo>&)>& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(!is_fetching_);
- DCHECK_EQ(false, callback.is_null());
+ DCHECK(!callback.is_null());
- is_fetching_ = true;
- completion_callback_ = callback;
-
- // We post a task to emulate async fetching behavior.
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&CannedBrowsingDataIndexedDBHelper::
- ConvertPendingInfo,
- this));
-}
-
-void CannedBrowsingDataIndexedDBHelper::ConvertPendingInfo() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- indexed_db_info_.clear();
+ std::list<IndexedDBInfo> result;
for (std::set<PendingIndexedDBInfo>::const_iterator
pending_info = pending_indexed_db_info_.begin();
pending_info != pending_indexed_db_info_.end(); ++pending_info) {
IndexedDBInfo info(
pending_info->origin, 0, base::Time(), base::FilePath(), 0);
- indexed_db_info_.push_back(info);
+ result.push_back(info);
}
- completion_callback_.Run(indexed_db_info_);
- completion_callback_.Reset();
- is_fetching_ = false;
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE, base::Bind(callback, result));
+}
+
+void CannedBrowsingDataIndexedDBHelper::DeleteIndexedDB(
+ const GURL& origin) {
+ for (std::set<PendingIndexedDBInfo>::iterator it =
+ pending_indexed_db_info_.begin();
+ it != pending_indexed_db_info_.end(); ) {
+ if (it->origin == origin)
+ pending_indexed_db_info_.erase(it++);
+ else
+ ++it;
+ }
+ BrowsingDataIndexedDBHelper::DeleteIndexedDB(origin);
}
diff --git a/chrome/browser/browsing_data/browsing_data_indexed_db_helper.h b/chrome/browser/browsing_data/browsing_data_indexed_db_helper.h
index 614f24b..e036c3f 100644
--- a/chrome/browser/browsing_data/browsing_data_indexed_db_helper.h
+++ b/chrome/browser/browsing_data/browsing_data_indexed_db_helper.h
@@ -30,21 +30,51 @@ class BrowsingDataIndexedDBHelper
public:
// Create a BrowsingDataIndexedDBHelper instance for the indexed databases
// stored in |profile|'s user data directory.
- static BrowsingDataIndexedDBHelper* Create(
- content::IndexedDBContext* context);
+ explicit BrowsingDataIndexedDBHelper(content::IndexedDBContext* content);
// Starts the fetching process, which will notify its completion via
// callback.
// This must be called only in the UI thread.
virtual void StartFetching(
const base::Callback<void(const std::list<content::IndexedDBInfo>&)>&
- callback) = 0;
+ callback);
// Requests a single indexed database to be deleted in the IndexedDB thread.
- virtual void DeleteIndexedDB(const GURL& origin) = 0;
+ virtual void DeleteIndexedDB(const GURL& origin);
protected:
+ virtual ~BrowsingDataIndexedDBHelper();
+
+ scoped_refptr<content::IndexedDBContext> indexed_db_context_;
+
+ // Access to |indexed_db_info_| is triggered indirectly via the UI thread and
+ // guarded by |is_fetching_|. This means |indexed_db_info_| is only accessed
+ // while |is_fetching_| is true. The flag |is_fetching_| is only accessed on
+ // the UI thread.
+ // In the context of this class |indexed_db_info_| is only accessed on the
+ // context's IndexedDB thread.
+ std::list<content::IndexedDBInfo> indexed_db_info_;
+
+ // This only mutates on the UI thread.
+ base::Callback<void(const std::list<content::IndexedDBInfo>&)>
+ completion_callback_;
+
+ // Indicates whether or not we're currently fetching information:
+ // it's true when StartFetching() is called in the UI thread, and it's reset
+ // after we notified the callback in the UI thread.
+ // This only mutates on the UI thread.
+ bool is_fetching_;
+
+ private:
friend class base::RefCountedThreadSafe<BrowsingDataIndexedDBHelper>;
- virtual ~BrowsingDataIndexedDBHelper() {}
+
+ // Enumerates all indexed database files in the IndexedDB thread.
+ void FetchIndexedDBInfoInIndexedDBThread();
+ // Notifies the completion callback in the UI thread.
+ void NotifyInUIThread();
+ // Delete a single indexed database in the IndexedDB thread.
+ void DeleteIndexedDBInIndexedDBThread(const GURL& origin);
+
+ DISALLOW_COPY_AND_ASSIGN(BrowsingDataIndexedDBHelper);
};
// This class is an implementation of BrowsingDataIndexedDBHelper that does
@@ -64,7 +94,8 @@ class CannedBrowsingDataIndexedDBHelper
base::string16 name;
};
- CannedBrowsingDataIndexedDBHelper();
+ explicit CannedBrowsingDataIndexedDBHelper(
+ content::IndexedDBContext* context);
// Return a copy of the IndexedDB helper. Only one consumer can use the
// StartFetching method at a time, so we need to create a copy of the helper
@@ -93,35 +124,13 @@ class CannedBrowsingDataIndexedDBHelper
virtual void StartFetching(
const base::Callback<void(const std::list<content::IndexedDBInfo>&)>&
callback) OVERRIDE;
-
- virtual void DeleteIndexedDB(const GURL& origin) OVERRIDE {}
+ virtual void DeleteIndexedDB(const GURL& origin) OVERRIDE;
private:
virtual ~CannedBrowsingDataIndexedDBHelper();
- // Convert the pending indexed db info to indexed db info objects.
- void ConvertPendingInfo();
-
std::set<PendingIndexedDBInfo> pending_indexed_db_info_;
- // Access to |indexed_db_info_| is triggered indirectly via the UI thread and
- // guarded by |is_fetching_|. This means |indexed_db_info_| is only accessed
- // while |is_fetching_| is true. The flag |is_fetching_| is only accessed on
- // the UI thread.
- // In the context of this class |indexed_db_info_| is only accessed on the UI
- // thread.
- std::list<content::IndexedDBInfo> indexed_db_info_;
-
- // This only mutates on the UI thread.
- base::Callback<void(const std::list<content::IndexedDBInfo>&)>
- completion_callback_;
-
- // Indicates whether or not we're currently fetching information:
- // it's true when StartFetching() is called in the UI thread, and it's reset
- // after we notified the callback in the UI thread.
- // This only mutates on the UI thread.
- bool is_fetching_;
-
DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataIndexedDBHelper);
};
diff --git a/chrome/browser/browsing_data/browsing_data_indexed_db_helper_browsertest.cc b/chrome/browser/browsing_data/browsing_data_indexed_db_helper_browsertest.cc
index 049d4a8..0deb553 100644
--- a/chrome/browser/browsing_data/browsing_data_indexed_db_helper_browsertest.cc
+++ b/chrome/browser/browsing_data/browsing_data_indexed_db_helper_browsertest.cc
@@ -16,13 +16,20 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/test/base/in_process_browser_test.h"
+#include "content/public/browser/storage_partition.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
typedef BrowsingDataHelperCallback<content::IndexedDBInfo>
TestCompletionCallback;
-typedef InProcessBrowserTest BrowsingDataIndexedDBHelperTest;
+class BrowsingDataIndexedDBHelperTest : public InProcessBrowserTest {
+ public:
+ content::IndexedDBContext* IndexedDBContext() {
+ return content::BrowserContext::GetDefaultStoragePartition(
+ browser()->profile())->GetIndexedDBContext();
+ }
+};
IN_PROC_BROWSER_TEST_F(BrowsingDataIndexedDBHelperTest, CannedAddIndexedDB) {
const GURL origin1("http://host1:1/");
@@ -30,7 +37,7 @@ IN_PROC_BROWSER_TEST_F(BrowsingDataIndexedDBHelperTest, CannedAddIndexedDB) {
const base::string16 description(base::ASCIIToUTF16("description"));
scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper(
- new CannedBrowsingDataIndexedDBHelper());
+ new CannedBrowsingDataIndexedDBHelper(IndexedDBContext()));
helper->AddIndexedDB(origin1, description);
helper->AddIndexedDB(origin2, description);
@@ -55,7 +62,7 @@ IN_PROC_BROWSER_TEST_F(BrowsingDataIndexedDBHelperTest, CannedUnique) {
const base::string16 description(base::ASCIIToUTF16("description"));
scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper(
- new CannedBrowsingDataIndexedDBHelper());
+ new CannedBrowsingDataIndexedDBHelper(IndexedDBContext()));
helper->AddIndexedDB(origin, description);
helper->AddIndexedDB(origin, description);
diff --git a/chrome/browser/browsing_data/browsing_data_indexed_db_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_indexed_db_helper_unittest.cc
index fc59ce6..3873414 100644
--- a/chrome/browser/browsing_data/browsing_data_indexed_db_helper_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_indexed_db_helper_unittest.cc
@@ -2,22 +2,41 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "testing/gtest/include/gtest/gtest.h"
+#include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h"
+#include "base/message_loop/message_loop_proxy.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/browser/browser_context.h"
+#include "content/public/browser/storage_partition.h"
+#include "content/public/test/test_browser_thread_bundle.h"
+#include "testing/gtest/include/gtest/gtest.h"
namespace {
-typedef testing::Test CannedBrowsingDataIndexedDBHelperTest;
+class CannedBrowsingDataIndexedDBHelperTest : public testing::Test {
+ public:
+ virtual void SetUp() OVERRIDE {
+ IndexedDBContext()->SetTaskRunnerForTesting(
+ base::MessageLoopProxy::current().get());
+ }
+
+ content::IndexedDBContext* IndexedDBContext() {
+ return content::BrowserContext::GetDefaultStoragePartition(&profile_)->
+ GetIndexedDBContext();
+ }
+
+ private:
+ content::TestBrowserThreadBundle thread_bundle_;
+ TestingProfile profile_;
+};
TEST_F(CannedBrowsingDataIndexedDBHelperTest, Empty) {
const GURL origin("http://host1:1/");
const base::string16 description(base::ASCIIToUTF16("description"));
scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper(
- new CannedBrowsingDataIndexedDBHelper());
+ new CannedBrowsingDataIndexedDBHelper(IndexedDBContext()));
ASSERT_TRUE(helper->empty());
helper->AddIndexedDB(origin, description);
@@ -26,13 +45,33 @@ TEST_F(CannedBrowsingDataIndexedDBHelperTest, Empty) {
ASSERT_TRUE(helper->empty());
}
+TEST_F(CannedBrowsingDataIndexedDBHelperTest, Delete) {
+ const GURL origin1("http://host1:9000");
+ const base::string16 db1(base::ASCIIToUTF16("db1"));
+
+ const GURL origin2("http://example.com");
+ const base::string16 db2(base::ASCIIToUTF16("db2"));
+ const base::string16 db3(base::ASCIIToUTF16("db3"));
+
+ scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper(
+ new CannedBrowsingDataIndexedDBHelper(IndexedDBContext()));
+
+ EXPECT_TRUE(helper->empty());
+ helper->AddIndexedDB(origin1, db1);
+ helper->AddIndexedDB(origin2, db2);
+ helper->AddIndexedDB(origin2, db3);
+ EXPECT_EQ(3u, helper->GetIndexedDBCount());
+ helper->DeleteIndexedDB(origin2);
+ EXPECT_EQ(1u, helper->GetIndexedDBCount());
+}
+
TEST_F(CannedBrowsingDataIndexedDBHelperTest, IgnoreExtensionsAndDevTools) {
const GURL origin1("chrome-extension://abcdefghijklmnopqrstuvwxyz/");
const GURL origin2("chrome-devtools://abcdefghijklmnopqrstuvwxyz/");
const base::string16 description(base::ASCIIToUTF16("description"));
scoped_refptr<CannedBrowsingDataIndexedDBHelper> helper(
- new CannedBrowsingDataIndexedDBHelper());
+ new CannedBrowsingDataIndexedDBHelper(IndexedDBContext()));
ASSERT_TRUE(helper->empty());
helper->AddIndexedDB(origin1, description);
diff --git a/chrome/browser/browsing_data/browsing_data_local_storage_helper.cc b/chrome/browser/browsing_data/browsing_data_local_storage_helper.cc
index b906a79..21316c3 100644
--- a/chrome/browser/browsing_data/browsing_data_local_storage_helper.cc
+++ b/chrome/browser/browsing_data/browsing_data_local_storage_helper.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h"
#include "base/bind.h"
-#include "base/message_loop/message_loop.h"
#include "chrome/browser/browsing_data/browsing_data_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_thread.h"
@@ -121,31 +120,23 @@ CannedBrowsingDataLocalStorageHelper::GetLocalStorageInfo() const {
void CannedBrowsingDataLocalStorageHelper::StartFetching(
const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) {
- DCHECK(!is_fetching_);
- DCHECK_EQ(false, callback.is_null());
-
- is_fetching_ = true;
- completion_callback_ = callback;
-
- // We post a task to emulate async fetching behavior.
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&CannedBrowsingDataLocalStorageHelper::ConvertPendingInfo,
- this));
-}
-
-CannedBrowsingDataLocalStorageHelper::~CannedBrowsingDataLocalStorageHelper() {}
-
-void CannedBrowsingDataLocalStorageHelper::ConvertPendingInfo() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- local_storage_info_.clear();
+ DCHECK(!callback.is_null());
+
+ std::list<LocalStorageInfo> result;
for (std::set<GURL>::iterator iter = pending_local_storage_info_.begin();
iter != pending_local_storage_info_.end(); ++iter) {
- local_storage_info_.push_back(
+ result.push_back(
LocalStorageInfo(*iter, 0, base::Time()));
}
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&CannedBrowsingDataLocalStorageHelper::CallCompletionCallback,
- this));
+
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE, base::Bind(callback, result));
}
+
+void CannedBrowsingDataLocalStorageHelper::DeleteOrigin(const GURL& origin) {
+ pending_local_storage_info_.erase(origin);
+ BrowsingDataLocalStorageHelper::DeleteOrigin(origin);
+}
+
+CannedBrowsingDataLocalStorageHelper::~CannedBrowsingDataLocalStorageHelper() {}
diff --git a/chrome/browser/browsing_data/browsing_data_local_storage_helper.h b/chrome/browser/browsing_data/browsing_data_local_storage_helper.h
index ba67f59..95c491c 100644
--- a/chrome/browser/browsing_data/browsing_data_local_storage_helper.h
+++ b/chrome/browser/browsing_data/browsing_data_local_storage_helper.h
@@ -100,13 +100,11 @@ class CannedBrowsingDataLocalStorageHelper
virtual void StartFetching(
const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback)
OVERRIDE;
+ virtual void DeleteOrigin(const GURL& origin) OVERRIDE;
private:
virtual ~CannedBrowsingDataLocalStorageHelper();
- // Convert the pending local storage info to local storage info objects.
- void ConvertPendingInfo();
-
std::set<GURL> pending_local_storage_info_;
Profile* profile_;
diff --git a/chrome/browser/browsing_data/browsing_data_local_storage_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_local_storage_helper_unittest.cc
index e9739e1..7500796 100644
--- a/chrome/browser/browsing_data/browsing_data_local_storage_helper_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_local_storage_helper_unittest.cc
@@ -29,6 +29,27 @@ TEST_F(CannedBrowsingDataLocalStorageTest, Empty) {
ASSERT_TRUE(helper->empty());
}
+TEST_F(CannedBrowsingDataLocalStorageTest, Delete) {
+ TestingProfile profile;
+
+ const GURL origin1("http://host1:9000");
+ const GURL origin2("http://example.com");
+ const GURL origin3("http://foo.example.com");
+
+ scoped_refptr<CannedBrowsingDataLocalStorageHelper> helper(
+ new CannedBrowsingDataLocalStorageHelper(&profile));
+
+ EXPECT_TRUE(helper->empty());
+ helper->AddLocalStorage(origin1);
+ helper->AddLocalStorage(origin2);
+ helper->AddLocalStorage(origin3);
+ EXPECT_EQ(3u, helper->GetLocalStorageCount());
+ helper->DeleteOrigin(origin2);
+ EXPECT_EQ(2u, helper->GetLocalStorageCount());
+ helper->DeleteOrigin(origin1);
+ EXPECT_EQ(1u, helper->GetLocalStorageCount());
+}
+
TEST_F(CannedBrowsingDataLocalStorageTest, IgnoreExtensionsAndDevTools) {
TestingProfile profile;
diff --git a/chrome/browser/browsing_data/cookies_tree_model.cc b/chrome/browser/browsing_data/cookies_tree_model.cc
index 51fe80d2..a22068a 100644
--- a/chrome/browser/browsing_data/cookies_tree_model.cc
+++ b/chrome/browser/browsing_data/cookies_tree_model.cc
@@ -397,6 +397,10 @@ void CookieTreeSessionStorageNode::DeleteStoredObjects() {
LocalDataContainer* container = GetLocalDataContainerForNode(this);
if (container) {
+ // TODO(rsesek): There's no easy way to get the namespace_id for a session
+ // storage, nor is there an easy way to clear session storage just by
+ // origin. This is probably okay since session storage is not persistent.
+ // http://crbug.com/168996
container->session_storage_info_list_.erase(session_storage_info_);
}
}
diff --git a/chrome/browser/browsing_data/cookies_tree_model_unittest.cc b/chrome/browser/browsing_data/cookies_tree_model_unittest.cc
index b8dafda..9b733f4 100644
--- a/chrome/browser/browsing_data/cookies_tree_model_unittest.cc
+++ b/chrome/browser/browsing_data/cookies_tree_model_unittest.cc
@@ -58,7 +58,7 @@ class CookiesTreeModelTest : public testing::Test {
mock_browsing_data_appcache_helper_ =
new MockBrowsingDataAppCacheHelper(profile_.get());
mock_browsing_data_indexed_db_helper_ =
- new MockBrowsingDataIndexedDBHelper();
+ new MockBrowsingDataIndexedDBHelper(profile_.get());
mock_browsing_data_file_system_helper_ =
new MockBrowsingDataFileSystemHelper(profile_.get());
mock_browsing_data_quota_helper_ =
diff --git a/chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.cc b/chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.cc
index c933bb9..c40a195 100644
--- a/chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.cc
+++ b/chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.cc
@@ -6,8 +6,15 @@
#include "base/callback.h"
#include "base/logging.h"
-
-MockBrowsingDataIndexedDBHelper::MockBrowsingDataIndexedDBHelper() {
+#include "chrome/browser/profiles/profile.h"
+#include "content/public/browser/browser_context.h"
+#include "content/public/browser/storage_partition.h"
+
+MockBrowsingDataIndexedDBHelper::MockBrowsingDataIndexedDBHelper(
+ Profile* profile)
+ : BrowsingDataIndexedDBHelper(
+ content::BrowserContext::GetDefaultStoragePartition(profile)->
+ GetIndexedDBContext()) {
}
MockBrowsingDataIndexedDBHelper::~MockBrowsingDataIndexedDBHelper() {
diff --git a/chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.h b/chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.h
index c07decb..745f75e 100644
--- a/chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.h
+++ b/chrome/browser/browsing_data/mock_browsing_data_indexed_db_helper.h
@@ -12,13 +12,15 @@
#include "base/compiler_specific.h"
#include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h"
+class Profile;
+
// Mock for BrowsingDataIndexedDBHelper.
// Use AddIndexedDBSamples() or add directly to response_ list, then
// call Notify().
class MockBrowsingDataIndexedDBHelper
: public BrowsingDataIndexedDBHelper {
public:
- MockBrowsingDataIndexedDBHelper();
+ explicit MockBrowsingDataIndexedDBHelper(Profile* profile);
// Adds some IndexedDBInfo samples.
void AddIndexedDBSamples();