blob: 86b32cc7f590efa0fa79c8df37ef076505d7ee98 [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/scoped_native_library.h"
#include "chromeos/services/ime/input_engine.h"
#include "chromeos/services/ime/public/mojom/input_engine.mojom.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "services/service_manager/public/cpp/connector.h"
namespace chromeos {
namespace ime {
// TODO( Introduce a DecoderAPILibrary class/struct.
// Inside, we define the shared function pointer types which are implemented
// in the decoder shared library.
// An enhanced implementation of the basic InputEngine which allows the input
// engine to call a customized transliteration library (aka decoder) to provide
// a premium typing experience.
class DecoderEngine : public InputEngine {
DecoderEngine(service_manager::Connector* connector,
scoped_refptr<base::SequencedTaskRunner> task_runner);
~DecoderEngine() override;
// InputEngine overrides:
bool BindRequest(const std::string& ime_spec,
mojom::InputChannelRequest request,
mojom::InputChannelPtr client,
const std::vector<uint8_t>& extra) override;
bool IsImeSupported(const std::string& ime_spec) override;
void ProcessMessage(const std::vector<uint8_t>& message,
ProcessMessageCallback callback) override;
// Shared library handle of the implementation for input logic with decoders.
base::ScopedNativeLibrary library_;
mojo::BindingSet<mojom::InputChannel> channel_bindings_;
} // namespace ime
} // namespace chromeos