OLD | NEW |
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 RenderWidgetHost* rwh, NSRange range); | 62 RenderWidgetHost* rwh, NSRange range); |
63 // Returns NSZeroRect if the request times out or is not completed. The result | 63 // Returns NSZeroRect if the request times out or is not completed. The result |
64 // is in WebKit coordinates. | 64 // is in WebKit coordinates. |
65 NSRect GetFirstRectForRange(RenderWidgetHost* rwh, NSRange range); | 65 NSRect GetFirstRectForRange(RenderWidgetHost* rwh, NSRange range); |
66 | 66 |
67 // When the renderer sends the ViewHostMsg reply, the RenderMessageFilter will | 67 // When the renderer sends the ViewHostMsg reply, the RenderMessageFilter will |
68 // call the corresponding method on the IO thread to unlock the condition and | 68 // call the corresponding method on the IO thread to unlock the condition and |
69 // allow the Get*() methods to continue/return. | 69 // allow the Get*() methods to continue/return. |
70 void SetCharacterIndexAndSignal(NSUInteger index); | 70 void SetCharacterIndexAndSignal(NSUInteger index); |
71 void SetFirstRectAndSignal(NSRect first_rect); | 71 void SetFirstRectAndSignal(NSRect first_rect); |
72 void SetSubstringAndSignal(NSAttributedString* string); | |
73 | 72 |
74 // This async method is invoked from RenderWidgetHostViewCocoa's | 73 // This async method is invoked from RenderWidgetHostViewCocoa's |
75 // -quickLookWithEvent:, when the user taps a word using 3 fingers. | 74 // -quickLookWithEvent:, when the user taps a word using 3 fingers. |
76 // The reply callback will be invoked from the IO thread; the caller is | 75 // The reply callback will be invoked from the IO thread; the caller is |
77 // responsible for bouncing to the main thread if necessary. | 76 // responsible for bouncing to the main thread if necessary. |
78 // The callback parameters provide the attributed word under the point and | 77 // The callback parameters provide the attributed word under the point and |
79 // the lower left baseline point of the text. | 78 // the lower left baseline point of the text. |
80 void GetStringAtPoint(RenderWidgetHost* rwh, | 79 void GetStringAtPoint(RenderWidgetHost* rwh, |
81 gfx::Point point, | 80 gfx::Point point, |
82 void (^reply_handler)(NSAttributedString*, NSPoint)); | 81 void (^reply_handler)(NSAttributedString*, NSPoint)); |
(...skipping 25 matching lines...) Expand all Loading... |
108 // These methods lock the internal condition for use before the asynchronous | 107 // These methods lock the internal condition for use before the asynchronous |
109 // message is sent to the renderer to lookup the required information. These | 108 // message is sent to the renderer to lookup the required information. These |
110 // are only used on the UI thread. | 109 // are only used on the UI thread. |
111 void BeforeRequest(); | 110 void BeforeRequest(); |
112 // Called at the end of a critical section. This will release the lock and | 111 // Called at the end of a critical section. This will release the lock and |
113 // condition. | 112 // condition. |
114 void AfterRequest(); | 113 void AfterRequest(); |
115 | 114 |
116 NSUInteger character_index_; | 115 NSUInteger character_index_; |
117 NSRect first_rect_; | 116 NSRect first_rect_; |
118 base::scoped_nsobject<NSAttributedString> substring_; | |
119 | 117 |
120 base::Lock lock_; | 118 base::Lock lock_; |
121 base::ConditionVariable condition_; | 119 base::ConditionVariable condition_; |
122 | 120 |
123 // The callback when received IPC TextInputClientReplyMsg_GotStringAtPoint. | 121 // The callback when received IPC TextInputClientReplyMsg_GotStringAtPoint. |
124 base::mac::ScopedBlock<void(^)(NSAttributedString*, NSPoint)> | 122 base::mac::ScopedBlock<void(^)(NSAttributedString*, NSPoint)> |
125 replyForPointHandler_; | 123 replyForPointHandler_; |
126 | 124 |
127 // The callback when received IPC TextInputClientReplyMsg_GotStringForRange. | 125 // The callback when received IPC TextInputClientReplyMsg_GotStringForRange. |
128 base::mac::ScopedBlock<void(^)(NSAttributedString*, NSPoint)> | 126 base::mac::ScopedBlock<void(^)(NSAttributedString*, NSPoint)> |
129 replyForRangeHandler_; | 127 replyForRangeHandler_; |
130 | 128 |
131 DISALLOW_COPY_AND_ASSIGN(TextInputClientMac); | 129 DISALLOW_COPY_AND_ASSIGN(TextInputClientMac); |
132 }; | 130 }; |
133 | 131 |
134 } // namespace content | 132 } // namespace content |
135 | 133 |
136 #endif // CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_CLIENT_MAC_H_ | 134 #endif // CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_CLIENT_MAC_H_ |
OLD | NEW |