#ifndef CHROME_BROWSER_API_WEBDATA_WEB_DATA_RESULTS_H_
#define CHROME_BROWSER_API_WEBDATA_WEB_DATA_RESULTS_H_
#include "base/basictypes.h"
typedef enum {
BOOL_RESULT = 1,
KEYWORDS_RESULT,
INT64_RESULT,
#if defined(OS_WIN)
PASSWORD_IE7_RESULT,
#endif
WEB_APP_IMAGES,
TOKEN_RESULT,
AUTOFILL_VALUE_RESULT,
AUTOFILL_CHANGES,
AUTOFILL_PROFILE_RESULT,
AUTOFILL_PROFILES_RESULT,
AUTOFILL_CREDITCARD_RESULT,
AUTOFILL_CREDITCARDS_RESULT,
WEB_INTENTS_RESULT,
WEB_INTENTS_DEFAULTS_RESULT,
} WDResultType;
class WDTypedResult {
public:
virtual ~WDTypedResult() {}
WDResultType GetType() const {
return type_;
}
protected:
explicit WDTypedResult(WDResultType type) : type_(type) {
}
private:
WDResultType type_;
DISALLOW_COPY_AND_ASSIGN(WDTypedResult);
};
template <class T> class WDResult : public WDTypedResult {
public:
WDResult(WDResultType type, const T& v) : WDTypedResult(type), value_(v) {
}
virtual ~WDResult() {
}
T GetValue() const {
return value_;
}
private:
T value_;
DISALLOW_COPY_AND_ASSIGN(WDResult);
};
template <class T> class WDObjectResult : public WDTypedResult {
public:
explicit WDObjectResult(WDResultType type) : WDTypedResult(type) {
}
T* GetValue() const {
return &value_;
}
private:
mutable T value_;
DISALLOW_COPY_AND_ASSIGN(WDObjectResult);
};
#endif