diff options
Diffstat (limited to 'chrome/browser')
5 files changed, 12 insertions, 7 deletions
diff --git a/chrome/browser/chromeos/input_method/input_method_engine.cc b/chrome/browser/chromeos/input_method/input_method_engine.cc index de50387..2fb6196 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine.cc +++ b/chrome/browser/chromeos/input_method/input_method_engine.cc @@ -69,7 +69,7 @@ class InputMethodEngineImpl virtual bool SetComposition(int context_id, const char* text, int selection_start, - int selection_end, + int selection_end, int cursor, const std::vector<SegmentInfo>& segments, std::string* error); virtual bool ClearComposition(int context_id, @@ -190,6 +190,7 @@ bool InputMethodEngineImpl::SetComposition( const char* text, int selection_start, int selection_end, + int cursor, const std::vector<SegmentInfo>& segments, std::string* error) { if (!active_) { @@ -201,7 +202,7 @@ bool InputMethodEngineImpl::SetComposition( return false; } - connection_->SetPreeditText(text, selection_end); + connection_->SetPreeditText(text, cursor); // TODO: Add support for displaying selected text in the composition string. for (std::vector<SegmentInfo>::const_iterator segment = segments.begin(); segment != segments.end(); ++segment) { @@ -545,7 +546,7 @@ class InputMethodEngineStub : public InputMethodEngine { virtual bool SetComposition(int context_id, const char* text, int selection_start, - int selection_end, + int selection_end, int cursor, const std::vector<SegmentInfo>& segments, std::string* error) { VLOG(0) << "SetComposition"; diff --git a/chrome/browser/chromeos/input_method/input_method_engine.h b/chrome/browser/chromeos/input_method/input_method_engine.h index 2e5fcb9..071191d 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine.h +++ b/chrome/browser/chromeos/input_method/input_method_engine.h @@ -141,6 +141,7 @@ class InputMethodEngine { const char* text, int selection_start, int selection_end, + int cursor, const std::vector<SegmentInfo>& segments, std::string* error) = 0; diff --git a/chrome/browser/extensions/extension_input_ime_api.cc b/chrome/browser/extensions/extension_input_ime_api.cc index febef50..67a75de 100644 --- a/chrome/browser/extensions/extension_input_ime_api.cc +++ b/chrome/browser/extensions/extension_input_ime_api.cc @@ -508,26 +508,27 @@ bool SetCompositionFunction::RunImpl() { std::string text; int selection_start; int selection_end; + int cursor; std::vector<chromeos::InputMethodEngine::SegmentInfo> segments; EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kContextIdKey, &context_id)); EXTENSION_FUNCTION_VALIDATE(args->GetString(keys::kTextKey, &text)); + EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kCursorKey, &cursor)); if (args->HasKey(keys::kSelectionStartKey)) { EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kSelectionStartKey, &selection_start)); } else { - selection_start = 0; + selection_start = cursor; } if (args->HasKey(keys::kSelectionEndKey)) { EXTENSION_FUNCTION_VALIDATE(args->GetInteger(keys::kSelectionEndKey, &selection_end)); } else { - selection_end = 0; + selection_end = cursor; } if (args->HasKey(keys::kSegmentsKey)) { - // TODO: Handle segments ListValue* segment_list; EXTENSION_FUNCTION_VALIDATE(args->GetList(keys::kSegmentsKey, &segment_list)); @@ -553,7 +554,7 @@ bool SetCompositionFunction::RunImpl() { } if (engine->SetComposition(context_id, text.c_str(), selection_start, - selection_end, segments, &error_)) { + selection_end, cursor, segments, &error_)) { result_.reset(Value::CreateBooleanValue(true)); } else { result_.reset(Value::CreateBooleanValue(false)); diff --git a/chrome/browser/extensions/extension_input_module_constants.cc b/chrome/browser/extensions/extension_input_module_constants.cc index c6bbbf8..88dc206 100644 --- a/chrome/browser/extensions/extension_input_module_constants.cc +++ b/chrome/browser/extensions/extension_input_module_constants.cc @@ -16,6 +16,7 @@ const char kCandidatesKey[] = "candidates"; const char kCheckedKey[] = "checked"; const char kContextIdKey[] = "contextID"; const char kCtrlKeyKey[] = "ctrlKey"; +const char kCursorKey[] = "cursor"; const char kCursorVisibleKey[] = "cursorVisible"; const char kEnabledKey[] = "enabled"; const char kEndKey[] = "end"; diff --git a/chrome/browser/extensions/extension_input_module_constants.h b/chrome/browser/extensions/extension_input_module_constants.h index 9cf8a1b..de2fae3 100644 --- a/chrome/browser/extensions/extension_input_module_constants.h +++ b/chrome/browser/extensions/extension_input_module_constants.h @@ -21,6 +21,7 @@ extern const char kCandidatesKey[]; extern const char kCheckedKey[]; extern const char kContextIdKey[]; extern const char kCtrlKeyKey[]; +extern const char kCursorKey[]; extern const char kCursorVisibleKey[]; extern const char kEnabledKey[]; extern const char kEndKey[]; |