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

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

Issue 589133002: Make undefined Unicode characters show up in a nicer way in braille. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@moretables
Patch Set: Fix typo. Created 6 years, 3 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 e92b9a03ad9e9123e616403636f5fc8909040c8a..7346a0f3daa89c7f8f98aaf0fcc6bf52d9ee2311 100644
--- a/third_party/liblouis/nacl_wrapper/liblouis_instance.cc
+++ b/third_party/liblouis/nacl_wrapper/liblouis_instance.cc
@@ -104,7 +104,7 @@ static const char kCommandKey[] = "command";
static const char kMessageIdKey[] = "message_id";
static const char kInReplyToKey[] = "in_reply_to";
static const char kErrorKey[] = "error";
-static const char kTableNameKey[] = "table_name";
+static const char kTableNamesKey[] = "table_names";
static const char kSuccessKey[] = "success";
static const char kTextKey[] = "text";
static const char kCellsKey[] = "cells";
@@ -208,23 +208,23 @@ void LibLouisInstance::PostError(const std::string& error_message,
void LibLouisInstance::HandleCheckTable(const Json::Value& message,
const std::string& message_id) {
- Json::Value table_name = message[kTableNameKey];
- if (!table_name.isString()) {
- PostError("expected table_name to be a string", message_id);
+ Json::Value table_names = message[kTableNamesKey];
+ if (!table_names.isString()) {
+ PostError("expected table_names to be a string", message_id);
return;
}
PostWorkToBackground(cc_factory_.NewCallback(
&LibLouisInstance::CheckTableInBackground,
- table_name.asString(), message_id));
+ table_names.asString(), message_id));
}
void LibLouisInstance::CheckTableInBackground(int32_t result,
- const std::string& table_name, const std::string& message_id) {
+ const std::string& table_names, const std::string& message_id) {
if (result != PP_OK) {
PostError("failed to transfer call to background thread", message_id);
return;
}
- bool success = liblouis_.CheckTable(table_name);
+ bool success = liblouis_.CheckTable(table_names);
Json::Value reply(Json::objectValue);
reply[kSuccessKey] = success;
PostReply(reply, message_id);
@@ -232,11 +232,11 @@ void LibLouisInstance::CheckTableInBackground(int32_t result,
void LibLouisInstance::HandleTranslate(const Json::Value& message,
const std::string& message_id) {
- Json::Value table_name = message[kTableNameKey];
+ Json::Value table_names = message[kTableNamesKey];
Json::Value text = message[kTextKey];
Json::Value cursor_position = message[kCursorPositionKey];
- if (!table_name.isString()) {
- PostError("expected table_name to be a string", message_id);
+ if (!table_names.isString()) {
+ PostError("expected table_names to be a string", message_id);
return;
} else if (!text.isString()) {
PostError("expected text to be a string", message_id);
@@ -246,7 +246,7 @@ void LibLouisInstance::HandleTranslate(const Json::Value& message,
return;
}
TranslationParams params;
- params.table_name = table_name.asString();
+ params.table_names = table_names.asString();
params.text = text.asString();
params.cursor_position = cursor_position.isIntegral() ?
cursor_position.asInt() : -1;
@@ -284,10 +284,10 @@ void LibLouisInstance::TranslateInBackground(int32_t result,
void LibLouisInstance::HandleBackTranslate(const Json::Value& message,
const std::string& message_id) {
- Json::Value table_name = message[kTableNameKey];
+ Json::Value table_names = message[kTableNamesKey];
Json::Value cells = message[kCellsKey];
- if (!table_name.isString()) {
- PostError("expected table_name to be a string", message_id);
+ if (!table_names.isString()) {
+ PostError("expected table_names to be a string", message_id);
return;
} else if (!cells.isString()) {
PostError("expected cells to be a string", message_id);
@@ -300,18 +300,18 @@ void LibLouisInstance::HandleBackTranslate(const Json::Value& message,
}
PostWorkToBackground(cc_factory_.NewCallback(
&LibLouisInstance::BackTranslateInBackground,
- table_name.asString(), cells_vector, message_id));
+ table_names.asString(), cells_vector, message_id));
}
void LibLouisInstance::BackTranslateInBackground(int32_t result,
- const std::string& table_name, const std::vector<unsigned char>& cells,
+ const std::string& table_names, const std::vector<unsigned char>& cells,
const std::string& message_id) {
if (result != PP_OK) {
PostError("failed to transfer call to background thread", message_id);
return;
}
std::string text;
- bool success = liblouis_.BackTranslate(table_name, cells, &text);
+ bool success = liblouis_.BackTranslate(table_names, cells, &text);
Json::Value reply(Json::objectValue);
reply[kSuccessKey] = success;
if (success) {
« no previous file with comments | « third_party/liblouis/nacl_wrapper/liblouis_instance.h ('k') | third_party/liblouis/nacl_wrapper/liblouis_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698