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

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

Issue 11761016: Separate WebDataRequest functionality from WebDataService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Break autofill deps (and cleanup) Created 7 years, 12 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_results.h
diff --git a/chrome/browser/api/webdata/web_data_results.h b/chrome/browser/api/webdata/web_data_results.h
index 6d2d5b8c34ccf62f4c335d93000aef13db952c32..7255c542559e66d57f87793f0fc480996f4ff127 100644
--- a/chrome/browser/api/webdata/web_data_results.h
+++ b/chrome/browser/api/webdata/web_data_results.h
@@ -6,6 +6,9 @@
#define CHROME_BROWSER_API_WEBDATA_WEB_DATA_RESULTS_H_
#include "base/basictypes.h"
+#include "base/callback.h"
+
+class WDTypedResult;
//
// Result types for WebDataService.
@@ -29,6 +32,9 @@ typedef enum {
WEB_INTENTS_DEFAULTS_RESULT, // WDResult<std::vector<DefaultWebIntentService>>
} WDResultType;
+
+typedef base::Callback<void(const WDTypedResult*)> DestroyCallback;
+
//
// The top level class for a result.
//
@@ -41,12 +47,21 @@ class WDTypedResult {
return type_;
}
+ void Destroy() const {
+ if (!callback_.is_null()) {
+ callback_.Run(this);
+ }
+ }
+
protected:
- explicit WDTypedResult(WDResultType type) : type_(type) {
+ WDTypedResult(WDResultType type, const DestroyCallback& callback)
dhollowa 2013/01/04 23:57:36 It seems reasonable to me in this case to have a t
Cait (Slow) 2013/01/07 17:08:54 Done.
+ : type_(type),
+ callback_(callback) {
}
private:
WDResultType type_;
+ DestroyCallback callback_;
DISALLOW_COPY_AND_ASSIGN(WDTypedResult);
};
@@ -54,7 +69,8 @@ class WDTypedResult {
template <class T> class WDResult : public WDTypedResult {
public:
- WDResult(WDResultType type, const T& v) : WDTypedResult(type), value_(v) {
+ WDResult(WDResultType type, const DestroyCallback& callback, const T& v)
+ : WDTypedResult(type, callback), value_(v) {
}
virtual ~WDResult() {
@@ -73,7 +89,8 @@ template <class T> class WDResult : public WDTypedResult {
template <class T> class WDObjectResult : public WDTypedResult {
public:
- explicit WDObjectResult(WDResultType type) : WDTypedResult(type) {
+ WDObjectResult(WDResultType type, const DestroyCallback& callback)
+ : WDTypedResult(type, callback) {
}
T* GetValue() const {
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_metrics_unittest.cc » ('j') | chrome/browser/webdata/web_data_service.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698