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

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: Add missing 'explicit' on constructor, fix win unit test. 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..dc30fc123559bddf8d1a042a7cda0500b0ecfcac 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,16 @@ 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.
+ // TODO(joi): Should we combine this with WebDatabaseService::InitCallback?
+ typedef base::Callback<void(sql::InitStatus)> ProfileErrorCallback;
+
+ // |callback| will only be invoked on error, and only if
+ // |callback.is_null()| evaluates to false.
+ explicit WebDataServiceBase(const ProfileErrorCallback& callback);
// Cancel any pending request. You need to call this method if your
// WebDataServiceConsumer is about to be deleted.
@@ -74,6 +84,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);
« no previous file with comments | « chrome/browser/api/webdata/autofill_web_data_service.h ('k') | chrome/browser/password_manager/password_store_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698