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

Unified Diff: chrome/browser/renderer_host/render_message_filter_mac.mm

Issue 6289009: [Mac] Implement the system dictionary popup by implementing NSTextInput methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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: chrome/browser/renderer_host/render_message_filter_mac.mm
diff --git a/chrome/browser/renderer_host/render_message_filter_mac.mm b/chrome/browser/renderer_host/render_message_filter_mac.mm
index dd80f2edb381e8b4e93d79d16852e91bf50f009c..c6aba1ec1b18bdbe37d8da105e9714476596ebc6 100644
--- a/chrome/browser/renderer_host/render_message_filter_mac.mm
+++ b/chrome/browser/renderer_host/render_message_filter_mac.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,6 +10,8 @@
#include "base/sys_string_conversions.h"
#include "chrome/browser/browser_thread.h"
#import "chrome/browser/ui/cocoa/find_pasteboard.h"
+#import "chrome/browser/ui/cocoa/lookup_in_dictionary.h"
+#include "gfx/rect.h"
// The number of utf16 code units that will be written to the find pasteboard,
// longer texts are silently ignored. This is to prevent that a compromised
@@ -41,3 +43,25 @@ void RenderMessageFilter::OnClipboardFindPboardWriteString(
}
}
}
+
+void RenderMessageFilter::OnGotCharacterIndexForPoint(uint index) {
+ LookupInDictionary* service = LookupInDictionary::GetInstance();
+ service->SetCharacterIndexAndSignal(index);
+}
+
+void RenderMessageFilter::OnGotFirstRectForRange(const gfx::Rect& rect) {
+ CGRect cgrect(rect.ToCGRect());
+ LookupInDictionary* service = LookupInDictionary::GetInstance();
+ service->SetFirstRectAndSignal(NSRectFromCGRect(rect.ToCGRect()));
+}
+
+void RenderMessageFilter::OnGotStringFromRange(const string16& string) {
+ LookupInDictionary* service = LookupInDictionary::GetInstance();
+ if (!string.length()) {
+ service->SetSubstringAndSignal(nil);
+ } else {
+ NSData* data = [NSData dataWithBytes:string.data() length:string.length()];
+ NSAttributedString* string = [NSUnarchiver unarchiveObjectWithData:data];
+ service->SetSubstringAndSignal(string);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698