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

Unified Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 103403006: Implement Input Method related WebPlugin interface for browser plugin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add cancel/compositionrangechanged Created 7 years 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: content/browser/browser_plugin/browser_plugin_guest.cc
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index f07bd61ae8784b909f44604056d398ff05c82fbd..a8b595d5225ef1b6e2ad8dd7be7ca978a62cdd23 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -511,6 +511,10 @@ bool BrowserPluginGuest::OnMessageReceivedFromEmbedder(
OnDragStatusUpdate)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ExecuteEditCommand,
OnExecuteEditCommand)
+ IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ImeConfirmComposition,
Fady Samuel 2013/12/10 17:55:32 Alphabetical order.
kochi 2013/12/11 01:35:21 Done.
+ OnImeConfirmComposition)
+ IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_ImeSetComposition,
Fady Samuel 2013/12/10 17:55:32 Alphabetical order.
kochi 2013/12/11 01:35:21 Done.
+ OnImeSetComposition)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_HandleInputEvent,
OnHandleInputEvent)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_LockMouse_ACK, OnLockMouseAck)
@@ -1115,6 +1119,8 @@ bool BrowserPluginGuest::ShouldForwardToBrowserPluginGuest(
case BrowserPluginHostMsg_DragStatusUpdate::ID:
case BrowserPluginHostMsg_ExecuteEditCommand::ID:
case BrowserPluginHostMsg_HandleInputEvent::ID:
+ case BrowserPluginHostMsg_ImeConfirmComposition::ID:
+ case BrowserPluginHostMsg_ImeSetComposition::ID:
case BrowserPluginHostMsg_LockMouse_ACK::ID:
case BrowserPluginHostMsg_NavigateGuest::ID:
case BrowserPluginHostMsg_PluginDestroyed::ID:
@@ -1150,6 +1156,14 @@ bool BrowserPluginGuest::OnMessageReceived(const IPC::Message& message) {
#endif
IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget)
IPC_MESSAGE_HANDLER(ViewHostMsg_TakeFocus, OnTakeFocus)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputTypeChanged,
+ OnTextInputTypeChanged)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition,
+ OnImeCancelComposition)
+#if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged,
+ OnImeCompositionRangeChanged)
+#endif
IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFrameName, OnUpdateFrameName)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect)
@@ -1258,6 +1272,27 @@ void BrowserPluginGuest::OnExecuteEditCommand(int instance_id,
Send(new InputMsg_ExecuteEditCommand(routing_id(), name, std::string()));
}
+void BrowserPluginGuest::OnImeSetComposition(
+ int instance_id,
+ const std::string& text,
+ const std::vector<blink::WebCompositionUnderline>& underlines,
+ int selection_start,
+ int selection_end) {
+ Send(new ViewMsg_ImeSetComposition(routing_id(),
+ UTF8ToUTF16(text), underlines,
+ selection_start, selection_end));
+}
+
+void BrowserPluginGuest::OnImeConfirmComposition(
+ int instance_id,
+ const std::string& text,
+ bool keep_selection) {
+ Send(new ViewMsg_ImeConfirmComposition(routing_id(),
+ UTF8ToUTF16(text),
+ gfx::Range::InvalidRange(),
+ keep_selection));
+}
+
void BrowserPluginGuest::OnReclaimCompositorResources(
int instance_id,
int route_id,
@@ -1744,6 +1779,31 @@ void BrowserPluginGuest::OnUpdateRect(
new BrowserPluginMsg_UpdateRect(instance_id(), relay_params));
}
+void BrowserPluginGuest::OnTextInputTypeChanged(ui::TextInputType type,
+ ui::TextInputMode input_mode,
+ bool can_compose_inline) {
+ RenderWidgetHostImpl* render_widget_host =
+
+ RenderWidgetHostImpl::From(GetWebContents()->GetRenderViewHost());
+ render_widget_host->ChangeTextInputType(type, input_mode, can_compose_inline);
+}
+
+void BrowserPluginGuest::OnImeCancelComposition() {
+ RenderWidgetHostImpl* render_widget_host =
+ RenderWidgetHostImpl::From(GetWebContents()->GetRenderViewHost());
+ render_widget_host->CancelImeComposition();
+}
+
+#if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA)
+void BrowserPluginGuest::OnImeCompositionRangeChanged(
+ const gfx::Range& range,
+ const std::vector<gfx::Rect>& character_bounds) {
+ RenderWidgetHostImpl* render_widget_host =
+ RenderWidgetHostImpl::From(GetWebContents()->GetRenderViewHost());
+ render_widget_host->ChangeImeCompositionRange(range, character_bounds);
+}
+#endif
+
void BrowserPluginGuest::DidRetrieveDownloadURLFromRequestId(
const std::string& request_method,
const base::Callback<void(bool)>& callback,

Powered by Google App Engine
This is Rietveld 408576698