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

Side by Side Diff: chrome/browser/chromeos/input_method/input_method_util.cc

Issue 3132023: Add language_prefs namespace to language_preferences.h. (Closed)
Patch Set: address comments Created 10 years, 4 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/chromeos/input_method/input_method_util.h" 5 #include "chrome/browser/chromeos/input_method/input_method_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 } 553 }
554 return result; 554 return result;
555 } 555 }
556 556
557 void EnableInputMethods(const std::string& language_code, InputMethodType type, 557 void EnableInputMethods(const std::string& language_code, InputMethodType type,
558 const std::string& initial_input_method_id) { 558 const std::string& initial_input_method_id) {
559 std::vector<std::string> input_method_ids; 559 std::vector<std::string> input_method_ids;
560 GetInputMethodIdsFromLanguageCode(language_code, type, &input_method_ids); 560 GetInputMethodIdsFromLanguageCode(language_code, type, &input_method_ids);
561 561
562 if (std::count(input_method_ids.begin(), input_method_ids.end(), 562 if (std::count(input_method_ids.begin(), input_method_ids.end(),
563 kHardwareKeyboardLayout) == 0) { 563 language_prefs::kHardwareKeyboardLayout) == 0) {
564 input_method_ids.push_back(kHardwareKeyboardLayout); 564 input_method_ids.push_back(language_prefs::kHardwareKeyboardLayout);
565 } 565 }
566 // First, sort the vector by input method id, then by its display name. 566 // First, sort the vector by input method id, then by its display name.
567 std::sort(input_method_ids.begin(), input_method_ids.end()); 567 std::sort(input_method_ids.begin(), input_method_ids.end());
568 SortInputMethodIdsByNames(&input_method_ids); 568 SortInputMethodIdsByNames(&input_method_ids);
569 569
570 // Update ibus-daemon setting. 570 // Update ibus-daemon setting.
571 ImeConfigValue value; 571 ImeConfigValue value;
572 value.type = ImeConfigValue::kValueTypeStringList; 572 value.type = ImeConfigValue::kValueTypeStringList;
573 value.string_list_value = input_method_ids; 573 value.string_list_value = input_method_ids;
574 InputMethodLibrary* library = CrosLibrary::Get()->GetInputMethodLibrary(); 574 InputMethodLibrary* library = CrosLibrary::Get()->GetInputMethodLibrary();
575 library->SetImeConfig(kGeneralSectionName, kPreloadEnginesConfigName, value); 575 library->SetImeConfig(language_prefs::kGeneralSectionName,
576 language_prefs::kPreloadEnginesConfigName, value);
576 if (!initial_input_method_id.empty()) { 577 if (!initial_input_method_id.empty()) {
577 library->ChangeInputMethod(initial_input_method_id); 578 library->ChangeInputMethod(initial_input_method_id);
578 } 579 }
579 } 580 }
580 581
581 } // namespace input_method 582 } // namespace input_method
582 } // namespace chromeos 583 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/dom_ui/system_options_handler.cc ('k') | chrome/browser/chromeos/language_preferences.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698