Index: components/webdata/common/web_database_service.h |
diff --git a/components/webdata/common/web_database_service.h b/components/webdata/common/web_database_service.h |
index cd3ceae5394095e56d8f4ded5d2072393bfd68b3..09294b0d91126bd54154908fd7edd3f268487cc2 100644 |
--- a/components/webdata/common/web_database_service.h |
+++ b/components/webdata/common/web_database_service.h |
@@ -93,8 +93,14 @@ class WEBDATA_EXPORT WebDatabaseService |
// somewhere else. |
virtual void CancelRequest(WebDataServiceBase::Handle h); |
- void AddObserver(WebDatabaseObserver* observer); |
- void RemoveObserver(WebDatabaseObserver* observer); |
+ // Register a callback to be notified that the database has loaded. |
+ void RegisterDBLoadedCallback(const base::Callback<void(void)>& callback); |
+ |
+ // Register a callback to be notified that the database has failed to load. |
+ void RegisterDBErrorCallback( |
+ const base::Callback<void(sql::InitStatus)>& callback); |
+ |
+ bool db_loaded() { return db_loaded_; }; |
private: |
class BackendDelegate; |
@@ -116,10 +122,24 @@ class WEBDATA_EXPORT WebDatabaseService |
// PostTask on DB thread may outlive us. |
scoped_refptr<WebDataServiceBackend> wds_backend_; |
- ObserverList<WebDatabaseObserver> observer_list_; |
- |
// All vended weak pointers are invalidated in ShutdownDatabase(). |
base::WeakPtrFactory<WebDatabaseService> weak_ptr_factory_; |
+ |
+ // Types for managing DB laoding callbacks. |
Jói
2013/06/04 22:17:25
laoding -> loading
Cait (Slow)
2013/06/05 19:14:48
Done.
|
+ typedef base::Callback<void(void)> DBLoadedCallback; |
+ typedef std::vector<DBLoadedCallback> PendingCallbacks; |
Jói
2013/06/04 22:17:25
For consistency, suggest renaming to LoadedCallbac
Cait (Slow)
2013/06/05 19:14:48
Done.
|
+ |
+ typedef base::Callback<void(sql::InitStatus)> DBLoadErrorCallback; |
+ typedef std::vector<DBLoadErrorCallback> ErrorCallbacks; |
+ |
+ // Callbacks to be called once the DB has loaded. |
+ PendingCallbacks pending_callbacks_; |
Jói
2013/06/04 22:17:25
variable name too
Cait (Slow)
2013/06/05 19:14:48
Done.
|
+ |
+ // Callbacks to be called if the DB has failed to load. |
+ ErrorCallbacks error_callbacks_; |
+ |
+ // True if the WebDatabase has loaded. |
+ bool db_loaded_; |
}; |
#endif // COMPONENTS_WEBDATA_COMMON_WEB_DATABASE_SERVICE_H_ |