Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Unified Diff: third_party/liblouis/nacl_wrapper/liblouis_instance.cc

Issue 2954413003: Support rich line output in both speech and braille (Closed)
Patch Set: Fix browser test Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/liblouis/nacl_wrapper/liblouis_instance.cc
diff --git a/third_party/liblouis/nacl_wrapper/liblouis_instance.cc b/third_party/liblouis/nacl_wrapper/liblouis_instance.cc
index c771bc90c62eea2f95737f4fb1467aafbc5605bf..3f9541b57f5f27ba3df4b0a66e0b141c724d3e12 100644
--- a/third_party/liblouis/nacl_wrapper/liblouis_instance.cc
+++ b/third_party/liblouis/nacl_wrapper/liblouis_instance.cc
@@ -109,6 +109,7 @@ static const char kErrorKey[] = "error";
static const char kTableNamesKey[] = "table_names";
static const char kSuccessKey[] = "success";
static const char kTextKey[] = "text";
+static const char kFormTypeMapKey[] = "form_type_map";
static const char kCellsKey[] = "cells";
static const char kCursorPositionKey[] = "cursor_position";
static const char kTextToBrailleKey[] = "text_to_braille";
@@ -237,6 +238,7 @@ void LibLouisInstance::HandleTranslate(const Json::Value& message,
Json::Value table_names = message[kTableNamesKey];
Json::Value text = message[kTextKey];
Json::Value cursor_position = message[kCursorPositionKey];
+ Json::Value form_type_map = message[kFormTypeMapKey];
if (!table_names.isString()) {
PostError("expected table_names to be a string", message_id);
return;
@@ -246,12 +248,23 @@ void LibLouisInstance::HandleTranslate(const Json::Value& message,
} else if (!cursor_position.isNull() && !cursor_position.isIntegral()) {
PostError("expected cursor_position to be null or integral", message_id);
return;
+ } else if (!form_type_map.isArray()) {
+ PostError("expected form_type_map to be an array", message_id);
+ return;
}
TranslationParams params;
params.table_names = table_names.asString();
params.text = text.asString();
params.cursor_position = cursor_position.isIntegral() ?
cursor_position.asInt() : -1;
+ for (size_t i = 0; i < form_type_map.size(); ++i) {
+ Json::Value val = form_type_map[i];
+ if (!val.isIntegral()) {
+ PostError("expected form_type_map to be an integral array", message_id);
+ return;
+ }
+ params.form_type_map.push_back(val.asInt());
+ }
PostWorkToBackground(cc_factory_.NewCallback(
&LibLouisInstance::TranslateInBackground,
params, message_id));
« no previous file with comments | « chrome/test/data/chromeos/liblouis_nacl/test.js ('k') | third_party/liblouis/nacl_wrapper/liblouis_wrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698