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

Unified Diff: content/browser/renderer_host/render_widget_host_view_mac.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/render_widget_host_view_mac.mm
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index f37a73fc85697e2a4611f723149f50f158701467..14b6a3bbc6e00ff672b803d3a6ed50b070c65061 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -2799,6 +2799,22 @@ void RenderWidgetHostViewMac::SendPendingSwapAck() {
[responderDelegate_ touchesEndedWithEvent:event];
}
+- (void)quickLookWithEvent:(NSEvent*)event {
Avi (use Gerrit) 2014/03/12 04:55:40 Can you note that this only will be invoked for >=
Andre 2014/03/12 16:59:26 Done.
+ NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil];
+ TextInputClientMac::GetInstance()->GetStringAtPoint(
+ renderWidgetHostView_->render_widget_host_,
+ gfx::Point(point.x, NSHeight([self frame]) - point.y),
+ ^(NSAttributedString* string, NSPoint baselinePoint) {
eseidel 2014/03/12 04:48:36 Woh, crazy. Maybe things have changed, but I reca
Avi (use Gerrit) 2014/03/12 04:58:20 I will be kind and attribute this to your weird hi
+ if (string && [string length] > 0) {
Avi (use Gerrit) 2014/03/12 04:55:40 Technically speaking you don't need to check strin
Andre 2014/03/12 16:59:26 True, but my thinking was the extra check makes it
Avi (use Gerrit) 2014/03/12 17:10:54 Please leave it alone. I don't mind redundancy in
+ dispatch_async(dispatch_get_main_queue(), ^{
Avi (use Gerrit) 2014/03/12 04:55:40 Why the dispatch on the main thread? Are we really
Andre 2014/03/12 16:59:26 The callback happens on the IO/IPC thread. I will
+ [self showDefinitionForAttributedString:string
+ atPoint:baselinePoint];
+ });
+ }
+ }
+ );
+}
+
// This method handles 2 different types of hardware events.
// (Apple does not distinguish between them).
// a. Scrolling the middle wheel of a mouse.

Powered by Google App Engine
This is Rietveld 408576698