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

Side by Side Diff: chrome/browser/dom_ui/options/language_options_handler.cc

Issue 6324009: dom-ui settings: save UI language state in local_state, not profile.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698