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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/cros_language_options_handler.h

Issue 144363006: Expand VPD initial_locale to a list of locales. Use the expanded VPD initial_locale on the OOBE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unittests added. Created 6 years, 10 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H _ 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H _
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H _ 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLER_H _
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "chrome/browser/ui/webui/options/language_options_handler.h" 9 #include "chrome/browser/ui/webui/options/language_options_handler.h"
10 #include "chromeos/ime/component_extension_ime_manager.h" 10 #include "chromeos/ime/component_extension_ime_manager.h"
11 #include "chromeos/ime/input_method_descriptor.h" 11 #include "chromeos/ime/input_method_descriptor.h"
12 12
13 namespace chromeos { 13 namespace chromeos {
14 namespace options { 14 namespace options {
15 15
16 // GetUILanguageList() returns concatenated list of list of vendor languages
17 // followed by other languages. An entry with "code" attribute set to this value
18 // is inserted in between.
19 extern const char kVENDOR_OTHER_LANGUAGES_LIST_DIVIDER[];
Nikita (slow) 2014/01/31 15:47:20 nit: Please follow kConstantName naming style.
Alexander Alekseev 2014/01/31 17:21:00 Done.
20
16 // Language options page UI handler for Chrome OS. For non-Chrome OS, 21 // Language options page UI handler for Chrome OS. For non-Chrome OS,
17 // see LanguageOptionsHnadler. 22 // see LanguageOptionsHnadler.
18 class CrosLanguageOptionsHandler 23 class CrosLanguageOptionsHandler
19 : public ::options::LanguageOptionsHandlerCommon, 24 : public ::options::LanguageOptionsHandlerCommon,
20 public ComponentExtensionIMEManager::Observer { 25 public ComponentExtensionIMEManager::Observer {
21 public: 26 public:
22 CrosLanguageOptionsHandler(); 27 CrosLanguageOptionsHandler();
23 virtual ~CrosLanguageOptionsHandler(); 28 virtual ~CrosLanguageOptionsHandler();
24 29
25 // OptionsPageUIHandler implementation. 30 // OptionsPageUIHandler implementation.
(...skipping 13 matching lines...) Expand all
39 // Note that true in languageCodeSet does not mean anything. We just use 44 // Note that true in languageCodeSet does not mean anything. We just use
40 // the dictionary as a set. 45 // the dictionary as a set.
41 static base::ListValue* GetInputMethodList( 46 static base::ListValue* GetInputMethodList(
42 const input_method::InputMethodDescriptors& descriptors); 47 const input_method::InputMethodDescriptors& descriptors);
43 48
44 // Gets the list of accept languages with the given input descriptors. 49 // Gets the list of accept languages with the given input descriptors.
45 // Listed languages will be used as Accept-Language header. 50 // Listed languages will be used as Accept-Language header.
46 // The return value will look like: 51 // The return value will look like:
47 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, 52 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'},
48 // ...] 53 // ...]
54 // "most relevant" languages, as set in initial_locale in VPD, will be first
55 // in the list.
49 static base::ListValue* GetAcceptLanguageList( 56 static base::ListValue* GetAcceptLanguageList(
50 const input_method::InputMethodDescriptors& descriptors); 57 const input_method::InputMethodDescriptors& descriptors);
51 58
52 // Gets the list of UI languages with the given input descriptors. 59 // Gets the list of UI languages with the given input descriptors.
53 // The return value will look like: 60 // The return value will look like:
54 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'}, 61 // [{'code': 'fi', 'displayName': 'Finnish', 'nativeDisplayName': 'suomi'},
55 // ...] 62 // ...]
63 // "most relevant" languages, as set in initial_locale in VPD, will be first
64 // in the list.
65 // An entry with "code" attribute set to
Nikita (slow) 2014/01/31 15:47:20 nit: Drop extra spaces after //
Alexander Alekseev 2014/01/31 17:21:00 Done.
66 // kVENDOR_OTHER_LANGUAGES_LIST_DIVIDER is used as a divider to separate "most
67 // relevant" languages against other.
56 static base::ListValue* GetUILanguageList( 68 static base::ListValue* GetUILanguageList(
57 const input_method::InputMethodDescriptors& descriptors); 69 const input_method::InputMethodDescriptors& descriptors);
58 70
59 // Converts input method descriptors to the list of input methods. 71 // Converts input method descriptors to the list of input methods.
60 // The return value will look like: 72 // The return value will look like:
61 // [{'id': '_ext_ime_nejguenhnsnjnwychcnsdsdjketest', 73 // [{'id': '_ext_ime_nejguenhnsnjnwychcnsdsdjketest',
62 // 'displayName': 'Sample IME'}, ...] 74 // 'displayName': 'Sample IME'}, ...]
63 static base::ListValue* ConvertInputMethodDescriptosToIMEList( 75 static base::ListValue* ConvertInputMethodDescriptosToIMEList(
64 const input_method::InputMethodDescriptors& descriptors); 76 const input_method::InputMethodDescriptors& descriptors);
65 77
(...skipping 15 matching lines...) Expand all
81 93
82 // Called when the input method options page is opened. 94 // Called when the input method options page is opened.
83 // |args| will contain the input method ID as string (ex. "mozc"). 95 // |args| will contain the input method ID as string (ex. "mozc").
84 void InputMethodOptionsOpenCallback(const base::ListValue* args); 96 void InputMethodOptionsOpenCallback(const base::ListValue* args);
85 97
86 // ComponentExtensionIMEManager::Observer override. 98 // ComponentExtensionIMEManager::Observer override.
87 virtual void OnInitialized() OVERRIDE; 99 virtual void OnInitialized() OVERRIDE;
88 100
89 // Gets the list of languages with |descriptors| based on 101 // Gets the list of languages with |descriptors| based on
90 // |base_language_codes|. 102 // |base_language_codes|.
103 // |insert_divider| means to insert entry with "code" attribute set to
104 // kVENDOR_OTHER_LANGUAGES_LIST_DIVIDER between "most relevant" languages and
105 // other.
91 static base::ListValue* GetLanguageListInternal( 106 static base::ListValue* GetLanguageListInternal(
92 const input_method::InputMethodDescriptors& descriptors, 107 const input_method::InputMethodDescriptors& descriptors,
93 const std::vector<std::string>& base_language_codes); 108 const std::vector<std::string>& base_language_codes,
109 bool insert_divider);
94 110
95 // OptionsPageUIHandler implementation. 111 // OptionsPageUIHandler implementation.
96 virtual void InitializePage() OVERRIDE; 112 virtual void InitializePage() OVERRIDE;
97 113
98 // True if the component extension list was appended into input method list. 114 // True if the component extension list was appended into input method list.
99 bool composition_extension_appended_; 115 bool composition_extension_appended_;
100 116
101 // True if this page was initialized. 117 // True if this page was initialized.
102 bool is_page_initialized_; 118 bool is_page_initialized_;
103 119
104 DISALLOW_COPY_AND_ASSIGN(CrosLanguageOptionsHandler); 120 DISALLOW_COPY_AND_ASSIGN(CrosLanguageOptionsHandler);
105 }; 121 };
106 122
107 } // namespace options 123 } // namespace options
108 } // namespace chromeos 124 } // namespace chromeos
109 125
110 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLE R_H_ 126 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLE R_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698