| Index: components/login/base_screen_handler_utils.h
|
| diff --git a/chrome/browser/ui/webui/chromeos/login/base_screen_handler_utils.h b/components/login/base_screen_handler_utils.h
|
| similarity index 54%
|
| rename from chrome/browser/ui/webui/chromeos/login/base_screen_handler_utils.h
|
| rename to components/login/base_screen_handler_utils.h
|
| index abe429882a2f1d0dda2acc961760c22dfb2c28cb..63e551296a53a77ed4136cc364e6130ba3d09c7d 100644
|
| --- a/chrome/browser/ui/webui/chromeos/login/base_screen_handler_utils.h
|
| +++ b/components/login/base_screen_handler_utils.h
|
| @@ -2,8 +2,8 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_SCREEN_HANDLER_UTILS_H_
|
| -#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_SCREEN_HANDLER_UTILS_H_
|
| +#ifndef COMPONENTS_LOGIN_BASE_SCREEN_HANDLER_UTILS_H_
|
| +#define COMPONENTS_LOGIN_BASE_SCREEN_HANDLER_UTILS_H_
|
|
|
| #include <cstddef>
|
| #include <string>
|
| @@ -12,33 +12,35 @@
|
| #include "base/logging.h"
|
| #include "base/strings/string16.h"
|
| #include "base/values.h"
|
| +#include "components/login/login_export.h"
|
|
|
| -namespace chromeos {
|
| +namespace login {
|
|
|
| typedef std::vector<std::string> StringList;
|
| typedef std::vector<base::string16> String16List;
|
|
|
| -template<typename T>
|
| -struct UnwrapConstRef {
|
| +template <typename T>
|
| +struct LOGIN_EXPORT UnwrapConstRef {
|
| typedef T Type;
|
| };
|
|
|
| -template<typename T>
|
| -struct UnwrapConstRef<const T&> {
|
| +template <typename T>
|
| +struct LOGIN_EXPORT UnwrapConstRef<const T&> {
|
| typedef T Type;
|
| };
|
|
|
| -bool ParseValue(const base::Value* value, bool* out_value);
|
| -bool ParseValue(const base::Value* value, int* out_value);
|
| -bool ParseValue(const base::Value* value, double* out_value);
|
| -bool ParseValue(const base::Value* value, std::string* out_value);
|
| -bool ParseValue(const base::Value* value, base::string16* out_value);
|
| -bool ParseValue(const base::Value* value,
|
| - const base::DictionaryValue** out_value);
|
| -bool ParseValue(const base::Value* value, StringList* out_value);
|
| -bool ParseValue(const base::Value* value, String16List* out_value);
|
| -
|
| -template<typename T>
|
| +bool LOGIN_EXPORT ParseValue(const base::Value* value, bool* out_value);
|
| +bool LOGIN_EXPORT ParseValue(const base::Value* value, int* out_value);
|
| +bool LOGIN_EXPORT ParseValue(const base::Value* value, double* out_value);
|
| +bool LOGIN_EXPORT ParseValue(const base::Value* value, std::string* out_value);
|
| +bool LOGIN_EXPORT
|
| + ParseValue(const base::Value* value, base::string16* out_value);
|
| +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);
|
| +
|
| +template <typename T>
|
| inline bool GetArg(const base::ListValue* args, size_t index, T* out_value) {
|
| const base::Value* value;
|
| if (!args->Get(index, &value))
|
| @@ -46,21 +48,21 @@ inline bool GetArg(const base::ListValue* args, size_t index, T* out_value) {
|
| return ParseValue(value, out_value);
|
| }
|
|
|
| -base::FundamentalValue MakeValue(bool v);
|
| -base::FundamentalValue MakeValue(int v);
|
| -base::FundamentalValue MakeValue(double v);
|
| -base::StringValue MakeValue(const std::string& v);
|
| -base::StringValue MakeValue(const base::string16& v);
|
| +base::FundamentalValue LOGIN_EXPORT MakeValue(bool v);
|
| +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);
|
|
|
| -template<typename T>
|
| +template <typename T>
|
| inline const T& MakeValue(const T& v) {
|
| return v;
|
| }
|
|
|
| -void CallbackWrapper0(base::Callback<void()> callback,
|
| - const base::ListValue* args);
|
| +void LOGIN_EXPORT CallbackWrapper0(base::Callback<void()> callback,
|
| + const base::ListValue* args);
|
|
|
| -template<typename A1>
|
| +template <typename A1>
|
| void CallbackWrapper1(base::Callback<void(A1)> callback,
|
| const base::ListValue* args) {
|
| DCHECK(args);
|
| @@ -73,7 +75,7 @@ void CallbackWrapper1(base::Callback<void(A1)> callback,
|
| callback.Run(arg1);
|
| }
|
|
|
| -template<typename A1, typename A2>
|
| +template <typename A1, typename A2>
|
| void CallbackWrapper2(base::Callback<void(A1, A2)> callback,
|
| const base::ListValue* args) {
|
| DCHECK(args);
|
| @@ -87,7 +89,7 @@ void CallbackWrapper2(base::Callback<void(A1, A2)> callback,
|
| callback.Run(arg1, arg2);
|
| }
|
|
|
| -template<typename A1, typename A2, typename A3>
|
| +template <typename A1, typename A2, typename A3>
|
| void CallbackWrapper3(base::Callback<void(A1, A2, A3)> callback,
|
| const base::ListValue* args) {
|
| DCHECK(args);
|
| @@ -95,8 +97,7 @@ void CallbackWrapper3(base::Callback<void(A1, A2, A3)> callback,
|
| typename UnwrapConstRef<A1>::Type arg1;
|
| typename UnwrapConstRef<A2>::Type arg2;
|
| typename UnwrapConstRef<A3>::Type arg3;
|
| - if (!GetArg(args, 0, &arg1) ||
|
| - !GetArg(args, 1, &arg2) ||
|
| + if (!GetArg(args, 0, &arg1) || !GetArg(args, 1, &arg2) ||
|
| !GetArg(args, 2, &arg3)) {
|
| NOTREACHED();
|
| return;
|
| @@ -104,7 +105,7 @@ void CallbackWrapper3(base::Callback<void(A1, A2, A3)> callback,
|
| callback.Run(arg1, arg2, arg3);
|
| }
|
|
|
| -template<typename A1, typename A2, typename A3, typename A4>
|
| +template <typename A1, typename A2, typename A3, typename A4>
|
| void CallbackWrapper4(base::Callback<void(A1, A2, A3, A4)> callback,
|
| const base::ListValue* args) {
|
| DCHECK(args);
|
| @@ -113,16 +114,14 @@ void CallbackWrapper4(base::Callback<void(A1, A2, A3, A4)> callback,
|
| typename UnwrapConstRef<A2>::Type arg2;
|
| typename UnwrapConstRef<A3>::Type arg3;
|
| typename UnwrapConstRef<A4>::Type arg4;
|
| - if (!GetArg(args, 0, &arg1) ||
|
| - !GetArg(args, 1, &arg2) ||
|
| - !GetArg(args, 2, &arg3) ||
|
| - !GetArg(args, 3, &arg4)) {
|
| + if (!GetArg(args, 0, &arg1) || !GetArg(args, 1, &arg2) ||
|
| + !GetArg(args, 2, &arg3) || !GetArg(args, 3, &arg4)) {
|
| NOTREACHED();
|
| return;
|
| }
|
| callback.Run(arg1, arg2, arg3, arg4);
|
| }
|
|
|
| -} // namespace chromeos
|
| +} // namespace login
|
|
|
| -#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_SCREEN_HANDLER_UTILS_H_
|
| +#endif // COMPONENTS_LOGIN_BASE_SCREEN_HANDLER_UTILS_H_
|
|
|