summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browsing_data_database_helper.h
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-10 12:55:00 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-10 12:55:00 +0000
commit33b61bcc0c64b4d44377f86df8746b54f2bce01b (patch)
tree75ce8e196f085e3799e8c0ac48ec31b2545b8a09 /chrome/browser/browsing_data_database_helper.h
parentded71afbd762da9b5a00fceaa1b75758d317fe2b (diff)
downloadchromium_src-33b61bcc0c64b4d44377f86df8746b54f2bce01b.zip
chromium_src-33b61bcc0c64b4d44377f86df8746b54f2bce01b.tar.gz
chromium_src-33b61bcc0c64b4d44377f86df8746b54f2bce01b.tar.bz2
Wrappers around BrowsingDataHelpers that returned canned responses.
BUG=45230 TEST=CannedBrowsingData*HelperTest.* Review URL: http://codereview.chromium.org/2707001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49388 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browsing_data_database_helper.h')
-rw-r--r--chrome/browser/browsing_data_database_helper.h36
1 files changed, 30 insertions, 6 deletions
diff --git a/chrome/browser/browsing_data_database_helper.h b/chrome/browser/browsing_data_database_helper.h
index 9f48b49..a0b39c6 100644
--- a/chrome/browser/browsing_data_database_helper.h
+++ b/chrome/browser/browsing_data_database_helper.h
@@ -11,6 +11,7 @@
#include "base/callback.h"
#include "base/scoped_ptr.h"
#include "chrome/common/url_constants.h"
+#include "googleurl/src/gurl.h"
#include "webkit/database/database_tracker.h"
class Profile;
@@ -74,12 +75,14 @@ class BrowsingDataDatabaseHelper
virtual void DeleteDatabase(const std::string& origin,
const std::string& name);
- private:
+ protected:
friend class base::RefCountedThreadSafe<BrowsingDataDatabaseHelper>;
- friend class MockBrowsingDataDatabaseHelper;
-
virtual ~BrowsingDataDatabaseHelper();
+ // This only mutates in the FILE thread.
+ std::vector<DatabaseInfo> database_info_;
+
+ private:
// Enumerates all databases. This must be called in the FILE thread.
void FetchDatabaseInfoInFileThread();
@@ -102,10 +105,31 @@ class BrowsingDataDatabaseHelper
// This only mutates on the UI thread.
bool is_fetching_;
- // This only mutates in the FILE thread.
- std::vector<DatabaseInfo> database_info_;
-
DISALLOW_COPY_AND_ASSIGN(BrowsingDataDatabaseHelper);
};
+// This class is a thin wrapper around BrowsingDataDatabaseHelper that does not
+// fetch its information from the database tracker, but gets them passed as
+// a parameter during construction.
+class CannedBrowsingDataDatabaseHelper : public BrowsingDataDatabaseHelper {
+ public:
+ explicit CannedBrowsingDataDatabaseHelper(Profile* profile);
+
+ // Add a database to the set of canned databases that is returned by this
+ // helper.
+ void AddDatabase(const GURL& origin,
+ const std::string& name,
+ const std::string& description);
+
+ // BrowsingDataDatabaseHelper methods.
+ virtual void StartFetching(
+ Callback1<const std::vector<DatabaseInfo>& >::Type* callback);
+ virtual void CancelNotification() {}
+
+ private:
+ virtual ~CannedBrowsingDataDatabaseHelper() {}
+
+ DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataDatabaseHelper);
+};
+
#endif // CHROME_BROWSER_BROWSING_DATA_DATABASE_HELPER_H_