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

Side by Side Diff: chromeos/ime/extension_ime_util.cc

Issue 312023002: Sync starting language and input method preferences (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase and dzhioev's comments Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chromeos/ime/extension_ime_util.h" 5 #include "chromeos/ime/extension_ime_util.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 8
9 namespace chromeos { 9 namespace chromeos {
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return StartsWithASCII(input_method_id, 103 return StartsWithASCII(input_method_id,
104 kExtensionIMEPrefix + extension_id, 104 kExtensionIMEPrefix + extension_id,
105 true); // Case sensitive. 105 true); // Case sensitive.
106 } 106 }
107 107
108 bool IsKeyboardLayoutExtension(const std::string& input_method_id) { 108 bool IsKeyboardLayoutExtension(const std::string& input_method_id) {
109 std::string prefix = kComponentExtensionIMEPrefix; 109 std::string prefix = kComponentExtensionIMEPrefix;
110 return StartsWithASCII(input_method_id, prefix + kXkbExtensionId, true); 110 return StartsWithASCII(input_method_id, prefix + kXkbExtensionId, true);
111 } 111 }
112 112
113 std::string GetEngineIDByInputMethodID(const std::string& input_method_id) {
114 if (!IsComponentExtensionIME(input_method_id))
115 return input_method_id;
116 return input_method_id.substr(kComponentExtensionIMEPrefixLength +
117 kExtensionIdLength);
118 }
119
113 std::string MaybeGetLegacyXkbId(const std::string& input_method_id) { 120 std::string MaybeGetLegacyXkbId(const std::string& input_method_id) {
114 if (IsKeyboardLayoutExtension(input_method_id)) { 121 if (IsKeyboardLayoutExtension(input_method_id))
115 size_t pos = input_method_id.find("xkb:"); 122 return GetEngineIDByInputMethodID(input_method_id);
116 if (pos != std::string::npos)
117 return input_method_id.substr(pos);
118 }
119 return input_method_id; 123 return input_method_id;
120 } 124 }
121 125
122 } // namespace extension_ime_util 126 } // namespace extension_ime_util
123 } // namespace chromeos 127 } // namespace chromeos
OLDNEW
« chromeos/ime/extension_ime_util.h ('K') | « chromeos/ime/extension_ime_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698