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

Unified Diff: chrome/browser/api/webdata/web_data_service_base.h

Issue 12780012: Move UI dependency from WebDataService to WebDataServiceFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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: chrome/browser/api/webdata/web_data_service_base.h
diff --git a/chrome/browser/api/webdata/web_data_service_base.h b/chrome/browser/api/webdata/web_data_service_base.h
index 9a6f92640cf7bc591a3da420cbd86f2be8f6b198..15bbfff2f276ae04f3da89b5cb331e723c50d529 100644
--- a/chrome/browser/api/webdata/web_data_service_base.h
+++ b/chrome/browser/api/webdata/web_data_service_base.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_API_WEBDATA_WEB_DATA_SERVICE_BASE_H_
#define CHROME_BROWSER_API_WEBDATA_WEB_DATA_SERVICE_BASE_H_
+#include "base/callback_forward.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@@ -27,7 +28,15 @@ class WebDataServiceBase
// All requests return an opaque handle of the following type.
typedef int Handle;
- WebDataServiceBase();
+ // Users of this class may provide a callback to handle errors
+ // (e.g. by showing a UI). The callback is called only on error, and
+ // takes a single parameter, the sql::InitStatus value from trying
+ // to open the database.
+ typedef base::Callback<void(sql::InitStatus)> ProfileErrorCallback;
Cait (Slow) 2013/03/18 16:16:37 ATM we have a WebDataServiceBase::ProfileErrorCall
Jói 2013/03/18 23:21:23 Yes, I think we should wait for all the pieces to
+
+ // |callback| will only be invoked on error, and only if
+ // ||callback.is_null()| evaluates to true.
Cait (Slow) 2013/03/18 16:16:37 nit: |callback.is_null() --> !callback.is_null()
Jói 2013/03/18 23:21:23 Thanks for the catch. Switched "evaluates to true"
+ WebDataServiceBase(const ProfileErrorCallback& callback);
// Cancel any pending request. You need to call this method if your
// WebDataServiceConsumer is about to be deleted.
@@ -74,6 +83,8 @@ class WebDataServiceBase
content::BrowserThread::UI>;
friend class base::DeleteHelper<WebDataServiceBase>;
+ ProfileErrorCallback profile_error_callback_;
+
void DBInitFailed(sql::InitStatus sql_status);
void NotifyDatabaseLoadedOnUIThread();
void DatabaseInitOnDB(sql::InitStatus status);

Powered by Google App Engine
This is Rietveld 408576698