OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/settings/languages_handler.h" | 5 #include "chrome/browser/ui/webui/settings/languages_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #if defined(OS_CHROMEOS) | 54 #if defined(OS_CHROMEOS) |
55 // On Chrome OS, an individual profile may have a preferred locale. | 55 // On Chrome OS, an individual profile may have a preferred locale. |
56 locale = profile_->GetPrefs()->GetString(prefs::kApplicationLocale); | 56 locale = profile_->GetPrefs()->GetString(prefs::kApplicationLocale); |
57 #endif // defined(OS_CHROMEOS) | 57 #endif // defined(OS_CHROMEOS) |
58 | 58 |
59 if (locale.empty()) { | 59 if (locale.empty()) { |
60 locale = | 60 locale = |
61 g_browser_process->local_state()->GetString(prefs::kApplicationLocale); | 61 g_browser_process->local_state()->GetString(prefs::kApplicationLocale); |
62 } | 62 } |
63 | 63 |
64 ResolveJavascriptCallback(*callback_id, base::StringValue(locale)); | 64 ResolveJavascriptCallback(*callback_id, base::Value(locale)); |
65 #else | 65 #else |
66 NOTREACHED() << "Attempting to get locale on unsupported platform"; | 66 NOTREACHED() << "Attempting to get locale on unsupported platform"; |
67 #endif // defined(OS_WIN) || defined(OS_CHROMEOS) | 67 #endif // defined(OS_WIN) || defined(OS_CHROMEOS) |
68 } | 68 } |
69 | 69 |
70 void LanguagesHandler::HandleSetProspectiveUILanguage( | 70 void LanguagesHandler::HandleSetProspectiveUILanguage( |
71 const base::ListValue* args) { | 71 const base::ListValue* args) { |
72 AllowJavascript(); | 72 AllowJavascript(); |
73 CHECK_EQ(1U, args->GetSize()); | 73 CHECK_EQ(1U, args->GetSize()); |
74 | 74 |
(...skipping 13 matching lines...) Expand all Loading... |
88 user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) { | 88 user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) { |
89 profile_->ChangeAppLocale(language_code, | 89 profile_->ChangeAppLocale(language_code, |
90 Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); | 90 Profile::APP_LOCALE_CHANGED_VIA_SETTINGS); |
91 } | 91 } |
92 #else | 92 #else |
93 NOTREACHED() << "Attempting to set locale on unsupported platform"; | 93 NOTREACHED() << "Attempting to set locale on unsupported platform"; |
94 #endif | 94 #endif |
95 } | 95 } |
96 | 96 |
97 } // namespace settings | 97 } // namespace settings |
OLD | NEW |