Commit 25c4a399 authored by Jacob Dufault's avatar Jacob Dufault Committed by Commit Bot

cros: Migrate discover away from prefixed-based JS calls

Bug: 908498
Change-Id: I763088c5a8f6eb065c563ae269e6ec24955aa1fc
Reviewed-on: https://chromium-review.googlesource.com/c/1351688
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625363}
parent fe436d6b
......@@ -16,10 +16,6 @@
namespace chromeos {
namespace {
const char kMethodContextChanged[] = "contextChanged";
} // namespace
JSCallsContainer::JSCallsContainer() = default;
JSCallsContainer::~JSCallsContainer() = default;
......@@ -66,7 +62,7 @@ void BaseWebUIHandler::CommitContextChanges(const base::DictionaryValue& diff) {
if (!page_is_ready())
pending_context_changes_.MergeDictionary(&diff);
else
CallJS(FullMethodPath(kMethodContextChanged), diff);
CallJS(FullMethodPath("contextChanged"), diff);
}
void BaseWebUIHandler::GetAdditionalParameters(base::DictionaryValue* dict) {}
......
......@@ -119,10 +119,6 @@ class BaseWebUIHandler : public content::WebUIMessageHandler,
// with Context at some point.
virtual void GetAdditionalParameters(base::DictionaryValue* parameters);
// Returns full name of JS method based on screen and method
// names.
std::string FullMethodPath(const std::string& method) const;
// Shortcut for calling JS methods on WebUI side.
void CallJS(const std::string& method);
......@@ -234,6 +230,9 @@ class BaseWebUIHandler : public content::WebUIMessageHandler,
CallJS(function_name, *args...);
}
// Returns full name of JS method based on screen and method names.
std::string FullMethodPath(const std::string& method) const;
// Handles user action.
void HandleUserAction(const std::string& action_id);
......
......@@ -45,7 +45,7 @@ void DiscoverModuleLaunchHelpAppHandler::DeclareLocalizedValues(
void DiscoverModuleLaunchHelpAppHandler::Initialize() {}
void DiscoverModuleLaunchHelpAppHandler::RegisterMessages() {
AddCallback(FullMethodPath("handleLaunchHelpApp"),
AddCallback("discover.launch-help-app.handleLaunchHelpApp",
&DiscoverModuleLaunchHelpAppHandler::HandleLaunchHelpApp);
}
......
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