Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1236)

Unified Diff: chrome/browser/ui/webui/chromeos/login/base_screen_handler.h

Issue 1038003002: Use variadic template for screen handler's AddCallback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/login/base_screen_handler_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/chromeos/login/base_screen_handler.h
diff --git a/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h
index ce576470bec1fb936cfbb05b088b91fa810f2b80..359126ea4b5789f3fabf1be619da9541884e2552 100644
--- a/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h
@@ -129,63 +129,12 @@ class BaseScreenHandler : public content::WebUIMessageHandler,
base::Bind(method, base::Unretained(static_cast<T*>(this))));
}
- template<typename T>
- void AddCallback(const std::string& name, void (T::*method)()) {
- base::Callback<void()> callback =
- base::Bind(method, base::Unretained(static_cast<T*>(this)));
- web_ui()->RegisterMessageCallback(
- name, base::Bind(&::login::CallbackWrapper0, callback));
- }
-
- template<typename T, typename A1>
- void AddCallback(const std::string& name, void (T::*method)(A1 arg1)) {
- base::Callback<void(A1)> callback =
- base::Bind(method, base::Unretained(static_cast<T*>(this)));
- web_ui()->RegisterMessageCallback(
- name, base::Bind(&::login::CallbackWrapper1<A1>, callback));
- }
-
- template<typename T, typename A1, typename A2>
- void AddCallback(const std::string& name,
- void (T::*method)(A1 arg1, A2 arg2)) {
- base::Callback<void(A1, A2)> callback =
- base::Bind(method, base::Unretained(static_cast<T*>(this)));
- web_ui()->RegisterMessageCallback(
- name, base::Bind(&::login::CallbackWrapper2<A1, A2>, callback));
- }
-
- template<typename T, typename A1, typename A2, typename A3>
- void AddCallback(const std::string& name,
- void (T::*method)(A1 arg1, A2 arg2, A3 arg3)) {
- base::Callback<void(A1, A2, A3)> callback =
- base::Bind(method, base::Unretained(static_cast<T*>(this)));
- web_ui()->RegisterMessageCallback(
- name, base::Bind(&::login::CallbackWrapper3<A1, A2, A3>, callback));
- }
-
- template<typename T, typename A1, typename A2, typename A3, typename A4>
- void AddCallback(const std::string& name,
- void (T::*method)(A1 arg1, A2 arg2, A3 arg3, A4 arg4)) {
- base::Callback<void(A1, A2, A3, A4)> callback =
+ template<typename T, typename... Args>
+ void AddCallback(const std::string& name, void (T::*method)(Args...)) {
+ base::Callback<void(Args...)> callback =
base::Bind(method, base::Unretained(static_cast<T*>(this)));
web_ui()->RegisterMessageCallback(
- name, base::Bind(&::login::CallbackWrapper4<A1, A2, A3, A4>, callback));
- }
-
- template <typename T,
- typename A1,
- typename A2,
- typename A3,
- typename A4,
- typename A5>
- void AddCallback(
- const std::string& name,
- void (T::*method)(A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5)) {
- base::Callback<void(A1, A2, A3, A4, A5)> callback =
- base::Bind(method, base::Unretained(static_cast<T*>(this)));
- web_ui()->RegisterMessageCallback(
- name,
- base::Bind(&::login::CallbackWrapper5<A1, A2, A3, A4, A5>, callback));
+ name, base::Bind(&::login::CallbackWrapper<Args...>, callback));
}
template <typename Method>
« no previous file with comments | « no previous file | components/login/base_screen_handler_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698