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

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

Issue 15927029: Replace WebDatabaseObserver with callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean up Created 7 years, 6 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 9e0867dd8fa0c8743c585ba9e10485516e108496..11d5d3eaf54a9f0672c8791f26040642aedfb175 100644
--- a/components/webdata/common/web_data_service_base.h
+++ b/components/webdata/common/web_data_service_base.h
@@ -9,7 +9,6 @@
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.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,8 +24,7 @@ class Thread;
// Base for WebDataService class hierarchy.
class WEBDATA_EXPORT WebDataServiceBase
- : public WebDatabaseObserver,
- public base::RefCountedThreadSafe<WebDataServiceBase,
+ : public base::RefCountedThreadSafe<WebDataServiceBase,
content::BrowserThread::DeleteOnUIThread> {
public:
// All requests return an opaque handle of the following type.
@@ -50,10 +48,6 @@ 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);
@@ -76,8 +70,13 @@ class WEBDATA_EXPORT WebDataServiceBase
// Unloads the database permanently and shuts down service.
void ShutdownDatabase();
- virtual void AddDBObserver(WebDatabaseObserver* observer);
- virtual void RemoveDBObserver(WebDatabaseObserver* observer);
+ // Register a callback to be notified that the database has loaded. Multiple
+ // callbacks may be registered, and each will be called at most once
+ // (following a successful database load), then cleared.
+ // Note: if the database load is already complete, then the callback will NOT
+ // be stored or called.
+ virtual void RegisterDBLoadedCallback(
+ const base::Callback<void(void)>& callback);
// Returns true if the database load has completetd successfully, and
// ShutdownOnUIThread has not yet been called.
@@ -94,9 +93,6 @@ class WEBDATA_EXPORT WebDataServiceBase
// Our database service.
scoped_refptr<WebDatabaseService> wdbs_;
- // True if we've received a notification that the WebDatabase has loaded.
- bool db_loaded_;
-
private:
friend struct content::BrowserThread::DeleteOnThread<
content::BrowserThread::UI>;

Powered by Google App Engine
This is Rietveld 408576698