Chromium Code Reviews| Index: components/login/base_screen_handler_utils.h |
| diff --git a/components/login/base_screen_handler_utils.h b/components/login/base_screen_handler_utils.h |
| index 71d2e7f1687ff6417d0dd839878532f017694c7a..f379bc3cfa33d4e1e72f0e44b99d4c6274f35f44 100644 |
| --- a/components/login/base_screen_handler_utils.h |
| +++ b/components/login/base_screen_handler_utils.h |
| @@ -14,6 +14,7 @@ |
| #include "base/tuple.h" |
| #include "base/values.h" |
| #include "components/login/login_export.h" |
| +#include "components/signin/core/account_id/account_id.h" |
| namespace login { |
| @@ -40,6 +41,7 @@ bool LOGIN_EXPORT ParseValue(const base::Value* value, |
| const base::DictionaryValue** out_value); |
| bool LOGIN_EXPORT ParseValue(const base::Value* value, StringList* out_value); |
| bool LOGIN_EXPORT ParseValue(const base::Value* value, String16List* out_value); |
| +bool LOGIN_EXPORT ParseValue(const base::Value* value, AccountId* out_value); |
| template <typename T> |
| inline bool GetArg(const base::ListValue* args, size_t index, T* out_value) { |
| @@ -54,17 +56,28 @@ base::FundamentalValue LOGIN_EXPORT MakeValue(int v); |
| base::FundamentalValue LOGIN_EXPORT MakeValue(double v); |
| base::StringValue LOGIN_EXPORT MakeValue(const std::string& v); |
| base::StringValue LOGIN_EXPORT MakeValue(const base::string16& v); |
| +base::StringValue LOGIN_EXPORT MakeValue(const AccountId& v); |
| template <typename T> |
| inline const T& MakeValue(const T& v) { |
| return v; |
| } |
| +template <typename T> |
| +struct ParsedValueContainer { |
| + T value; |
| +}; |
| + |
| +template <> |
| +struct ParsedValueContainer<AccountId> { |
|
dzhioev (left Google)
2015/11/13 23:17:37
Could you please declare a default constructor her
Alexander Alekseev
2015/11/14 00:27:42
Done.
|
| + AccountId value = EmptyAccountId(); |
| +}; |
| + |
| template <typename Arg, size_t index> |
| typename UnwrapConstRef<Arg>::Type ParseArg(const base::ListValue* args) { |
| - typename UnwrapConstRef<Arg>::Type parsed; |
| - CHECK(GetArg(args, index, &parsed)); |
| - return parsed; |
| + ParsedValueContainer<typename UnwrapConstRef<Arg>::Type> parsed; |
| + CHECK(GetArg(args, index, &parsed.value)); |
| + return parsed.value; |
| } |
| template <typename... Args, size_t... Ns> |