OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_SCREEN_HANDLER_UTILS_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_SCREEN_HANDLER_UTILS_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_SCREEN_HANDLER_UTILS_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_SCREEN_HANDLER_UTILS_H_ |
7 | 7 |
8 #include <cstddef> | 8 #include <cstddef> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return args->GetString(index, out_value); | 56 return args->GetString(index, out_value); |
57 } | 57 } |
58 | 58 |
59 template<> | 59 template<> |
60 inline bool GetArg<string16>(const base::ListValue* args, | 60 inline bool GetArg<string16>(const base::ListValue* args, |
61 size_t index, | 61 size_t index, |
62 string16* out_value) { | 62 string16* out_value) { |
63 return args->GetString(index, out_value); | 63 return args->GetString(index, out_value); |
64 } | 64 } |
65 | 65 |
| 66 inline base::FundamentalValue MakeValue(bool v) { |
| 67 return base::FundamentalValue(v); |
| 68 } |
| 69 |
| 70 inline base::FundamentalValue MakeValue(int v) { |
| 71 return base::FundamentalValue(v); |
| 72 } |
| 73 |
| 74 inline base::FundamentalValue MakeValue(double v) { |
| 75 return base::FundamentalValue(v); |
| 76 } |
| 77 |
| 78 inline base::StringValue MakeValue(const std::string& v) { |
| 79 return base::StringValue(v); |
| 80 } |
| 81 |
| 82 inline base::StringValue MakeValue(const string16& v) { |
| 83 return base::StringValue(v); |
| 84 } |
| 85 |
| 86 template<typename T> |
| 87 inline const T& MakeValue(const T& v) { |
| 88 return v; |
| 89 } |
| 90 |
66 inline void CallbackWrapper0(base::Callback<void()> callback, | 91 inline void CallbackWrapper0(base::Callback<void()> callback, |
67 const base::ListValue* args) { | 92 const base::ListValue* args) { |
68 DCHECK(args); | 93 DCHECK(args); |
69 DCHECK(args->empty()); | 94 DCHECK(args->empty()); |
70 callback.Run(); | 95 callback.Run(); |
71 } | 96 } |
72 | 97 |
73 template<typename A1> | 98 template<typename A1> |
74 void CallbackWrapper1(base::Callback<void(A1)> callback, | 99 void CallbackWrapper1(base::Callback<void(A1)> callback, |
75 const base::ListValue* args) { | 100 const base::ListValue* args) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 !GetArg(args, 3, &arg4)) { | 154 !GetArg(args, 3, &arg4)) { |
130 NOTREACHED(); | 155 NOTREACHED(); |
131 return; | 156 return; |
132 } | 157 } |
133 callback.Run(arg1, arg2, arg3, arg4); | 158 callback.Run(arg1, arg2, arg3, arg4); |
134 } | 159 } |
135 | 160 |
136 } // namespace chromeos | 161 } // namespace chromeos |
137 | 162 |
138 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_SCREEN_HANDLER_UTILS_H_ | 163 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_SCREEN_HANDLER_UTILS_H_ |
OLD | NEW |