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

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

Issue 177093002: [IME] Loads chromeos-xkb extension and add the extension based xkb keyboards in the chrome://settin… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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 | Annotate | Revision Log
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/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 <functional> 8 #include <functional>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 bool InputMethodUtil::IsValidInputMethodId( 334 bool InputMethodUtil::IsValidInputMethodId(
335 const std::string& input_method_id) const { 335 const std::string& input_method_id) const {
336 // We can't check the component extension is whilelisted or not here because 336 // We can't check the component extension is whilelisted or not here because
337 // it might not be initialized. 337 // it might not be initialized.
338 return GetInputMethodDescriptorFromId(input_method_id) != NULL || 338 return GetInputMethodDescriptorFromId(input_method_id) != NULL ||
339 extension_ime_util::IsComponentExtensionIME(input_method_id); 339 extension_ime_util::IsComponentExtensionIME(input_method_id);
340 } 340 }
341 341
342 // static 342 // static
343 bool InputMethodUtil::IsKeyboardLayout(const std::string& input_method_id) { 343 bool InputMethodUtil::IsKeyboardLayout(const std::string& input_method_id) {
344 const bool kCaseInsensitive = false; 344 return StartsWithASCII(input_method_id, "xkb:", false) ||
345 return StartsWithASCII(input_method_id, "xkb:", kCaseInsensitive); 345 extension_ime_util::IsKeyboardLayoutExtension(input_method_id);
346 } 346 }
347 347
348 std::string InputMethodUtil::GetLanguageCodeFromInputMethodId( 348 std::string InputMethodUtil::GetLanguageCodeFromInputMethodId(
349 const std::string& input_method_id) const { 349 const std::string& input_method_id) const {
350 // The code should be compatible with one of codes used for UI languages, 350 // The code should be compatible with one of codes used for UI languages,
351 // defined in app/l10_util.cc. 351 // defined in app/l10_util.cc.
352 const char kDefaultLanguageCode[] = "en-US"; 352 const char kDefaultLanguageCode[] = "en-US";
353 std::map<std::string, std::string>::const_iterator iter 353 std::map<std::string, std::string>::const_iterator iter
354 = id_to_language_code_.find(input_method_id); 354 = id_to_language_code_.find(input_method_id);
355 return (iter == id_to_language_code_.end()) ? 355 return (iter == id_to_language_code_.end()) ?
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 if (IsKeyboardLayout(input_method.id())) { 721 if (IsKeyboardLayout(input_method.id())) {
722 xkb_id_to_descriptor_.insert( 722 xkb_id_to_descriptor_.insert(
723 std::make_pair(input_method.GetPreferredKeyboardLayout(), 723 std::make_pair(input_method.GetPreferredKeyboardLayout(),
724 input_method)); 724 input_method));
725 } 725 }
726 } 726 }
727 } 727 }
728 728
729 } // namespace input_method 729 } // namespace input_method
730 } // namespace chromeos 730 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698