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

Unified Diff: chrome/browser/ui/webui/settings/search_engines_handler.cc

Issue 2890523003: WebUI: Add helper FireWebUIListener method on WebUIMessageHandler. (Closed)
Patch Set: Address comment. Created 3 years, 7 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 | content/public/browser/web_ui_message_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/settings/search_engines_handler.cc
diff --git a/chrome/browser/ui/webui/settings/search_engines_handler.cc b/chrome/browser/ui/webui/settings/search_engines_handler.cc
index 077d940d7905736a8c5daf8dca586a1fc57e4e94..31be170b31927d5e1747ea1ef0aa7c6d0ae9e797 100644
--- a/chrome/browser/ui/webui/settings/search_engines_handler.cc
+++ b/chrome/browser/ui/webui/settings/search_engines_handler.cc
@@ -196,13 +196,11 @@ SearchEnginesHandler::GetSearchEnginesList() {
void SearchEnginesHandler::OnModelChanged() {
AllowJavascript();
- CallJavascriptFunction("cr.webUIListenerCallback",
- base::Value("search-engines-changed"),
- *GetSearchEnginesList());
+ FireWebUIListener("search-engines-changed", *GetSearchEnginesList());
+
// Google Now availability may have changed.
- CallJavascriptFunction("cr.webUIListenerCallback",
- base::Value("google-now-availability-changed"),
- base::Value(IsGoogleNowAvailable(profile_)));
+ FireWebUIListener("google-now-availability-changed",
+ base::Value(IsGoogleNowAvailable(profile_)));
}
void SearchEnginesHandler::OnItemsChanged(int start, int length) {
@@ -514,12 +512,10 @@ void SearchEnginesHandler::OnGetHotwordAudioHistoryEnabled(
void SearchEnginesHandler::HotwordInfoComplete(
const base::Value* callback_id,
const base::DictionaryValue& status) {
- if (callback_id) {
+ if (callback_id)
ResolveJavascriptCallback(*callback_id, status);
- } else {
- CallJavascriptFunction("cr.webUIListenerCallback",
- base::Value("hotword-info-update"), status);
- }
+ else
+ FireWebUIListener("hotword-info-update", status);
}
void SearchEnginesHandler::SendHotwordInfo() {
« no previous file with comments | « no previous file | content/public/browser/web_ui_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698