1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file contains utility functions for locale change.
7 #ifndef CHROME_BROWSER_CHROMEOS_BASE_LOCALE_UTIL_H_
8 #define CHROME_BROWSER_CHROMEOS_BASE_LOCALE_UTIL_H_
12 #include "base/memory/scoped_ptr.h"
22 namespace locale_util
{
24 struct LanguageSwitchResult
{
25 LanguageSwitchResult(const std::string
& requested_locale
,
26 const std::string
& loaded_locale
,
29 std::string requested_locale
;
30 std::string loaded_locale
;
34 // This callback is called on UI thread, when ReloadLocaleResources() is
35 // completed on BlockingPool.
37 // locale - (copy of) locale argument to SwitchLanguage(). Expected locale.
38 // loaded_locale - actual locale name loaded.
39 // success - if locale load succeeded.
40 // (const std::string* locale, const std::string* loaded_locale, bool success)
41 typedef base::Callback
<void(const LanguageSwitchResult
& result
)>
42 SwitchLanguageCallback
;
44 // This function updates input methods only if requested. In general, you want
45 // |enable_locale_keyboard_layouts = true|.
46 // Note: in case of |enable_locale_keyboard_layouts = false|, the input method
47 // currently in use may not be supported by the new locale. Using the new locale
48 // with an unsupported input method may lead to undefined behavior. Use
49 // |enable_locale_keyboard_layouts = false| with caution.
50 // Note 2: |login_layouts_only = true| enables only login-capable layouts.
51 void SwitchLanguage(const std::string
& locale
,
52 const bool enable_locale_keyboard_layouts
,
53 const bool login_layouts_only
,
54 const SwitchLanguageCallback
& callback
);
56 } // namespace locale_util
57 } // namespace chromeos
59 #endif // CHROME_BROWSER_CHROMEOS_BASE_LOCALE_UTIL_H_