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

Side by Side Diff: content/browser/renderer_host/text_input_client_mac.h

Issue 1313553006: Implement "Look Up In Dictionary" context menu item asynchronously. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_CLIENT_MAC_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_CLIENT_MAC_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_CLIENT_MAC_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_CLIENT_MAC_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/mac/scoped_block.h" 10 #include "base/mac/scoped_block.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 RenderWidgetHost* rwh, NSRange range); 59 RenderWidgetHost* rwh, NSRange range);
60 // Returns NSZeroRect if the request times out or is not completed. The result 60 // Returns NSZeroRect if the request times out or is not completed. The result
61 // is in WebKit coordinates. 61 // is in WebKit coordinates.
62 NSRect GetFirstRectForRange(RenderWidgetHost* rwh, NSRange range); 62 NSRect GetFirstRectForRange(RenderWidgetHost* rwh, NSRange range);
63 63
64 // When the renderer sends the ViewHostMsg reply, the RenderMessageFilter will 64 // When the renderer sends the ViewHostMsg reply, the RenderMessageFilter will
65 // call the corresponding method on the IO thread to unlock the condition and 65 // call the corresponding method on the IO thread to unlock the condition and
66 // allow the Get*() methods to continue/return. 66 // allow the Get*() methods to continue/return.
67 void SetCharacterIndexAndSignal(NSUInteger index); 67 void SetCharacterIndexAndSignal(NSUInteger index);
68 void SetFirstRectAndSignal(NSRect first_rect); 68 void SetFirstRectAndSignal(NSRect first_rect);
69 void SetSubstringAndSignal(NSAttributedString* string);
70 69
71 // This async method is invoked from RenderWidgetHostViewCocoa's 70 // This async method is invoked from RenderWidgetHostViewCocoa's
72 // -quickLookWithEvent:, when the user taps a word using 3 fingers. 71 // -quickLookWithEvent:, when the user taps a word using 3 fingers.
73 // The reply callback will be invoked from the IO thread, the caller is 72 // The reply callback will be invoked from the IO thread, the caller is
74 // responsible for bouncing to the main thread if necessary. 73 // responsible for bouncing to the main thread if necessary.
75 // The callback parameters provide the attributed word under the point and 74 // The callback parameters provide the attributed word under the point and
76 // the lower left baseline point of the text. 75 // the lower left baseline point of the text.
77 void GetStringAtPoint(RenderWidgetHost* rwh, 76 void GetStringAtPoint(RenderWidgetHost* rwh,
78 gfx::Point point, 77 gfx::Point point,
79 void (^replyHandler)(NSAttributedString*, NSPoint)); 78 void (^replyHandler)(NSAttributedString*, NSPoint));
(...skipping 10 matching lines...) Expand all
90 // These methods lock the internal condition for use before the asynchronous 89 // These methods lock the internal condition for use before the asynchronous
91 // message is sent to the renderer to lookup the required information. These 90 // message is sent to the renderer to lookup the required information. These
92 // are only used on the UI thread. 91 // are only used on the UI thread.
93 void BeforeRequest(); 92 void BeforeRequest();
94 // Called at the end of a critical section. This will release the lock and 93 // Called at the end of a critical section. This will release the lock and
95 // condition. 94 // condition.
96 void AfterRequest(); 95 void AfterRequest();
97 96
98 NSUInteger character_index_; 97 NSUInteger character_index_;
99 NSRect first_rect_; 98 NSRect first_rect_;
100 base::scoped_nsobject<NSAttributedString> substring_;
101 99
102 base::Lock lock_; 100 base::Lock lock_;
103 base::ConditionVariable condition_; 101 base::ConditionVariable condition_;
104 102
105 base::mac::ScopedBlock<void(^)(NSAttributedString*, NSPoint)> replyHandler_; 103 base::mac::ScopedBlock<void(^)(NSAttributedString*, NSPoint)> replyHandler_;
106 104
107 DISALLOW_COPY_AND_ASSIGN(TextInputClientMac); 105 DISALLOW_COPY_AND_ASSIGN(TextInputClientMac);
108 }; 106 };
109 107
110 } // namespace content 108 } // namespace content
111 109
112 #endif // CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_CLIENT_MAC_H_ 110 #endif // CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_CLIENT_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698