OLD | NEW |
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/string_util.h" | 7 #include "base/strings/string_util.h" |
8 | 8 |
9 namespace chromeos { | 9 namespace chromeos { |
10 namespace { | 10 namespace { |
11 const char* kExtensionIMEPrefix = "_ext_ime_"; | 11 const char* kExtensionIMEPrefix = "_ext_ime_"; |
12 } // namespace | 12 } // namespace |
13 | 13 |
14 namespace extension_ime_util { | 14 namespace extension_ime_util { |
15 std::string GetInputMethodID(const std::string& extension_id, | 15 std::string GetInputMethodID(const std::string& extension_id, |
16 const std::string& engine_id) { | 16 const std::string& engine_id) { |
17 DCHECK(!extension_id.empty()); | 17 DCHECK(!extension_id.empty()); |
18 DCHECK(!engine_id.empty()); | 18 DCHECK(!engine_id.empty()); |
19 return kExtensionIMEPrefix + extension_id + engine_id; | 19 return kExtensionIMEPrefix + extension_id + engine_id; |
20 } | 20 } |
21 | 21 |
22 bool IsExtensionIME(const std::string& input_method_id) { | 22 bool IsExtensionIME(const std::string& input_method_id) { |
23 return StartsWithASCII(input_method_id, | 23 return StartsWithASCII(input_method_id, |
24 kExtensionIMEPrefix, | 24 kExtensionIMEPrefix, |
25 true); // Case sensitive. | 25 true); // Case sensitive. |
26 } | 26 } |
27 | 27 |
28 bool IsMemberOfExtension(const std::string& input_method_id, | 28 bool IsMemberOfExtension(const std::string& input_method_id, |
29 const std::string& extension_id) { | 29 const std::string& extension_id) { |
30 return StartsWithASCII(input_method_id, | 30 return StartsWithASCII(input_method_id, |
31 kExtensionIMEPrefix + extension_id, | 31 kExtensionIMEPrefix + extension_id, |
32 true); // Case sensitive. | 32 true); // Case sensitive. |
33 } | 33 } |
34 | 34 |
35 } // namespace extension_ime_util | 35 } // namespace extension_ime_util |
36 } // namespace chromeos | 36 } // namespace chromeos |
OLD | NEW |