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

Side by Side Diff: chrome/browser/chromeos/base/locale_util.h

Issue 620563002: ChromeOS NetworkScreenHandler should not call CheckAndResolveLocale on UI thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 6 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/base/locale_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 // This file contains utility functions for locale change. 5 // This file contains utility functions for locale change.
6 6
7 #ifndef CHROME_BROWSER_CHROMEOS_BASE_LOCALE_UTIL_H_ 7 #ifndef CHROME_BROWSER_CHROMEOS_BASE_LOCALE_UTIL_H_
8 #define CHROME_BROWSER_CHROMEOS_BASE_LOCALE_UTIL_H_ 8 #define CHROME_BROWSER_CHROMEOS_BASE_LOCALE_UTIL_H_
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 13
14 namespace base { 14 namespace base {
15 15
16 template <typename T> 16 template <typename T>
17 class Callback; 17 class Callback;
18 18
19 } // namespace base 19 } // namespace base
20 20
21 namespace chromeos { 21 namespace chromeos {
22 namespace locale_util { 22 namespace locale_util {
23 23
24 class LanguageSwitchResult {
Nikita (slow) 2014/10/02 13:47:29 struct
Alexander Alekseev 2014/10/02 19:05:03 Done.
25 public:
26 LanguageSwitchResult(const std::string& requested_locale,
27 const std::string& loaded_locale,
28 bool success);
29
30 std::string requested_locale;
31 std::string loaded_locale;
32 bool success;
33 };
34
24 // This callback is called on UI thread, when ReloadLocaleResources() is 35 // This callback is called on UI thread, when ReloadLocaleResources() is
25 // completed on BlockingPool. 36 // completed on BlockingPool.
26 // Arguments: 37 // Arguments:
27 // locale - (copy of) locale argument to SwitchLanguage(). Expected locale. 38 // locale - (copy of) locale argument to SwitchLanguage(). Expected locale.
28 // loaded_locale - actual locale name loaded. 39 // loaded_locale - actual locale name loaded.
29 // success - if locale load succeeded. 40 // success - if locale load succeeded.
30 // (const std::string* locale, const std::string* loaded_locale, bool success) 41 // (const std::string* locale, const std::string* loaded_locale, bool success)
31 typedef base::Callback<void(const std::string&, const std::string&, bool)> 42 typedef base::Callback<void(scoped_ptr<LanguageSwitchResult> result)>
32 SwitchLanguageCallback; 43 SwitchLanguageCallback;
33 44
34 // This function updates input methods only if requested. In general, you want 45 // This function updates input methods only if requested. In general, you want
35 // |enable_locale_keyboard_layouts = true|. 46 // |enable_locale_keyboard_layouts = true|.
36 // Note: in case of |enable_locale_keyboard_layouts = false|, the input method 47 // Note: in case of |enable_locale_keyboard_layouts = false|, the input method
37 // currently in use may not be supported by the new locale. Using the new locale 48 // currently in use may not be supported by the new locale. Using the new locale
38 // with an unsupported input method may lead to undefined behavior. Use 49 // with an unsupported input method may lead to undefined behavior. Use
39 // |enable_locale_keyboard_layouts = false| with caution. 50 // |enable_locale_keyboard_layouts = false| with caution.
40 // Note 2: |login_layouts_only = true| enables only login-capable layouts. 51 // Note 2: |login_layouts_only = true| enables only login-capable layouts.
41 void SwitchLanguage(const std::string& locale, 52 void SwitchLanguage(const std::string& locale,
42 const bool enable_locale_keyboard_layouts, 53 const bool enable_locale_keyboard_layouts,
43 const bool login_layouts_only, 54 const bool login_layouts_only,
44 scoped_ptr<SwitchLanguageCallback> callback); 55 scoped_ptr<SwitchLanguageCallback> callback);
45 56
46 } // namespace locale_util 57 } // namespace locale_util
47 } // namespace chromeos 58 } // namespace chromeos
48 59
49 #endif // CHROME_BROWSER_CHROMEOS_BASE_LOCALE_UTIL_H_ 60 #endif // CHROME_BROWSER_CHROMEOS_BASE_LOCALE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/base/locale_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698