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

Unified Diff: components/webdata/common/web_data_service_base.h

Issue 14103021: Use Observer to notify of WebDB load instead of callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix WIN builds Created 7 years, 8 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: components/webdata/common/web_data_service_base.h
diff --git a/components/webdata/common/web_data_service_base.h b/components/webdata/common/web_data_service_base.h
index dec0a0d1342e419ab76c017a164acb184032e11b..2ce81a06b10562e75ff51d854e670a5950ccf0c2 100644
--- a/components/webdata/common/web_data_service_base.h
+++ b/components/webdata/common/web_data_service_base.h
@@ -10,6 +10,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/supports_user_data.h"
+#include "components/webdata/common/web_database_observer.h"
#include "components/webdata/common/webdata_export.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_source.h"
@@ -25,7 +26,8 @@ class Thread;
// Base for WebDataService class hierarchy.
class WEBDATA_EXPORT WebDataServiceBase
- : public base::RefCountedThreadSafe<WebDataServiceBase,
+ : public WebDatabaseObserver,
+ public base::RefCountedThreadSafe<WebDataServiceBase,
content::BrowserThread::DeleteOnUIThread> {
public:
// All requests return an opaque handle of the following type.
@@ -49,6 +51,10 @@ class WEBDATA_EXPORT WebDataServiceBase
WebDataServiceBase(scoped_refptr<WebDatabaseService> wdbs,
const ProfileErrorCallback& callback);
+ // WebDatabaseObserver implementation.
+ virtual void WebDatabaseLoaded() OVERRIDE;
+ virtual void WebDatabaseLoadFailed(sql::InitStatus status) OVERRIDE;
+
// Cancel any pending request. You need to call this method if your
// WebDataServiceConsumer is about to be deleted.
virtual void CancelRequest(Handle h);
@@ -71,6 +77,9 @@ class WEBDATA_EXPORT WebDataServiceBase
// Unloads the database permanently and shuts down service.
void ShutdownDatabase();
+ virtual void AddDBObserver(WebDatabaseObserver* observer);
+ virtual void RemoveDBObserver(WebDatabaseObserver* observer);
+
// Returns true if the database load has completetd successfully, and
// ShutdownOnUIThread has not yet been called.
virtual bool IsDatabaseLoaded();
@@ -122,14 +131,6 @@ class WEBDATA_EXPORT WebDataServiceBase
// be used e.g. for SyncableService subclasses that need to be owned
// by this object. Is created on first call to |GetDBUserData()|.
scoped_ptr<SupportsUserDataAggregatable> db_thread_user_data_;
-
- // Called after database is successfully loaded. By default this function does
- // nothing. Subclasses can override to support notification.
- virtual void NotifyDatabaseLoadedOnUIThread();
-
- void DBInitFailed(sql::InitStatus sql_status);
- void DBInitSucceeded();
- void DatabaseInitOnDB(sql::InitStatus status);
};
#endif // COMPONENTS_WEBDATA_COMMON_WEB_DATA_SERVICE_BASE_H_
« no previous file with comments | « components/webdata/common/web_data_service_backend.cc ('k') | components/webdata/common/web_data_service_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698