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

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: After-review. 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 kVendorOtherLanguagesListDivider[];
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 kVendorOtherLanguagesListDivider is
66 // used as a divider to separate "most relevant" languages against other.
56 static base::ListValue* GetUILanguageList( 67 static base::ListValue* GetUILanguageList(
57 const input_method::InputMethodDescriptors& descriptors); 68 const input_method::InputMethodDescriptors& descriptors);
58 69
59 // Converts input method descriptors to the list of input methods. 70 // Converts input method descriptors to the list of input methods.
60 // The return value will look like: 71 // The return value will look like:
61 // [{'id': '_ext_ime_nejguenhnsnjnwychcnsdsdjketest', 72 // [{'id': '_ext_ime_nejguenhnsnjnwychcnsdsdjketest',
62 // 'displayName': 'Sample IME'}, ...] 73 // 'displayName': 'Sample IME'}, ...]
63 static base::ListValue* ConvertInputMethodDescriptosToIMEList( 74 static base::ListValue* ConvertInputMethodDescriptosToIMEList(
64 const input_method::InputMethodDescriptors& descriptors); 75 const input_method::InputMethodDescriptors& descriptors);
65 76
(...skipping 15 matching lines...) Expand all
81 92
82 // Called when the input method options page is opened. 93 // Called when the input method options page is opened.
83 // |args| will contain the input method ID as string (ex. "mozc"). 94 // |args| will contain the input method ID as string (ex. "mozc").
84 void InputMethodOptionsOpenCallback(const base::ListValue* args); 95 void InputMethodOptionsOpenCallback(const base::ListValue* args);
85 96
86 // ComponentExtensionIMEManager::Observer override. 97 // ComponentExtensionIMEManager::Observer override.
87 virtual void OnInitialized() OVERRIDE; 98 virtual void OnInitialized() OVERRIDE;
88 99
89 // Gets the list of languages with |descriptors| based on 100 // Gets the list of languages with |descriptors| based on
90 // |base_language_codes|. 101 // |base_language_codes|.
102 // |insert_divider| means to insert entry with "code" attribute set to
103 // kVendorOtherLanguagesListDivider between "most relevant" languages and
104 // other.
91 static base::ListValue* GetLanguageListInternal( 105 static base::ListValue* GetLanguageListInternal(
92 const input_method::InputMethodDescriptors& descriptors, 106 const input_method::InputMethodDescriptors& descriptors,
93 const std::vector<std::string>& base_language_codes); 107 const std::vector<std::string>& base_language_codes,
108 bool insert_divider);
94 109
95 // OptionsPageUIHandler implementation. 110 // OptionsPageUIHandler implementation.
96 virtual void InitializePage() OVERRIDE; 111 virtual void InitializePage() OVERRIDE;
97 112
98 // True if the component extension list was appended into input method list. 113 // True if the component extension list was appended into input method list.
99 bool composition_extension_appended_; 114 bool composition_extension_appended_;
100 115
101 // True if this page was initialized. 116 // True if this page was initialized.
102 bool is_page_initialized_; 117 bool is_page_initialized_;
103 118
104 DISALLOW_COPY_AND_ASSIGN(CrosLanguageOptionsHandler); 119 DISALLOW_COPY_AND_ASSIGN(CrosLanguageOptionsHandler);
105 }; 120 };
106 121
107 } // namespace options 122 } // namespace options
108 } // namespace chromeos 123 } // namespace chromeos
109 124
110 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLE R_H_ 125 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_CHROMEOS_CROS_LANGUAGE_OPTIONS_HANDLE R_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698