Commit 06f705e5 authored by Jacob Dufault's avatar Jacob Dufault Committed by Commit Bot

cros: Eliminate CallJSWithPrefix

Bug: 908498
Change-Id: I5c3e0376e94f18808041db0371411ae6ec168eb2
Reviewed-on: https://chromium-review.googlesource.com/c/1352355
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625343}
parent 9efff00b
......@@ -66,7 +66,7 @@ void BaseWebUIHandler::CommitContextChanges(const base::DictionaryValue& diff) {
if (!page_is_ready())
pending_context_changes_.MergeDictionary(&diff);
else
CallJSWithPrefix(kMethodContextChanged, diff);
CallJS(FullMethodPath(kMethodContextChanged), diff);
}
void BaseWebUIHandler::GetAdditionalParameters(base::DictionaryValue* dict) {}
......@@ -75,10 +75,6 @@ void BaseWebUIHandler::CallJS(const std::string& method) {
web_ui()->CallJavascriptFunctionUnsafe(method);
}
void BaseWebUIHandler::CallJSWithPrefix(const std::string& method) {
CallJS(FullMethodPath(method));
}
void BaseWebUIHandler::ShowScreen(OobeScreen screen) {
ShowScreenWithData(screen, nullptr);
}
......
......@@ -123,7 +123,7 @@ class BaseWebUIHandler : public content::WebUIMessageHandler,
// names.
std::string FullMethodPath(const std::string& method) const;
// Call a JavaScript method.
// Shortcut for calling JS methods on WebUI side.
void CallJS(const std::string& method);
template <typename A1>
......@@ -158,38 +158,6 @@ class BaseWebUIHandler : public content::WebUIMessageHandler,
::login::MakeValue(arg3), ::login::MakeValue(arg4));
}
// Shortcut for calling JS methods on WebUI side.
void CallJSWithPrefix(const std::string& method);
template <typename A1>
void CallJSWithPrefix(const std::string& method, const A1& arg1) {
CallJS(FullMethodPath(method), arg1);
}
template <typename A1, typename A2>
void CallJSWithPrefix(const std::string& method,
const A1& arg1,
const A2& arg2) {
CallJS(FullMethodPath(method), arg1, arg2);
}
template <typename A1, typename A2, typename A3>
void CallJSWithPrefix(const std::string& method,
const A1& arg1,
const A2& arg2,
const A3& arg3) {
CallJS(FullMethodPath(method), arg1, arg2, arg3);
}
template <typename A1, typename A2, typename A3, typename A4>
void CallJSWithPrefix(const std::string& method,
const A1& arg1,
const A2& arg2,
const A3& arg3,
const A4& arg4) {
CallJS(FullMethodPath(method), arg1, arg2, arg3, arg4);
}
template <typename... Args>
void CallJSOrDefer(const std::string& function_name, const Args&... args) {
DCHECK(js_calls_container_);
......
......@@ -87,7 +87,7 @@ void NetworkScreenHandler::ShowConnectingStatus(
const base::string16& network_id) {}
void NetworkScreenHandler::SetOfflineDemoModeEnabled(bool enabled) {
CallJSWithPrefix("setOfflineDemoModeEnabled", enabled);
CallJS("login.NetworkScreen.setOfflineDemoModeEnabled", enabled);
}
void NetworkScreenHandler::DeclareLocalizedValues(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment