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

Unified Diff: content/renderer/text_input_client_observer.cc

Issue 166903005: mac: Add support for asynchronous dictionary lookup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for dcheng and rebase. Created 6 years, 9 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
« no previous file with comments | « content/renderer/text_input_client_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/text_input_client_observer.cc
diff --git a/content/renderer/text_input_client_observer.cc b/content/renderer/text_input_client_observer.cc
index 5ce95ff6093742ac828679019e22a9cbee097912..0211454c96ab62375d370672eccb16224c51b2fa 100644
--- a/content/renderer/text_input_client_observer.cc
+++ b/content/renderer/text_input_client_observer.cc
@@ -29,6 +29,8 @@ TextInputClientObserver::~TextInputClientObserver() {
bool TextInputClientObserver::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(TextInputClientObserver, message)
+ IPC_MESSAGE_HANDLER(TextInputClientMsg_StringAtPoint,
+ OnStringAtPoint)
IPC_MESSAGE_HANDLER(TextInputClientMsg_CharacterIndexForPoint,
OnCharacterIndexForPoint)
IPC_MESSAGE_HANDLER(TextInputClientMsg_FirstRectForCharacterRange,
@@ -43,6 +45,21 @@ blink::WebView* TextInputClientObserver::webview() {
return render_view()->GetWebView();
}
+void TextInputClientObserver::OnStringAtPoint(gfx::Point point) {
+#if defined(OS_MACOSX)
+ blink::WebPoint baselinePoint;
+ NSAttributedString* string = blink::WebSubstringUtil::attributedWordAtPoint(
+ webview(), point, baselinePoint);
+
+ scoped_ptr<const mac::AttributedStringCoder::EncodedString> encoded(
+ mac::AttributedStringCoder::Encode(string));
+ Send(new TextInputClientReplyMsg_GotStringAtPoint(
+ routing_id(), *encoded.get(), baselinePoint));
+#else
+ NOTIMPLEMENTED();
+#endif
+}
+
void TextInputClientObserver::OnCharacterIndexForPoint(gfx::Point point) {
blink::WebPoint web_point(point);
size_t index = webview()->focusedFrame()->characterIndexForPoint(web_point);
« no previous file with comments | « content/renderer/text_input_client_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698