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

Unified Diff: content/public/test/content_browser_test_utils_mac.mm

Issue 2278283002: Implement Mac Pop-up Dictionary for OOPIF. (Closed)
Patch Set: Addressing lfg@'s comment Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/test/content_browser_test_utils.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/content_browser_test_utils_mac.mm
diff --git a/content/public/test/content_browser_test_utils_mac.mm b/content/public/test/content_browser_test_utils_mac.mm
index d2e879cfa3526bdd20a88b0a5625c60feaa9a15f..da54e5735de8ef6fc4b9e6b0104b2a0935a20a07 100644
--- a/content/public/test/content_browser_test_utils_mac.mm
+++ b/content/public/test/content_browser_test_utils_mac.mm
@@ -7,7 +7,11 @@
#include <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>
+#include "content/browser/renderer_host/text_input_client_mac.h"
+#include "content/public/browser/render_widget_host.h"
+#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/range/range.h"
namespace content {
@@ -22,4 +26,29 @@ void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds) {
[window setFrame:new_bounds display:NO];
}
+void GetStringAtPointForRenderWidget(
+ RenderWidgetHost* rwh,
+ const gfx::Point& point,
+ base::Callback<void(const std::string&, const gfx::Point&)>
+ result_callback) {
+ TextInputClientMac::GetInstance()->GetStringAtPoint(
+ rwh, point, ^(NSAttributedString* string, NSPoint baselinePoint) {
+ result_callback.Run([[string string] UTF8String],
+ gfx::Point(baselinePoint.x, baselinePoint.y));
+ });
+}
+
+void GetStringFromRangeForRenderWidget(
+ RenderWidgetHost* rwh,
+ const gfx::Range& range,
+ base::Callback<void(const std::string&, const gfx::Point&)>
+ result_callback) {
+ TextInputClientMac::GetInstance()->GetStringFromRange(
+ rwh, range.ToNSRange(),
+ ^(NSAttributedString* string, NSPoint baselinePoint) {
+ result_callback.Run([[string string] UTF8String],
+ gfx::Point(baselinePoint.x, baselinePoint.y));
+ });
+}
+
} // namespace content
« no previous file with comments | « content/public/test/content_browser_test_utils.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698