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

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: nit Created 7 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/api/webdata/web_data_results.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7924e3f53f0f76fc91a2690654e452dc9f458b0d 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,32 +32,47 @@ 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.
//
class WDTypedResult {
public:
- virtual ~WDTypedResult() {}
+ virtual ~WDTypedResult();
// Return the result type.
WDResultType GetType() const {
return type_;
}
- protected:
- explicit WDTypedResult(WDResultType type) : type_(type) {
+ void Destroy() const {
+ if (!callback_.is_null()) {
+ callback_.Run(this);
+ }
}
+ protected:
+ explicit WDTypedResult(WDResultType type);
+
+ WDTypedResult(WDResultType type, const DestroyCallback& callback);
+
private:
WDResultType type_;
+ DestroyCallback callback_;
DISALLOW_COPY_AND_ASSIGN(WDTypedResult);
};
// A result containing one specific pointer or literal value.
template <class T> class WDResult : public WDTypedResult {
public:
+ WDResult(WDResultType type, const T& v)
+ : WDTypedResult(type), value_(v) {
+ }
- 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 +91,12 @@ template <class T> class WDResult : public WDTypedResult {
template <class T> class WDObjectResult : public WDTypedResult {
public:
- explicit WDObjectResult(WDResultType type) : WDTypedResult(type) {
+ 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/api/webdata/web_data_results.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698