Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(651)

Unified Diff: chrome/browser/browsing_data_database_helper.cc

Issue 10092013: Display third party cookies and site data counts in the WebsiteSettings UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: 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 c4d89beeec65b3ab975898a50a9f6f20252453d5..117a90fb5e28c5f5c0827d5a0dfd5d6ad49e4e58 100644
--- a/chrome/browser/browsing_data_database_helper.cc
+++ b/chrome/browser/browsing_data_database_helper.cc
@@ -22,10 +22,6 @@ using content::BrowserContext;
using content::BrowserThread;
using WebKit::WebSecurityOrigin;
-BrowsingDataDatabaseHelper::DatabaseInfo::DatabaseInfo()
- : size(0) {
-}
-
BrowsingDataDatabaseHelper::DatabaseInfo::DatabaseInfo(
const std::string& host,
const std::string& database_name,
@@ -135,8 +131,6 @@ void BrowsingDataDatabaseHelper::DeleteDatabaseOnFileThread(
net::CompletionCallback());
}
-CannedBrowsingDataDatabaseHelper::PendingDatabaseInfo::PendingDatabaseInfo() {}
-
CannedBrowsingDataDatabaseHelper::PendingDatabaseInfo::PendingDatabaseInfo(
const GURL& origin,
const std::string& name,
@@ -148,6 +142,11 @@ CannedBrowsingDataDatabaseHelper::PendingDatabaseInfo::PendingDatabaseInfo(
CannedBrowsingDataDatabaseHelper::PendingDatabaseInfo::~PendingDatabaseInfo() {}
+bool CannedBrowsingDataDatabaseHelper::PendingDatabaseInfo::operator<(
+ const PendingDatabaseInfo& other) const {
+ return origin < other.origin;
Bernhard Bauer 2012/05/10 17:18:59 Doesn't this allow only one database per origin? I
markusheintz_ 2012/05/11 12:18:28 Done. I think we can ignore the description here.
+}
+
CannedBrowsingDataDatabaseHelper::CannedBrowsingDataDatabaseHelper(
Profile* profile)
: BrowsingDataDatabaseHelper(profile),
@@ -171,7 +170,7 @@ void CannedBrowsingDataDatabaseHelper::AddDatabase(
const std::string& description) {
base::AutoLock auto_lock(lock_);
if (BrowsingDataHelper::HasValidScheme(origin)) {
- pending_database_info_.push_back(PendingDatabaseInfo(
+ pending_database_info_.insert(PendingDatabaseInfo(
origin, name, description));
}
}
@@ -184,13 +183,19 @@ void CannedBrowsingDataDatabaseHelper::Reset() {
bool CannedBrowsingDataDatabaseHelper::empty() const {
base::AutoLock auto_lock(lock_);
- return database_info_.empty() && pending_database_info_.empty();
+ return pending_database_info_.empty();
}
size_t CannedBrowsingDataDatabaseHelper::GetDatabaseCount() const {
+ base::AutoLock auto_lock(lock_);
return pending_database_info_.size();
}
+const std::set<CannedBrowsingDataDatabaseHelper::PendingDatabaseInfo>&
+CannedBrowsingDataDatabaseHelper::GetPendingDatabaseInfo() {
+ return pending_database_info_;
+}
+
void CannedBrowsingDataDatabaseHelper::StartFetching(
const base::Callback<void(const std::list<DatabaseInfo>&)>& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -209,7 +214,8 @@ CannedBrowsingDataDatabaseHelper::~CannedBrowsingDataDatabaseHelper() {}
void CannedBrowsingDataDatabaseHelper::ConvertInfoInWebKitThread() {
base::AutoLock auto_lock(lock_);
- for (std::list<PendingDatabaseInfo>::const_iterator
+ database_info_.clear();
+ for (std::set<PendingDatabaseInfo>::const_iterator
info = pending_database_info_.begin();
info != pending_database_info_.end(); ++info) {
WebSecurityOrigin web_security_origin =
@@ -218,18 +224,6 @@ void CannedBrowsingDataDatabaseHelper::ConvertInfoInWebKitThread() {
std::string origin_identifier =
web_security_origin.databaseIdentifier().utf8();
- bool duplicate = false;
- for (std::list<DatabaseInfo>::iterator database = database_info_.begin();
- database != database_info_.end(); ++database) {
- if (database->origin_identifier == origin_identifier &&
- database->database_name == info->name) {
- duplicate = true;
- break;
- }
- }
- if (duplicate)
- continue;
-
database_info_.push_back(DatabaseInfo(
web_security_origin.host().utf8(),
info->name,
@@ -239,7 +233,6 @@ void CannedBrowsingDataDatabaseHelper::ConvertInfoInWebKitThread() {
0,
base::Time()));
}
- pending_database_info_.clear();
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698