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

Unified Diff: components/webui_generator/web_ui_view.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 | « components/login/base_screen_handler_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/webui_generator/web_ui_view.h
diff --git a/components/webui_generator/web_ui_view.h b/components/webui_generator/web_ui_view.h
index 9fd26cf056e495c67fbfddec1f718405ccfaae60..bfb8c9fafb60db0d8849cffb9eafda994b58a5ab 100644
--- a/components/webui_generator/web_ui_view.h
+++ b/components/webui_generator/web_ui_view.h
@@ -58,20 +58,12 @@ class WUG_EXPORT WebUIView : public View {
content::WebUI* web_ui() { return web_ui_; }
- template <typename T>
- void AddCallback(const std::string& name, void (T::*method)()) {
- base::Callback<void()> 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::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));
+ name, base::Bind(&::login::CallbackWrapper<Args...>, callback));
}
// Overridden from View:
« no previous file with comments | « components/login/base_screen_handler_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698