Index: chrome/browser/browsing_data_database_helper.h |
diff --git a/chrome/browser/browsing_data_database_helper.h b/chrome/browser/browsing_data_database_helper.h |
index 1d5b98dc532ca706d99aa5ed3d633a570cd58e01..fd7b2d2133f38b7ef6c0a6d54edeb1b700ed65ff 100644 |
--- a/chrome/browser/browsing_data_database_helper.h |
+++ b/chrome/browser/browsing_data_database_helper.h |
@@ -7,6 +7,7 @@ |
#pragma once |
#include <list> |
+#include <set> |
#include <string> |
#include "base/callback.h" |
@@ -29,7 +30,6 @@ class BrowsingDataDatabaseHelper |
public: |
// Contains detailed information about a web database. |
struct DatabaseInfo { |
- DatabaseInfo(); |
DatabaseInfo(const std::string& host, |
const std::string& database_name, |
const std::string& origin_identifier, |
@@ -98,6 +98,20 @@ class BrowsingDataDatabaseHelper |
// a parameter during construction. |
class CannedBrowsingDataDatabaseHelper : public BrowsingDataDatabaseHelper { |
public: |
+ struct PendingDatabaseInfo { |
+ PendingDatabaseInfo(const GURL& origin, |
+ const std::string& name, |
+ const std::string& description); |
+ ~PendingDatabaseInfo(); |
+ |
+ // The operator is needed to store |PendingDatabaseInfo| objects in a set. |
+ bool operator<(const PendingDatabaseInfo& other) const; |
+ |
+ GURL origin; |
+ std::string name; |
+ std::string description; |
+ }; |
+ |
explicit CannedBrowsingDataDatabaseHelper(Profile* profile); |
// Return a copy of the database helper. Only one consumer can use the |
@@ -120,24 +134,15 @@ class CannedBrowsingDataDatabaseHelper : public BrowsingDataDatabaseHelper { |
// Returns the number of currently stored databases. |
size_t GetDatabaseCount() const; |
+ // Returns the current list of web databases. |
+ const std::set<PendingDatabaseInfo>& GetPendingDatabaseInfo(); |
+ |
// BrowsingDataDatabaseHelper implementation. |
virtual void StartFetching( |
const base::Callback<void(const std::list<DatabaseInfo>&)>& callback) |
OVERRIDE; |
private: |
- struct PendingDatabaseInfo { |
- PendingDatabaseInfo(); |
- PendingDatabaseInfo(const GURL& origin, |
- const std::string& name, |
- const std::string& description); |
- ~PendingDatabaseInfo(); |
- |
- GURL origin; |
- std::string name; |
- std::string description; |
- }; |
- |
virtual ~CannedBrowsingDataDatabaseHelper(); |
// Converts the pending database info structs to database info structs. |
@@ -146,8 +151,9 @@ class CannedBrowsingDataDatabaseHelper : public BrowsingDataDatabaseHelper { |
// Used to protect access to pending_database_info_. |
mutable base::Lock lock_; |
- // This may mutate on WEBKIT and UI threads. |
- std::list<PendingDatabaseInfo> pending_database_info_; |
+ // This may mutate only on the UI thread, but it is also accessed on the |
+ // WEBKIT thread. |
+ std::set<PendingDatabaseInfo> pending_database_info_; |
Profile* profile_; |