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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/l10n_util.h

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_L10N_UTIL_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_L10N_UTIL_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_L10N_UTIL_H_ 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_L10N_UTIL_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/callback.h" 12 #include "base/callback.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "chrome/browser/chromeos/base/locale_util.h" 14 #include "chrome/browser/chromeos/base/locale_util.h"
15 15
16 namespace base { 16 namespace base {
17 class DictionaryValue; 17 class DictionaryValue;
18 class ListValue; 18 class ListValue;
19 } 19 }
20 20
21 namespace chromeos { 21 namespace chromeos {
22 22
23 typedef base::Callback<void(scoped_ptr<base::ListValue> /* new_language_list */, 23 typedef base::Callback<void(
24 const std::string& /* new_language_list_locale */, 24 std::unique_ptr<base::ListValue> /* new_language_list */,
25 const std::string& /* new_selected_language */)> 25 const std::string& /* new_language_list_locale */,
26 const std::string& /* new_selected_language */)>
26 UILanguageListResolvedCallback; 27 UILanguageListResolvedCallback;
27 28
28 // GetUILanguageList() returns a concatenated list of the most relevant 29 // GetUILanguageList() returns a concatenated list of the most relevant
29 // languages followed by all others. An entry with its "code" attribute set to 30 // languages followed by all others. An entry with its "code" attribute set to
30 // this value is inserted in between. 31 // this value is inserted in between.
31 extern const char kMostRelevantLanguagesDivider[]; 32 extern const char kMostRelevantLanguagesDivider[];
32 33
33 // Utility methods for retrieving lists of supported locales and input methods / 34 // Utility methods for retrieving lists of supported locales and input methods /
34 // keyboard layouts during OOBE and on the login screen. 35 // keyboard layouts during OOBE and on the login screen.
35 36
36 // Return a list of languages in which the UI can be shown. Each list entry is a 37 // Return a list of languages in which the UI can be shown. Each list entry is a
37 // dictionary that contains data such as the language's locale code and a 38 // dictionary that contains data such as the language's locale code and a
38 // display name. The list will consist of the |most_relevant_language_codes|, 39 // display name. The list will consist of the |most_relevant_language_codes|,
39 // followed by a divider and all other supported languages after that. If 40 // followed by a divider and all other supported languages after that. If
40 // |most_relevant_language_codes| is NULL, the most relevant languages are read 41 // |most_relevant_language_codes| is NULL, the most relevant languages are read
41 // from initial_locale in VPD. If |selected| matches the locale code of any 42 // from initial_locale in VPD. If |selected| matches the locale code of any
42 // entry in the resulting list, that entry will be marked as selected. 43 // entry in the resulting list, that entry will be marked as selected.
43 scoped_ptr<base::ListValue> GetUILanguageList( 44 std::unique_ptr<base::ListValue> GetUILanguageList(
44 const std::vector<std::string>* most_relevant_language_codes, 45 const std::vector<std::string>* most_relevant_language_codes,
45 const std::string& selected); 46 const std::string& selected);
46 47
47 // Must be called on UI thread. Runs GetUILanguageList(), on Blocking Pool, 48 // Must be called on UI thread. Runs GetUILanguageList(), on Blocking Pool,
48 // and calls |callback| on UI thread with result. 49 // and calls |callback| on UI thread with result.
49 // If |language_switch_result| is null, assume current browser locale is already 50 // If |language_switch_result| is null, assume current browser locale is already
50 // correct and has been successfully loaded. 51 // correct and has been successfully loaded.
51 void ResolveUILanguageList( 52 void ResolveUILanguageList(
52 scoped_ptr<locale_util::LanguageSwitchResult> language_switch_result, 53 std::unique_ptr<locale_util::LanguageSwitchResult> language_switch_result,
53 const UILanguageListResolvedCallback& callback); 54 const UILanguageListResolvedCallback& callback);
54 55
55 // Returns a minimal list of UI languages, which consists of active language 56 // Returns a minimal list of UI languages, which consists of active language
56 // only. It is used as a placeholder until ResolveUILanguageList() finishes 57 // only. It is used as a placeholder until ResolveUILanguageList() finishes
57 // on BlockingPool. 58 // on BlockingPool.
58 scoped_ptr<base::ListValue> GetMinimalUILanguageList(); 59 std::unique_ptr<base::ListValue> GetMinimalUILanguageList();
59 60
60 // Returns the most first entry of |most_relevant_language_codes| that is 61 // Returns the most first entry of |most_relevant_language_codes| that is
61 // actually available (present in |available_locales|). If none of the entries 62 // actually available (present in |available_locales|). If none of the entries
62 // are present in |available_locales|, returns the |fallback_locale|. 63 // are present in |available_locales|, returns the |fallback_locale|.
63 std::string FindMostRelevantLocale( 64 std::string FindMostRelevantLocale(
64 const std::vector<std::string>& most_relevant_language_codes, 65 const std::vector<std::string>& most_relevant_language_codes,
65 const base::ListValue& available_locales, 66 const base::ListValue& available_locales,
66 const std::string& fallback_locale); 67 const std::string& fallback_locale);
67 68
68 // Return a list of supported accept languages. The listed languages can be used 69 // Return a list of supported accept languages. The listed languages can be used
69 // in the Accept-Language header. The return value will look like: 70 // in the Accept-Language header. The return value will look like:
70 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, ...] 71 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, ...]
71 // The most relevant languages, read from initial_locale in VPD, will be first 72 // The most relevant languages, read from initial_locale in VPD, will be first
72 // in the list. 73 // in the list.
73 scoped_ptr<base::ListValue> GetAcceptLanguageList(); 74 std::unique_ptr<base::ListValue> GetAcceptLanguageList();
74 75
75 // Return a list of keyboard layouts that can be used for |locale| on the login 76 // Return a list of keyboard layouts that can be used for |locale| on the login
76 // screen. Each list entry is a dictionary that contains data such as an ID and 77 // screen. Each list entry is a dictionary that contains data such as an ID and
77 // a display name. The list will consist of the device's hardware layouts, 78 // a display name. The list will consist of the device's hardware layouts,
78 // followed by a divider and locale-specific keyboard layouts, if any. The list 79 // followed by a divider and locale-specific keyboard layouts, if any. The list
79 // will also always contain the US keyboard layout. If |selected| matches the ID 80 // will also always contain the US keyboard layout. If |selected| matches the ID
80 // of any entry in the resulting list, that entry will be marked as selected. 81 // of any entry in the resulting list, that entry will be marked as selected.
81 // In addition to returning the list of keyboard layouts, this function also 82 // In addition to returning the list of keyboard layouts, this function also
82 // activates them if |activate_keyboards| is true, so that they can be selected 83 // activates them if |activate_keyboards| is true, so that they can be selected
83 // by the user (e.g. by cycling through keyboard layouts via keyboard 84 // by the user (e.g. by cycling through keyboard layouts via keyboard
84 // shortcuts). 85 // shortcuts).
85 scoped_ptr<base::ListValue> GetAndActivateLoginKeyboardLayouts( 86 std::unique_ptr<base::ListValue> GetAndActivateLoginKeyboardLayouts(
86 const std::string& locale, 87 const std::string& locale,
87 const std::string& selected, 88 const std::string& selected,
88 bool activate_keyboards); 89 bool activate_keyboards);
89 90
90 // Invokes |callback| with a list of keyboard layouts that can be used for 91 // Invokes |callback| with a list of keyboard layouts that can be used for
91 // |locale|. Each list entry is a dictionary that contains data such as an ID 92 // |locale|. Each list entry is a dictionary that contains data such as an ID
92 // and a display name. The list will consist of the device's hardware layouts, 93 // and a display name. The list will consist of the device's hardware layouts,
93 // followed by a divider and locale-specific keyboard layouts, if any. All 94 // followed by a divider and locale-specific keyboard layouts, if any. All
94 // layouts supported for |locale| are returned, including those that produce 95 // layouts supported for |locale| are returned, including those that produce
95 // non-Latin characters by default. 96 // non-Latin characters by default.
96 typedef base::Callback<void(scoped_ptr<base::ListValue>)> 97 typedef base::Callback<void(std::unique_ptr<base::ListValue>)>
97 GetKeyboardLayoutsForLocaleCallback; 98 GetKeyboardLayoutsForLocaleCallback;
98 void GetKeyboardLayoutsForLocale( 99 void GetKeyboardLayoutsForLocale(
99 const GetKeyboardLayoutsForLocaleCallback& callback, 100 const GetKeyboardLayoutsForLocaleCallback& callback,
100 const std::string& locale); 101 const std::string& locale);
101 102
102 // Returns the current keyboard layout, expressed as a dictionary that contains 103 // Returns the current keyboard layout, expressed as a dictionary that contains
103 // data such as an ID and a display name. 104 // data such as an ID and a display name.
104 scoped_ptr<base::DictionaryValue> GetCurrentKeyboardLayout(); 105 std::unique_ptr<base::DictionaryValue> GetCurrentKeyboardLayout();
105 106
106 } // namespace chromeos 107 } // namespace chromeos
107 108
108 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_L10N_UTIL_H_ 109 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_L10N_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/kiosk_app_menu_handler.cc ('k') | chrome/browser/ui/webui/chromeos/login/l10n_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698