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

Side by Side Diff: chrome/browser/ui/webui/translate_internals/translate_internals_handler.cc

Issue 1995113002: Rename WebUI::CallJavascriptFunction to WebUI::CallJavascriptFunctionUnsafe (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/webui/theme_handler.cc ('k') | chrome/browser/ui/webui/uber/uber_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/translate_internals/translate_internals_handle r.h" 5 #include "chrome/browser/ui/webui/translate_internals/translate_internals_handle r.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 void TranslateInternalsHandler::OnRequestInfo(const base::ListValue* /*args*/) { 181 void TranslateInternalsHandler::OnRequestInfo(const base::ListValue* /*args*/) {
182 SendPrefsToJs(); 182 SendPrefsToJs();
183 SendSupportedLanguagesToJs(); 183 SendSupportedLanguagesToJs();
184 SendCountryToJs(false); 184 SendCountryToJs(false);
185 } 185 }
186 186
187 void TranslateInternalsHandler::SendMessageToJs(const std::string& message, 187 void TranslateInternalsHandler::SendMessageToJs(const std::string& message,
188 const base::Value& value) { 188 const base::Value& value) {
189 const char func[] = "cr.translateInternals.messageHandler"; 189 const char func[] = "cr.translateInternals.messageHandler";
190 base::StringValue message_data(message); 190 base::StringValue message_data(message);
191 web_ui()->CallJavascriptFunction(func, message_data, value); 191 web_ui()->CallJavascriptFunctionUnsafe(func, message_data, value);
192 } 192 }
193 193
194 void TranslateInternalsHandler::SendPrefsToJs() { 194 void TranslateInternalsHandler::SendPrefsToJs() {
195 content::WebContents* web_contents = web_ui()->GetWebContents(); 195 content::WebContents* web_contents = web_ui()->GetWebContents();
196 Profile* profile = 196 Profile* profile =
197 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 197 Profile::FromBrowserContext(web_contents->GetBrowserContext());
198 PrefService* prefs = profile->GetOriginalProfile()->GetPrefs(); 198 PrefService* prefs = profile->GetOriginalProfile()->GetPrefs();
199 199
200 base::DictionaryValue dict; 200 base::DictionaryValue dict;
201 201
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 if (variations_service) 250 if (variations_service)
251 country = variations_service->GetStoredPermanentCountry(); 251 country = variations_service->GetStoredPermanentCountry();
252 252
253 base::DictionaryValue dict; 253 base::DictionaryValue dict;
254 if (!country.empty()) { 254 if (!country.empty()) {
255 dict.Set("country", new base::StringValue(country)); 255 dict.Set("country", new base::StringValue(country));
256 dict.Set("update", new base::FundamentalValue(was_updated)); 256 dict.Set("update", new base::FundamentalValue(was_updated));
257 } 257 }
258 SendMessageToJs("countryUpdated", dict); 258 SendMessageToJs("countryUpdated", dict);
259 } 259 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/theme_handler.cc ('k') | chrome/browser/ui/webui/uber/uber_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698