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