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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc

Issue 148093003: xkb:us::eng is now always in list of available input methods at OOBE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix error: declaration requires an exit-time destructor. 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/ui/webui/chromeos/login/network_screen_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/login/network_screen_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 18 matching lines...) Expand all
29 namespace { 29 namespace {
30 30
31 const char kJsScreenPath[] = "login.NetworkScreen"; 31 const char kJsScreenPath[] = "login.NetworkScreen";
32 32
33 // JS API callbacks names. 33 // JS API callbacks names.
34 const char kJsApiNetworkOnExit[] = "networkOnExit"; 34 const char kJsApiNetworkOnExit[] = "networkOnExit";
35 const char kJsApiNetworkOnLanguageChanged[] = "networkOnLanguageChanged"; 35 const char kJsApiNetworkOnLanguageChanged[] = "networkOnLanguageChanged";
36 const char kJsApiNetworkOnInputMethodChanged[] = "networkOnInputMethodChanged"; 36 const char kJsApiNetworkOnInputMethodChanged[] = "networkOnInputMethodChanged";
37 const char kJsApiNetworkOnTimezoneChanged[] = "networkOnTimezoneChanged"; 37 const char kJsApiNetworkOnTimezoneChanged[] = "networkOnTimezoneChanged";
38 38
39 const char kUSlayout[] = "xkb:us::eng";
40
39 } // namespace 41 } // namespace
40 42
41 namespace chromeos { 43 namespace chromeos {
42 44
43 // NetworkScreenHandler, public: ----------------------------------------------- 45 // NetworkScreenHandler, public: -----------------------------------------------
44 46
45 NetworkScreenHandler::NetworkScreenHandler(CoreOobeActor* core_oobe_actor) 47 NetworkScreenHandler::NetworkScreenHandler(CoreOobeActor* core_oobe_actor)
46 : BaseScreenHandler(kJsScreenPath), 48 : BaseScreenHandler(kJsScreenPath),
47 screen_(NULL), 49 screen_(NULL),
48 core_oobe_actor_(core_oobe_actor), 50 core_oobe_actor_(core_oobe_actor),
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 269
268 // static 270 // static
269 base::ListValue* NetworkScreenHandler::GetInputMethods() { 271 base::ListValue* NetworkScreenHandler::GetInputMethods() {
270 base::ListValue* input_methods_list = new base::ListValue; 272 base::ListValue* input_methods_list = new base::ListValue;
271 input_method::InputMethodManager* manager = 273 input_method::InputMethodManager* manager =
272 input_method::InputMethodManager::Get(); 274 input_method::InputMethodManager::Get();
273 input_method::InputMethodUtil* util = manager->GetInputMethodUtil(); 275 input_method::InputMethodUtil* util = manager->GetInputMethodUtil();
274 scoped_ptr<input_method::InputMethodDescriptors> input_methods( 276 scoped_ptr<input_method::InputMethodDescriptors> input_methods(
275 manager->GetActiveInputMethods()); 277 manager->GetActiveInputMethods());
276 std::string current_input_method_id = manager->GetCurrentInputMethod().id(); 278 std::string current_input_method_id = manager->GetCurrentInputMethod().id();
279 bool default_us_layout_added = false;
277 for (size_t i = 0; i < input_methods->size(); ++i) { 280 for (size_t i = 0; i < input_methods->size(); ++i) {
278 const std::string ime_id = input_methods->at(i).id(); 281 const std::string ime_id = input_methods->at(i).id();
282
283 if (ime_id == kUSlayout)
284 default_us_layout_added = true;
285
279 base::DictionaryValue* input_method = new base::DictionaryValue; 286 base::DictionaryValue* input_method = new base::DictionaryValue;
280 input_method->SetString("value", ime_id); 287 input_method->SetString("value", ime_id);
281 input_method->SetString( 288 input_method->SetString(
282 "title", 289 "title",
283 util->GetInputMethodLongName(input_methods->at(i))); 290 util->GetInputMethodLongName(input_methods->at(i)));
284 input_method->SetBoolean("selected", 291 input_method->SetBoolean("selected",
285 ime_id == current_input_method_id); 292 ime_id == current_input_method_id);
286 input_methods_list->Append(input_method); 293 input_methods_list->Append(input_method);
287 } 294 }
295 // "xkb:us::eng" should always be in the list of available layouts.
296 if (!default_us_layout_added) {
297 const input_method::InputMethodDescriptor* us_eng_descriptor =
298 util->GetInputMethodDescriptorFromId(kUSlayout);
299 DCHECK(us_eng_descriptor != NULL);
300 base::DictionaryValue* input_method = new base::DictionaryValue;
301 input_method->SetString("value", kUSlayout);
302 input_method->SetString("title",
303 util->GetInputMethodLongName(*us_eng_descriptor));
304 input_methods_list->Append(input_method);
305 }
288 return input_methods_list; 306 return input_methods_list;
289 } 307 }
290 308
291 // static 309 // static
292 base::ListValue* NetworkScreenHandler::GetTimezoneList() { 310 base::ListValue* NetworkScreenHandler::GetTimezoneList() {
293 std::string current_timezone_id; 311 std::string current_timezone_id;
294 CrosSettings::Get()->GetString(kSystemTimezone, &current_timezone_id); 312 CrosSettings::Get()->GetString(kSystemTimezone, &current_timezone_id);
295 313
296 scoped_ptr<base::ListValue> timezone_list(new base::ListValue); 314 scoped_ptr<base::ListValue> timezone_list(new base::ListValue);
297 scoped_ptr<base::ListValue> timezones = system::GetTimezoneList().Pass(); 315 scoped_ptr<base::ListValue> timezones = system::GetTimezoneList().Pass();
(...skipping 12 matching lines...) Expand all
310 timezone_option->SetString("value", timezone_id); 328 timezone_option->SetString("value", timezone_id);
311 timezone_option->SetString("title", timezone_name); 329 timezone_option->SetString("title", timezone_name);
312 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id); 330 timezone_option->SetBoolean("selected", timezone_id == current_timezone_id);
313 timezone_list->Append(timezone_option.release()); 331 timezone_list->Append(timezone_option.release());
314 } 332 }
315 333
316 return timezone_list.release(); 334 return timezone_list.release();
317 } 335 }
318 336
319 } // namespace chromeos 337 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698