| 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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()->ChangeApplicationLocale(language_code, false); |
| 387 #else | 387 #else |
| 388 PrefService* prefs = dom_ui_->GetProfile()->GetPrefs(); | 388 PrefService* pref_service = g_browser_process->local_state(); |
| 389 prefs->SetString(prefs::kApplicationLocale, language_code); | 389 pref_service->SetString(prefs::kApplicationLocale, language_code); |
| 390 #endif // defined(OS_CHROMEOS) | 390 #endif // defined(OS_CHROMEOS) |
| 391 dom_ui_->CallJavascriptFunction( | 391 dom_ui_->CallJavascriptFunction( |
| 392 L"options.LanguageOptions.uiLanguageSaved"); | 392 L"options.LanguageOptions.uiLanguageSaved"); |
| 393 } | 393 } |
| 394 | 394 |
| 395 void LanguageOptionsHandler::SpellCheckLanguageChangeCallback( | 395 void LanguageOptionsHandler::SpellCheckLanguageChangeCallback( |
| 396 const ListValue* args) { | 396 const ListValue* args) { |
| 397 const std::string language_code = WideToASCII(ExtractStringValue(args)); | 397 const std::string language_code = WideToASCII(ExtractStringValue(args)); |
| 398 CHECK(!language_code.empty()); | 398 CHECK(!language_code.empty()); |
| 399 const std::string action = StringPrintf( | 399 const std::string action = StringPrintf( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 412 #else | 412 #else |
| 413 UserMetrics::RecordAction(UserMetricsAction("LanguageOptions_Restart")); | 413 UserMetrics::RecordAction(UserMetricsAction("LanguageOptions_Restart")); |
| 414 | 414 |
| 415 // Set the flag to restore state after the restart. | 415 // Set the flag to restore state after the restart. |
| 416 PrefService* pref_service = g_browser_process->local_state(); | 416 PrefService* pref_service = g_browser_process->local_state(); |
| 417 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, true); | 417 pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, true); |
| 418 BrowserList::CloseAllBrowsersAndExit(); | 418 BrowserList::CloseAllBrowsersAndExit(); |
| 419 #endif // defined(OS_CHROMEOS) | 419 #endif // defined(OS_CHROMEOS) |
| 420 } | 420 } |
| 421 | 421 |
| OLD | NEW |