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

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

Issue 166903005: mac: Add support for asynchronous dictionary lookup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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_nsobject.h" 10 #include "base/mac/scoped_nsobject.h"
(...skipping 19 matching lines...) Expand all
30 // 30 //
31 // Because these methods are part of a synchronous system API, implementing them 31 // Because these methods are part of a synchronous system API, implementing them
32 // requires getting information from the renderer synchronously. Rather than 32 // requires getting information from the renderer synchronously. Rather than
33 // using an actual sync IPC message, a normal async ViewMsg is used with a lock 33 // using an actual sync IPC message, a normal async ViewMsg is used with a lock
34 // and condition (managed by this service). 34 // and condition (managed by this service).
35 class CONTENT_EXPORT TextInputClientMac { 35 class CONTENT_EXPORT TextInputClientMac {
36 public: 36 public:
37 // Returns the singleton instance. 37 // Returns the singleton instance.
38 static TextInputClientMac* GetInstance(); 38 static TextInputClientMac* GetInstance();
39 39
40 void GetStringAtPoint(RenderWidgetHost* rwh,
41 gfx::Point point,
42 void (^replyHandler)(NSAttributedString*, NSRect));
43 void GetStringAtPointReply(NSAttributedString*, NSRect);
44
40 // Each of the three methods mentioned above has an associated pair of methods 45 // Each of the three methods mentioned above has an associated pair of methods
41 // to get data from the renderer. The Get*() methods block the calling thread 46 // to get data from the renderer. The Get*() methods block the calling thread
42 // (always the UI thread) with a short timeout after the async message has 47 // (always the UI thread) with a short timeout after the async message has
43 // been sent to the renderer to lookup the information needed to respond to 48 // been sent to the renderer to lookup the information needed to respond to
44 // the system. The Set*AndSignal() methods store the looked up information in 49 // the system. The Set*AndSignal() methods store the looked up information in
45 // this service and signal the condition to allow the Get*() methods to 50 // this service and signal the condition to allow the Get*() methods to
46 // unlock and return that stored value. 51 // unlock and return that stored value.
47 // 52 //
48 // Returns NSNotFound if the request times out or is not completed. 53 // Returns NSNotFound if the request times out or is not completed.
49 NSUInteger GetCharacterIndexAtPoint(RenderWidgetHost* rwh, gfx::Point point); 54 NSUInteger GetCharacterIndexAtPoint(RenderWidgetHost* rwh, gfx::Point point);
(...skipping 25 matching lines...) Expand all
75 // condition. 80 // condition.
76 void AfterRequest(); 81 void AfterRequest();
77 82
78 NSUInteger character_index_; 83 NSUInteger character_index_;
79 NSRect first_rect_; 84 NSRect first_rect_;
80 base::scoped_nsobject<NSAttributedString> substring_; 85 base::scoped_nsobject<NSAttributedString> substring_;
81 86
82 base::Lock lock_; 87 base::Lock lock_;
83 base::ConditionVariable condition_; 88 base::ConditionVariable condition_;
84 89
90 void (^replyHandler_)(NSAttributedString*, NSRect);
Avi (use Gerrit) 2014/02/18 21:42:25 Don't use raw pointers if possible. ScopedBlock?
91
85 DISALLOW_COPY_AND_ASSIGN(TextInputClientMac); 92 DISALLOW_COPY_AND_ASSIGN(TextInputClientMac);
86 }; 93 };
87 94
88 } // namespace content 95 } // namespace content
89 96
90 #endif // CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_CLIENT_MAC_H_ 97 #endif // CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_CLIENT_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698