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

Unified Diff: chrome/renderer/render_view.cc

Issue 6289009: [Mac] Implement the system dictionary popup by implementing NSTextInput methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Work on IME Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/render_view.cc
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index a74c8cd8eef478fa69c1348c2f2a612ae1ec8200..4872718a9689338ed5e7848bda063685a6e28c5f 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -91,6 +91,7 @@
#include "chrome/renderer/searchbox.h"
#include "chrome/renderer/speech_input_dispatcher.h"
#include "chrome/renderer/spellchecker/spellcheck.h"
+#include "chrome/renderer/text_input_client_observer.h"
#include "chrome/renderer/translate_helper.h"
#include "chrome/renderer/user_script_idle_scheduler.h"
#include "chrome/renderer/user_script_slave.h"
@@ -613,6 +614,12 @@ RenderView::RenderView(RenderThreadBase* render_thread,
AutoFillAgent* autofill_agent = new AutoFillAgent(this,
password_autofill_manager);
+#if defined(OS_MACOSX)
+ // Create the message filter for the TextInputClient.
+ TextInputClientObserver* input_client = new TextInputClientObserver(this);
+ input_client->render_view(); // Avoid unused variable warning.
+#endif // defined(OS_MACOSX)
+
webwidget_ = WebView::create(this, devtools_agent_, autofill_agent);
g_view_map.Get().insert(std::make_pair(webview(), this));
webkit_preferences_.Apply(webview());
@@ -2203,18 +2210,25 @@ void RenderView::didChangeSelection(bool is_empty_selection) {
// Sometimes we get repeated didChangeSelection calls from webkit when
// the selection hasn't actually changed. We don't want to report these
// because it will cause us to continually claim the X clipboard.
- const std::string& this_selection =
- webview()->focusedFrame()->selectionAsText().utf8();
+ WebFrame* frame = webview()->focusedFrame();
+ const std::string& this_selection = frame->selectionAsText().utf8();
if (this_selection == last_selection_)
return;
+ WebRange range = frame->selectionRange();
Send(new ViewHostMsg_SelectionChanged(routing_id_,
- this_selection));
+ this_selection, range.startOffset(), range.endOffset()));
last_selection_ = this_selection;
} else {
last_selection_.clear();
- Send(new ViewHostMsg_SelectionChanged(routing_id_,
- last_selection_));
+ WebRange range = webwidget_->caretOrSelectionRange();
+ if (!range.isNull()) {
+ Send(new ViewHostMsg_SelectionChanged(routing_id_,
+ last_selection_, range.startOffset(), range.endOffset()));
+ } else {
+ Send(new ViewHostMsg_SelectionChanged(routing_id_,
+ last_selection_, 0, 0));
+ }
}
#endif // defined(OS_POSIX)
}

Powered by Google App Engine
This is Rietveld 408576698