OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_SCREEN_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_SCREEN_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_SCREEN_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 template<typename T, typename A1, typename A2, typename A3, typename A4> | 166 template<typename T, typename A1, typename A2, typename A3, typename A4> |
167 void AddCallback(const std::string& name, | 167 void AddCallback(const std::string& name, |
168 void (T::*method)(A1 arg1, A2 arg2, A3 arg3, A4 arg4)) { | 168 void (T::*method)(A1 arg1, A2 arg2, A3 arg3, A4 arg4)) { |
169 base::Callback<void(A1, A2, A3, A4)> callback = | 169 base::Callback<void(A1, A2, A3, A4)> callback = |
170 base::Bind(method, base::Unretained(static_cast<T*>(this))); | 170 base::Bind(method, base::Unretained(static_cast<T*>(this))); |
171 web_ui()->RegisterMessageCallback( | 171 web_ui()->RegisterMessageCallback( |
172 name, base::Bind(&::login::CallbackWrapper4<A1, A2, A3, A4>, callback)); | 172 name, base::Bind(&::login::CallbackWrapper4<A1, A2, A3, A4>, callback)); |
173 } | 173 } |
174 | 174 |
| 175 template <typename T, |
| 176 typename A1, |
| 177 typename A2, |
| 178 typename A3, |
| 179 typename A4, |
| 180 typename A5> |
| 181 void AddCallback( |
| 182 const std::string& name, |
| 183 void (T::*method)(A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5)) { |
| 184 base::Callback<void(A1, A2, A3, A4, A5)> callback = |
| 185 base::Bind(method, base::Unretained(static_cast<T*>(this))); |
| 186 web_ui()->RegisterMessageCallback( |
| 187 name, |
| 188 base::Bind(&::login::CallbackWrapper5<A1, A2, A3, A4, A5>, callback)); |
| 189 } |
| 190 |
175 template <typename Method> | 191 template <typename Method> |
176 void AddPrefixedCallback(const std::string& unprefixed_name, | 192 void AddPrefixedCallback(const std::string& unprefixed_name, |
177 const Method& method) { | 193 const Method& method) { |
178 AddCallback(FullMethodPath(unprefixed_name), method); | 194 AddCallback(FullMethodPath(unprefixed_name), method); |
179 } | 195 } |
180 | 196 |
181 // Called when the page is ready and handler can do initialization. | 197 // Called when the page is ready and handler can do initialization. |
182 virtual void Initialize() = 0; | 198 virtual void Initialize() = 0; |
183 | 199 |
184 // Show selected WebUI |screen|. Optionally it can pass screen initialization | 200 // Show selected WebUI |screen|. Optionally it can pass screen initialization |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 239 |
224 // Pending changes to context which will be sent when the page will be ready. | 240 // Pending changes to context which will be sent when the page will be ready. |
225 base::DictionaryValue pending_context_changes_; | 241 base::DictionaryValue pending_context_changes_; |
226 | 242 |
227 DISALLOW_COPY_AND_ASSIGN(BaseScreenHandler); | 243 DISALLOW_COPY_AND_ASSIGN(BaseScreenHandler); |
228 }; | 244 }; |
229 | 245 |
230 } // namespace chromeos | 246 } // namespace chromeos |
231 | 247 |
232 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_SCREEN_HANDLER_H_ | 248 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_BASE_SCREEN_HANDLER_H_ |
OLD | NEW |