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

Side by Side Diff: chrome/browser/ui/webui/options/language_options_handler_common.cc

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/options/language_options_handler_common.h" 5 #include "chrome/browser/ui/webui/options/language_options_handler_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } 159 }
160 160
161 void LanguageOptionsHandlerCommon::OnHunspellDictionaryInitialized( 161 void LanguageOptionsHandlerCommon::OnHunspellDictionaryInitialized(
162 const std::string& language) { 162 const std::string& language) {
163 } 163 }
164 164
165 void LanguageOptionsHandlerCommon::OnHunspellDictionaryDownloadBegin( 165 void LanguageOptionsHandlerCommon::OnHunspellDictionaryDownloadBegin(
166 const std::string& language) { 166 const std::string& language) {
167 web_ui()->CallJavascriptFunctionUnsafe( 167 web_ui()->CallJavascriptFunctionUnsafe(
168 "options.LanguageOptions.onDictionaryDownloadBegin", 168 "options.LanguageOptions.onDictionaryDownloadBegin",
169 base::StringValue(language)); 169 base::Value(language));
170 } 170 }
171 171
172 void LanguageOptionsHandlerCommon::OnHunspellDictionaryDownloadSuccess( 172 void LanguageOptionsHandlerCommon::OnHunspellDictionaryDownloadSuccess(
173 const std::string& language) { 173 const std::string& language) {
174 web_ui()->CallJavascriptFunctionUnsafe( 174 web_ui()->CallJavascriptFunctionUnsafe(
175 "options.LanguageOptions.onDictionaryDownloadSuccess", 175 "options.LanguageOptions.onDictionaryDownloadSuccess",
176 base::StringValue(language)); 176 base::Value(language));
177 } 177 }
178 178
179 void LanguageOptionsHandlerCommon::OnHunspellDictionaryDownloadFailure( 179 void LanguageOptionsHandlerCommon::OnHunspellDictionaryDownloadFailure(
180 const std::string& language) { 180 const std::string& language) {
181 web_ui()->CallJavascriptFunctionUnsafe( 181 web_ui()->CallJavascriptFunctionUnsafe(
182 "options.LanguageOptions.onDictionaryDownloadFailure", 182 "options.LanguageOptions.onDictionaryDownloadFailure",
183 base::StringValue(language)); 183 base::Value(language));
184 } 184 }
185 185
186 base::DictionaryValue* LanguageOptionsHandlerCommon::GetUILanguageCodeSet() { 186 base::DictionaryValue* LanguageOptionsHandlerCommon::GetUILanguageCodeSet() {
187 base::DictionaryValue* dictionary = new base::DictionaryValue(); 187 base::DictionaryValue* dictionary = new base::DictionaryValue();
188 const std::vector<std::string>& available_locales = 188 const std::vector<std::string>& available_locales =
189 l10n_util::GetAvailableLocales(); 189 l10n_util::GetAvailableLocales();
190 for (size_t i = 0; i < available_locales.size(); ++i) 190 for (size_t i = 0; i < available_locales.size(); ++i)
191 dictionary->SetBoolean(available_locales[i], true); 191 dictionary->SetBoolean(available_locales[i], true);
192 return dictionary; 192 return dictionary;
193 } 193 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 225
226 void LanguageOptionsHandlerCommon::UiLanguageChangeCallback( 226 void LanguageOptionsHandlerCommon::UiLanguageChangeCallback(
227 const base::ListValue* args) { 227 const base::ListValue* args) {
228 const std::string language_code = 228 const std::string language_code =
229 base::UTF16ToASCII(ExtractStringValue(args)); 229 base::UTF16ToASCII(ExtractStringValue(args));
230 CHECK(!language_code.empty()); 230 CHECK(!language_code.empty());
231 const std::string action = base::StringPrintf( 231 const std::string action = base::StringPrintf(
232 "LanguageOptions_UiLanguageChange_%s", language_code.c_str()); 232 "LanguageOptions_UiLanguageChange_%s", language_code.c_str());
233 content::RecordComputedAction(action); 233 content::RecordComputedAction(action);
234 SetApplicationLocale(language_code); 234 SetApplicationLocale(language_code);
235 base::StringValue language_value(language_code); 235 base::Value language_value(language_code);
236 web_ui()->CallJavascriptFunctionUnsafe( 236 web_ui()->CallJavascriptFunctionUnsafe(
237 "options.LanguageOptions.uiLanguageSaved", language_value); 237 "options.LanguageOptions.uiLanguageSaved", language_value);
238 } 238 }
239 239
240 void LanguageOptionsHandlerCommon::SpellCheckLanguageChangeCallback( 240 void LanguageOptionsHandlerCommon::SpellCheckLanguageChangeCallback(
241 const base::ListValue* args) { 241 const base::ListValue* args) {
242 const std::string language_code = 242 const std::string language_code =
243 base::UTF16ToASCII(ExtractStringValue(args)); 243 base::UTF16ToASCII(ExtractStringValue(args));
244 const std::string action = base::StringPrintf( 244 const std::string action = base::StringPrintf(
245 "LanguageOptions_SpellCheckLanguageChange_%s", language_code.c_str()); 245 "LanguageOptions_SpellCheckLanguageChange_%s", language_code.c_str());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 return; 290 return;
291 } 291 }
292 } 292 }
293 } 293 }
294 294
295 SpellcheckService* LanguageOptionsHandlerCommon::GetSpellcheckService() { 295 SpellcheckService* LanguageOptionsHandlerCommon::GetSpellcheckService() {
296 return SpellcheckServiceFactory::GetForContext(Profile::FromWebUI(web_ui())); 296 return SpellcheckServiceFactory::GetForContext(Profile::FromWebUI(web_ui()));
297 } 297 }
298 298
299 } // namespace options 299 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/font_settings_handler.cc ('k') | chrome/browser/ui/webui/options/manage_profile_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698