ml: Add mojo API of TextClassifier/Annotator.

This CL implements the mojo API of text classifier.

BUG=chromium:1020419
TEST=pass the existing unit tests.
TEST=on device (eve), 1+2=3 works.
TEST=on device (eve), Annotate() and SuggestSelection() work.

Change-Id: Iadfe5747f3b2d1f8c8a8d9f0b975e2e8cda50726
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/1951350
Tested-by: Honglin Yu <honglinyu@chromium.org>
Commit-Queue: Honglin Yu <honglinyu@chromium.org>
Reviewed-by: Sam McNally <sammc@chromium.org>
Reviewed-by: Andrew Moylan <amoylan@chromium.org>
diff --git a/ml/machine_learning_service_impl.h b/ml/machine_learning_service_impl.h
index b3d2cb5..759c776 100644
--- a/ml/machine_learning_service_impl.h
+++ b/ml/machine_learning_service_impl.h
@@ -27,6 +27,10 @@
   MachineLearningServiceImpl(mojo::ScopedMessagePipeHandle pipe,
                              base::Closure connection_error_handler);
 
+  // A interface to change |text_classifier_model_filename_| for testing. Should
+  // not be used outside of tests.
+  void SetTextClassifierModelFilenameForTesting(const std::string& filename);
+
  protected:
   // Testing constructor that allows overriding of the model dir. Should not be
   // used outside of tests.
@@ -47,6 +51,19 @@
       chromeos::machine_learning::mojom::ModelRequest request,
       LoadFlatBufferModelCallback callback) override;
 
+  // chromeos::machine_learning::mojom::MachineLearningService:
+  void LoadTextClassifier(
+      chromeos::machine_learning::mojom::TextClassifierRequest request,
+      LoadTextClassifierCallback callback) override;
+
+  // Init the icu data if it is not initialized yet.
+  void InitIcuIfNeeded();
+
+  // Used to hold the icu data read from file.
+  char* icu_data_;
+
+  std::string text_classifier_model_filename_;
+
   // Metadata required to load builtin models. Initialized at construction.
   const std::map<chromeos::machine_learning::mojom::BuiltinModelId,
                  BuiltinModelMetadata>