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

Side by Side Diff: content/renderer/text_input_client_observer.cc

Issue 1318483007: Implement "Look Up In Dictionary" context menu item asynchronously. (OS X) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed review comments. 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
« no previous file with comments | « content/common/text_input_client_messages.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "content/renderer/text_input_client_observer.h" 5 #include "content/renderer/text_input_client_observer.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "content/common/text_input_client_messages.h" 8 #include "content/common/text_input_client_messages.h"
9 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 9 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
10 #include "content/renderer/render_view_impl.h" 10 #include "content/renderer/render_view_impl.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 frame->firstRectForCharacterRange(range.start(), range.length(), 81 frame->firstRectForCharacterRange(range.start(), range.length(),
82 web_rect); 82 web_rect);
83 rect = web_rect; 83 rect = web_rect;
84 } 84 }
85 } 85 }
86 Send(new TextInputClientReplyMsg_GotFirstRectForRange(routing_id(), rect)); 86 Send(new TextInputClientReplyMsg_GotFirstRectForRange(routing_id(), rect));
87 } 87 }
88 88
89 void TextInputClientObserver::OnStringForRange(gfx::Range range) { 89 void TextInputClientObserver::OnStringForRange(gfx::Range range) {
90 #if defined(OS_MACOSX) 90 #if defined(OS_MACOSX)
91 blink::WebPoint baselinePoint;
91 NSAttributedString* string = nil; 92 NSAttributedString* string = nil;
92 blink::WebLocalFrame* frame = webview()->focusedFrame()->toWebLocalFrame(); 93 blink::WebLocalFrame* frame = webview()->focusedFrame()->toWebLocalFrame();
93 if (frame) { 94 if (frame) {
94 string = blink::WebSubstringUtil::attributedSubstringInRange( 95 string = blink::WebSubstringUtil::attributedSubstringInRange(
95 frame, range.start(), range.length()); 96 frame, range.start(), range.length(), &baselinePoint);
96 } 97 }
97 scoped_ptr<const mac::AttributedStringCoder::EncodedString> encoded( 98 scoped_ptr<const mac::AttributedStringCoder::EncodedString> encoded(
98 mac::AttributedStringCoder::Encode(string)); 99 mac::AttributedStringCoder::Encode(string));
99 Send(new TextInputClientReplyMsg_GotStringForRange(routing_id(), 100 Send(new TextInputClientReplyMsg_GotStringForRange(routing_id(),
100 *encoded.get())); 101 *encoded.get(), baselinePoint));
101 #else 102 #else
102 NOTIMPLEMENTED(); 103 NOTIMPLEMENTED();
103 #endif 104 #endif
104 } 105 }
105 106
106 } // namespace content 107 } // namespace content
OLDNEW
« no previous file with comments | « content/common/text_input_client_messages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698