Index: components/webdata/common/web_data_results.h |
diff --git a/components/webdata/common/web_data_results.h b/components/webdata/common/web_data_results.h |
index 8f04c7f0cd0e890bc3d103de65e242f178fc6a98..aea8fce4cc74e274f6c434723fa30405bd269621 100644 |
--- a/components/webdata/common/web_data_results.h |
+++ b/components/webdata/common/web_data_results.h |
@@ -21,22 +21,21 @@ typedef enum { |
BOOL_RESULT = 1, // WDResult<bool> |
KEYWORDS_RESULT, // WDResult<WDKeywordsResult> |
INT64_RESULT, // WDResult<int64_t> |
-#if defined(OS_WIN) |
+#if defined(OS_WIN) // |
PASSWORD_IE7_RESULT, // WDResult<IE7PasswordInfo> |
-#endif |
+#endif // |
WEB_APP_IMAGES, // WDResult<WDAppImagesResult> |
TOKEN_RESULT, // WDResult<std::vector<std::string>> |
AUTOFILL_VALUE_RESULT, // WDResult<std::vector<base::string16>> |
AUTOFILL_CHANGES, // WDResult<std::vector<AutofillChange>> |
AUTOFILL_PROFILE_RESULT, // WDResult<AutofillProfile> |
- AUTOFILL_PROFILES_RESULT, // WDResult<std::vector<AutofillProfile*>> |
+ AUTOFILL_PROFILES_RESULT, // WDResult<std::vector< |
+ // std::unique_ptr<AutofillProfile>>> |
AUTOFILL_CREDITCARD_RESULT, // WDResult<CreditCard> |
- AUTOFILL_CREDITCARDS_RESULT, // WDResult<std::vector<CreditCard*>> |
+ AUTOFILL_CREDITCARDS_RESULT, // WDResult<std::vector< |
+ // std::unique_ptr<CreditCard>>> |
} WDResultType; |
- |
-typedef base::Callback<void(const WDTypedResult*)> DestroyCallback; |
- |
// |
// The top level class for a result. |
// |
@@ -50,9 +49,6 @@ class WEBDATA_EXPORT WDTypedResult { |
return type_; |
} |
- virtual void Destroy() { |
- } |
- |
protected: |
explicit WDTypedResult(WDResultType type) |
: type_(type) { |
@@ -66,17 +62,15 @@ class WEBDATA_EXPORT 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, T&& v) |
+ : WDTypedResult(type), value_(std::move(v)) {} |
- ~WDResult() override { |
- } |
+ ~WDResult() override {} |
// Return a single value result. |
- T GetValue() const { |
- return value_; |
- } |
+ const T& GetValue() const { return value_; } |
+ T GetValue() { return std::move(value_); } |
private: |
T value_; |
@@ -84,29 +78,4 @@ template <class T> class WDResult : public WDTypedResult { |
DISALLOW_COPY_AND_ASSIGN(WDResult); |
}; |
-template <class T> class WDDestroyableResult : public WDResult<T> { |
- public: |
- WDDestroyableResult( |
- WDResultType type, |
- const T& v, |
- const DestroyCallback& callback) |
- : WDResult<T>(type, v), |
- callback_(callback) { |
- } |
- |
- ~WDDestroyableResult() override { |
- } |
- |
- void Destroy() override { |
- if (!callback_.is_null()) { |
- callback_.Run(this); |
- } |
- } |
- |
- private: |
- DestroyCallback callback_; |
- |
- DISALLOW_COPY_AND_ASSIGN(WDDestroyableResult); |
-}; |
- |
#endif // COMPONENTS_WEBDATA_COMMON_WEB_DATA_RESULTS_H_ |