Add mozc migration interface to chromium
See design in go/e14s-jp-sys-pk-v2 Defaults should match https://crsrc.org/c/chrome/browser/resources/settings/chromeos/os_languages_page/input_method_util.js;drc=6c88edbfe6096489ccac66b3ef5c84d479892181;l=146-157 Change-Id: I616570032af92cebf23f9e760bcb8b65dfa3846c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4022412 Commit-Queue: Keith Lee <keithlee@chromium.org> Reviewed-by: Sam McNally <sammc@chromium.org> Cr-Commit-Position: refs/heads/main@{#1071439}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
bc0dae6f70
commit
2a59a8aaf0
chrome/browser/ash/input_method
chromeos/ash/services/ime
@ -14,6 +14,7 @@
|
||||
#include "chrome/test/base/testing_profile.h"
|
||||
#include "chromeos/ash/services/ime/public/mojom/input_engine.mojom.h"
|
||||
#include "chromeos/ash/services/ime/public/mojom/input_method.mojom.h"
|
||||
#include "chromeos/ash/services/ime/public/mojom/japanese_settings.mojom.h"
|
||||
#include "chromeos/services/machine_learning/public/cpp/fake_service_connection.h"
|
||||
#include "components/ukm/content/source_url_recorder.h"
|
||||
#include "components/ukm/test_ukm_recorder.h"
|
||||
@ -164,6 +165,11 @@ class FakeConnectionFactory : public ime::mojom::ConnectionFactory {
|
||||
std::move(callback).Run(/*bound=*/true);
|
||||
}
|
||||
|
||||
void ConnectToMozc(mojo::PendingAssociatedReceiver<ime::mojom::Mozc> mozc,
|
||||
ConnectToMozcCallback callback) override {
|
||||
std::move(callback).Run(false);
|
||||
}
|
||||
|
||||
void Bind(mojo::PendingReceiver<ime::mojom::ConnectionFactory> receiver) {
|
||||
connection_factory_.Bind(std::move(receiver));
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "chromeos/ash/services/ime/public/mojom/input_engine.mojom.h"
|
||||
#include "chromeos/ash/services/ime/public/mojom/input_method.mojom.h"
|
||||
#include "chromeos/ash/services/ime/public/mojom/input_method_host.mojom.h"
|
||||
#include "chromeos/ash/services/ime/public/mojom/japanese_settings.mojom.h"
|
||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||
#include "mojo/public/cpp/bindings/pending_remote.h"
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
@ -74,6 +75,11 @@ class TestDecoderState : public mojom::ConnectionFactory {
|
||||
std::move(callback).Run(/*bound=*/false);
|
||||
}
|
||||
|
||||
void ConnectToMozc(mojo::PendingAssociatedReceiver<ime::mojom::Mozc> mozc,
|
||||
ConnectToMozcCallback callback) override {
|
||||
std::move(callback).Run(/*bound=*/false);
|
||||
}
|
||||
|
||||
private:
|
||||
mojo::Receiver<ime::mojom::ConnectionFactory> connection_factory_{this};
|
||||
};
|
||||
|
@ -14,6 +14,7 @@ mojom("mojom") {
|
||||
"input_engine.mojom",
|
||||
"input_method.mojom",
|
||||
"input_method_host.mojom",
|
||||
"japanese_settings.mojom",
|
||||
]
|
||||
|
||||
public_deps = [
|
||||
|
@ -6,12 +6,13 @@
|
||||
// the Chromium repo. This file should be updated first, before syncing in the
|
||||
// other repos.
|
||||
|
||||
// Next MinVersion: 2
|
||||
// Next MinVersion: 4
|
||||
|
||||
module ash.ime.mojom;
|
||||
|
||||
import "chromeos/ash/services/ime/public/mojom/input_method.mojom";
|
||||
import "chromeos/ash/services/ime/public/mojom/input_method_host.mojom";
|
||||
import "chromeos/ash/services/ime/public/mojom/japanese_settings.mojom";
|
||||
|
||||
// Responsible for instantiating the connection between the shared library
|
||||
// and Chromium over an associated Mojo pipe.
|
||||
@ -32,4 +33,11 @@ interface ConnectionFactory {
|
||||
pending_associated_remote<InputMethodHost> input_method_host,
|
||||
[MinVersion=2] InputMethodSettings? settings)
|
||||
=> (bool success);
|
||||
// Sets up a connection to a mozc interface which allows access to
|
||||
// Mozc settings information.
|
||||
// The implementation of this will be located inside of the ImeShared lib.
|
||||
// Once the data has been migrated, we can deprecate / delete this interface.
|
||||
[MinVersion=3] ConnectToMozc@1(
|
||||
pending_associated_receiver<Mozc> mozc)
|
||||
=> (bool success);
|
||||
};
|
||||
|
@ -0,0 +1,99 @@
|
||||
// Copyright 2022 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Updates to this file must be backwards-compatible, as it is used outside of
|
||||
// the Chromium repo. This file should be updated first, before syncing in the
|
||||
// other repos.
|
||||
|
||||
// Next MinVersion: 2
|
||||
|
||||
module ash.ime.mojom;
|
||||
|
||||
// The following enums refer to the config options used for the
|
||||
// Japanese decoder Mozc.
|
||||
// More information about this interface is documented publicly at
|
||||
// https://github.com/google/mozc/blob/master/src/protocol/config.proto
|
||||
|
||||
[Stable, Extensible]
|
||||
enum InputMode {
|
||||
[Default] ROMAJI = 0,
|
||||
KANA = 1
|
||||
};
|
||||
|
||||
[Stable, Extensible]
|
||||
enum PunctuationStyle {
|
||||
[Default] KUTEN_TOUTEN = 0,
|
||||
COMMA_PERIOD = 1,
|
||||
KUTEN_PERIOD = 2,
|
||||
COMMA_TOUTEN = 3
|
||||
};
|
||||
|
||||
[Stable, Extensible]
|
||||
enum SymbolStyle {
|
||||
[Default] CORNER_BRACKET_MIDDLE_DOT = 0,
|
||||
SQUARE_BRACKET_SLASH = 1,
|
||||
CORNER_BRACKET_SLASH = 2,
|
||||
SQUARE_BRACKET_MIDDLE_DOT = 3
|
||||
};
|
||||
|
||||
[Stable, Extensible]
|
||||
enum SpaceInputStyle {
|
||||
[Default] INPUT_MODE = 0,
|
||||
FULLWIDTH = 1,
|
||||
HALFWIDTH = 2
|
||||
};
|
||||
|
||||
[Stable, Extensible]
|
||||
enum SelectionShortcut {
|
||||
NO_SHORTCUT = 0,
|
||||
[Default] DIGITS_123456789 = 1,
|
||||
ASDFGHJKL = 2
|
||||
};
|
||||
|
||||
[Stable, Extensible]
|
||||
enum KeymapStyle {
|
||||
[Default] CUSTOM = 0,
|
||||
ATOK = 1,
|
||||
MS_IME = 2,
|
||||
KOTOERI = 3,
|
||||
MOBILE = 4,
|
||||
CHROME_OS = 5
|
||||
};
|
||||
|
||||
[Stable, Extensible]
|
||||
enum ShiftKeyModeSwitch {
|
||||
OFF = 0,
|
||||
[Default] ALPHANUMERIC = 1,
|
||||
KATAKANA = 2,
|
||||
};
|
||||
|
||||
[Stable]
|
||||
struct MozcConfig {
|
||||
InputMode input_mode;
|
||||
PunctuationStyle punctuation_style;
|
||||
SymbolStyle symbol_style;
|
||||
SpaceInputStyle space_input_style;
|
||||
SelectionShortcut selection_shortcut;
|
||||
KeymapStyle keymap_style;
|
||||
bool automatically_switch_to_halfwidth;
|
||||
ShiftKeyModeSwitch shift_key_mode_switch;
|
||||
bool use_input_history;
|
||||
bool use_system_dictionary;
|
||||
int64 number_of_suggestions;
|
||||
bool disable_personalized_suggestions;
|
||||
bool send_statistics_to_google;
|
||||
};
|
||||
|
||||
// Mozc is the interface used for communicating with the Mozc decoder for
|
||||
// Japanese input, which is hosted inside of ImeService.
|
||||
// It is just going to allow access to the user's settings and user dictionary
|
||||
// for migrating the code to settings.
|
||||
// Once the settings migration is done, this interface can be deleted.
|
||||
[Stable]
|
||||
interface Mozc {
|
||||
// Retrieve the config used for Mozc which is stored as a file internally.
|
||||
// If this file does not exist, this should just return the default config.
|
||||
FetchMozcConfig@0() => (MozcConfig config);
|
||||
};
|
||||
|
@ -29,6 +29,15 @@ void RuleBasedEngineConnectionFactory::ConnectToInputMethod(
|
||||
std::move(callback).Run(/*bound=*/true);
|
||||
}
|
||||
|
||||
void RuleBasedEngineConnectionFactory::ConnectToMozc(
|
||||
mojo::PendingAssociatedReceiver<mojom::Mozc> pending_reciever,
|
||||
ConnectToMozcCallback callback) {
|
||||
// Connecting to the Mozc engine with the Rulebased connection
|
||||
// engine is not supported.
|
||||
NOTIMPLEMENTED_LOG_ONCE();
|
||||
std::move(callback).Run(false);
|
||||
}
|
||||
|
||||
bool RuleBasedEngineConnectionFactory::IsConnected() {
|
||||
return rule_based_engine_ && rule_based_engine_->IsConnected();
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "chromeos/ash/services/ime/public/mojom/connection_factory.mojom.h"
|
||||
#include "chromeos/ash/services/ime/public/mojom/input_method.mojom.h"
|
||||
#include "chromeos/ash/services/ime/public/mojom/input_method_host.mojom.h"
|
||||
#include "chromeos/ash/services/ime/public/mojom/japanese_settings.mojom.h"
|
||||
#include "chromeos/ash/services/ime/rule_based_engine.h"
|
||||
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
|
||||
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
|
||||
@ -37,6 +38,8 @@ class RuleBasedEngineConnectionFactory : public mojom::ConnectionFactory {
|
||||
pending_input_method_host,
|
||||
mojom::InputMethodSettingsPtr settings,
|
||||
ConnectToInputMethodCallback callback) override;
|
||||
void ConnectToMozc(mojo::PendingAssociatedReceiver<mojom::Mozc> pending_mozc,
|
||||
ConnectToMozcCallback callback) override;
|
||||
|
||||
// Is the current connection factory connected to a rule based engine?
|
||||
bool IsConnected();
|
||||
|
Reference in New Issue
Block a user