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

Unified Diff: content/browser/webui/web_ui_message_handler.cc

Issue 2040473002: Move {Resolve|Reject}JavascriptCallback helpers in WebUIMessageHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comment. Created 4 years, 6 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
Index: content/browser/webui/web_ui_message_handler.cc
diff --git a/content/browser/webui/web_ui_message_handler.cc b/content/browser/webui/web_ui_message_handler.cc
index 56e0adcbbaa7a1919749123f767746c17f0069fa..41ca291e03e8ec768fab1e9de23d2dc3f05eca97 100644
--- a/content/browser/webui/web_ui_message_handler.cc
+++ b/content/browser/webui/web_ui_message_handler.cc
@@ -73,4 +73,20 @@ void WebUIMessageHandler::RenderViewReused() {
DisallowJavascript();
}
+void WebUIMessageHandler::ResolveJavascriptCallback(
+ const base::Value& callback_id,
+ const base::Value& response) {
+ // cr.webUIResponse is a global JS function exposed from cr.js.
+ CallJavascriptFunction("cr.webUIResponse", callback_id,
+ base::FundamentalValue(true), response);
+}
+
+void WebUIMessageHandler::RejectJavascriptCallback(
+ const base::Value& callback_id,
+ const base::Value& response) {
+ // cr.webUIResponse is a global JS function exposed from cr.js.
+ CallJavascriptFunction("cr.webUIResponse", callback_id,
+ base::FundamentalValue(false), response);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698