OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/dom_ui/options/language_options_handler.h" | 5 #include "chrome/browser/dom_ui/options/language_options_handler.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 } | 376 } |
377 | 377 |
378 void LanguageOptionsHandler::UiLanguageChangeCallback( | 378 void LanguageOptionsHandler::UiLanguageChangeCallback( |
379 const ListValue* args) { | 379 const ListValue* args) { |
380 const std::string language_code = WideToASCII(ExtractStringValue(args)); | 380 const std::string language_code = WideToASCII(ExtractStringValue(args)); |
381 CHECK(!language_code.empty()); | 381 CHECK(!language_code.empty()); |
382 const std::string action = StringPrintf( | 382 const std::string action = StringPrintf( |
383 "LanguageOptions_UiLanguageChange_%s", language_code.c_str()); | 383 "LanguageOptions_UiLanguageChange_%s", language_code.c_str()); |
384 UserMetrics::RecordComputedAction(action); | 384 UserMetrics::RecordComputedAction(action); |
385 #if defined(OS_CHROMEOS) | 385 #if defined(OS_CHROMEOS) |
386 dom_ui_->GetProfile()->ChangeApplicationLocale(language_code, false); | 386 dom_ui_->GetProfile()->ChangeAppLocale( |
| 387 language_code, Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); |
387 #else | 388 #else |
388 PrefService* pref_service = g_browser_process->local_state(); | 389 PrefService* pref_service = g_browser_process->local_state(); |
389 pref_service->SetString(prefs::kApplicationLocale, language_code); | 390 pref_service->SetString(prefs::kApplicationLocale, language_code); |
390 #endif // defined(OS_CHROMEOS) | 391 #endif // defined(OS_CHROMEOS) |
391 dom_ui_->CallJavascriptFunction( | 392 dom_ui_->CallJavascriptFunction( |
392 L"options.LanguageOptions.uiLanguageSaved"); | 393 L"options.LanguageOptions.uiLanguageSaved"); |
393 } | 394 } |
394 | 395 |
395 void LanguageOptionsHandler::SpellCheckLanguageChangeCallback( | 396 void LanguageOptionsHandler::SpellCheckLanguageChangeCallback( |
396 const ListValue* args) { | 397 const ListValue* args) { |
(...skipping 15 matching lines...) Expand all Loading... |
412 #else | 413 #else |
413 UserMetrics::RecordAction(UserMetricsAction("LanguageOptions_Restart")); | 414 UserMetrics::RecordAction(UserMetricsAction("LanguageOptions_Restart")); |
414 | 415 |
415 // Set the flag to restore state after the restart. | 416 // Set the flag to restore state after the restart. |
416 PrefService* pref_service = g_browser_process->local_state(); | 417 PrefService* pref_service = g_browser_process->local_state(); |
417 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, true); | 418 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, true); |
418 BrowserList::CloseAllBrowsersAndExit(); | 419 BrowserList::CloseAllBrowsersAndExit(); |
419 #endif // defined(OS_CHROMEOS) | 420 #endif // defined(OS_CHROMEOS) |
420 } | 421 } |
421 | 422 |
OLD | NEW |