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

Unified Diff: content/browser/renderer_host/text_input_client_message_filter.mm

Issue 166903005: mac: Add support for asynchronous dictionary lookup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use ScopedBlock. 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
Index: content/browser/renderer_host/text_input_client_message_filter.mm
diff --git a/content/browser/renderer_host/text_input_client_message_filter.mm b/content/browser/renderer_host/text_input_client_message_filter.mm
index f3e10fd38e12a23e80789700e6dfc5b433577eb5..b24c51f92ebb3dc6284595582aff02fd36161852 100644
--- a/content/browser/renderer_host/text_input_client_message_filter.mm
+++ b/content/browser/renderer_host/text_input_client_message_filter.mm
@@ -10,8 +10,8 @@
#include "content/common/text_input_client_messages.h"
#include "content/public/browser/render_widget_host_view.h"
#include "ipc/ipc_message_macros.h"
+#include "ui/gfx/point.h"
#include "ui/gfx/range/range.h"
-#include "ui/gfx/rect.h"
namespace content {
@@ -26,6 +26,8 @@ bool TextInputClientMessageFilter::OnMessageReceived(
bool handled = true;
IPC_BEGIN_MESSAGE_MAP_EX(TextInputClientMessageFilter, message,
*message_was_ok)
+ IPC_MESSAGE_HANDLER(TextInputClientReplyMsg_GotStringAtPoint,
+ OnGotStringAtPoint)
IPC_MESSAGE_HANDLER(TextInputClientReplyMsg_GotCharacterIndexForPoint,
OnGotCharacterIndexForPoint)
IPC_MESSAGE_HANDLER(TextInputClientReplyMsg_GotFirstRectForRange,
@@ -39,6 +41,15 @@ bool TextInputClientMessageFilter::OnMessageReceived(
TextInputClientMessageFilter::~TextInputClientMessageFilter() {}
+void TextInputClientMessageFilter::OnGotStringAtPoint(
+ const mac::AttributedStringCoder::EncodedString& encoded_string,
+ const gfx::Point& point) {
+ TextInputClientMac* service = TextInputClientMac::GetInstance();
+ NSAttributedString* string =
+ mac::AttributedStringCoder::Decode(&encoded_string);
+ service->GetStringAtPointReply(string, NSPointFromCGPoint(point.ToCGPoint()));
+}
+
void TextInputClientMessageFilter::OnGotCharacterIndexForPoint(size_t index) {
TextInputClientMac* service = TextInputClientMac::GetInstance();
// |index| could be WTF::notFound (-1) and its value is different from

Powered by Google App Engine
This is Rietveld 408576698