summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-01 01:03:46 +0000
committerfsamuel@chromium.org <fsamuel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-01 01:03:46 +0000
commitb77fac5718d841aee05e9d5d8096d6be647d0b11 (patch)
tree40947dd260c9bd7a63d4f5eaa2de7ebc779330d0 /content
parent0f282542291814f19d79f9989f14afc5372e1669 (diff)
downloadchromium_src-b77fac5718d841aee05e9d5d8096d6be647d0b11.zip
chromium_src-b77fac5718d841aee05e9d5d8096d6be647d0b11.tar.gz
chromium_src-b77fac5718d841aee05e9d5d8096d6be647d0b11.tar.bz2
<webview>: Plumb edit commands
This patch plumbs edit commands that do not trigger menu blink on Mac. This is the corresponding Blink patch: https://codereview.chromium.org/15071004/ BUG=230148 Test=WebViewInteractiveTest.EditCommandsNoMenu Review URL: https://chromiumcodereview.appspot.com/15149006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203542 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/browser_plugin/browser_plugin_guest.cc10
-rw-r--r--content/browser/browser_plugin/browser_plugin_guest.h4
-rw-r--r--content/common/browser_plugin/browser_plugin_messages.h6
-rw-r--r--content/renderer/browser_plugin/browser_plugin.cc22
-rw-r--r--content/renderer/browser_plugin/browser_plugin.h5
-rw-r--r--content/renderer/render_view_impl.cc3
6 files changed, 49 insertions, 1 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index 75928e8..254be6f 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -350,6 +350,8 @@ bool BrowserPluginGuest::OnMessageReceivedFromEmbedder(
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_RespondPermission,
OnRespondPermission)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetAutoSize, OnSetSize)
+ IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent,
+ OnSetEditCommandsForNextKeyEvent)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetFocus, OnSetFocus)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetName, OnSetName)
IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetVisibility, OnSetVisibility)
@@ -976,6 +978,7 @@ bool BrowserPluginGuest::ShouldForwardToBrowserPluginGuest(
case BrowserPluginHostMsg_ResizeGuest::ID:
case BrowserPluginHostMsg_RespondPermission::ID:
case BrowserPluginHostMsg_SetAutoSize::ID:
+ case BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent::ID:
case BrowserPluginHostMsg_SetFocus::ID:
case BrowserPluginHostMsg_SetName::ID:
case BrowserPluginHostMsg_SetVisibility::ID:
@@ -1320,6 +1323,13 @@ void BrowserPluginGuest::OnSetSize(
OnResizeGuest(instance_id_, resize_guest_params);
}
+void BrowserPluginGuest::OnSetEditCommandsForNextKeyEvent(
+ int instance_id,
+ const std::vector<EditCommand>& edit_commands) {
+ Send(new InputMsg_SetEditCommandsForNextKeyEvent(routing_id(),
+ edit_commands));
+}
+
void BrowserPluginGuest::OnSetVisibility(int instance_id, bool visible) {
guest_visible_ = visible;
if (embedder_visible_ && guest_visible_)
diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h
index a298922..4fd03dc 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.h
+++ b/content/browser/browser_plugin/browser_plugin_guest.h
@@ -30,6 +30,7 @@
#include "base/shared_memory.h"
#include "base/time.h"
#include "content/common/browser_plugin/browser_plugin_message_enums.h"
+#include "content/common/edit_command.h"
#include "content/port/common/input_event_ack_state.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -364,6 +365,9 @@ class CONTENT_EXPORT BrowserPluginGuest
int instance_id,
const BrowserPluginHostMsg_AutoSize_Params& auto_size_params,
const BrowserPluginHostMsg_ResizeGuest_Params& resize_guest_params);
+ void OnSetEditCommandsForNextKeyEvent(
+ int instance_id,
+ const std::vector<EditCommand>& edit_commands);
// The guest WebContents is visible if both its embedder is visible and
// the browser plugin element is visible. If either one is not then the
// WebContents is marked as hidden. A hidden WebContents will consume
diff --git a/content/common/browser_plugin/browser_plugin_messages.h b/content/common/browser_plugin/browser_plugin_messages.h
index f20b4ed..d161ada 100644
--- a/content/common/browser_plugin/browser_plugin_messages.h
+++ b/content/common/browser_plugin/browser_plugin_messages.h
@@ -15,6 +15,7 @@
#include "content/common/browser_plugin/browser_plugin_message_enums.h"
#include "content/common/content_export.h"
#include "content/common/content_param_traits.h"
+#include "content/common/edit_command.h"
#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_message_macros.h"
@@ -152,6 +153,11 @@ IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_ExecuteEditCommand,
int /* instance_id */,
std::string /* command */)
+// This message must be sent just before sending a key event.
+IPC_MESSAGE_ROUTED2(BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent,
+ int /* instance_id */,
+ std::vector<content::EditCommand> /* edit_commands */)
+
// This message is sent to the browser process to enable or disable autosize
// mode.
IPC_MESSAGE_ROUTED3(
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index 5154834..ce7f813 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -1242,6 +1242,10 @@ bool BrowserPlugin::supportsKeyboardFocus() const {
return true;
}
+bool BrowserPlugin::supportsEditCommands() const {
+ return true;
+}
+
bool BrowserPlugin::canProcessDrag() const {
return true;
}
@@ -1518,6 +1522,17 @@ bool BrowserPlugin::handleInputEvent(const WebKit::WebInputEvent& event,
touch_event->touchesLength += touch_event->changedTouchesLength;
modified_event = touch_event.get();
}
+
+ if (WebKit::WebInputEvent::isKeyboardEventType(event.type) &&
+ !edit_commands_.empty()) {
+ browser_plugin_manager()->Send(
+ new BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent(
+ render_view_routing_id_,
+ instance_id_,
+ edit_commands_));
+ edit_commands_.clear();
+ }
+
browser_plugin_manager()->Send(
new BrowserPluginHostMsg_HandleInputEvent(render_view_routing_id_,
guest_instance_id_,
@@ -1578,6 +1593,13 @@ bool BrowserPlugin::executeEditCommand(const WebKit::WebString& name) {
return true;
}
+bool BrowserPlugin::executeEditCommand(const WebKit::WebString& name,
+ const WebKit::WebString& value) {
+ edit_commands_.push_back(EditCommand(name.utf8(), value.utf8()));
+ // BrowserPlugin swallows edit commands.
+ return true;
+}
+
void BrowserPlugin::OnLockMouseACK(bool succeeded) {
browser_plugin_manager()->Send(new BrowserPluginHostMsg_LockMouse_ACK(
render_view_routing_id_,
diff --git a/content/renderer/browser_plugin/browser_plugin.h b/content/renderer/browser_plugin/browser_plugin.h
index 9257974..227a401 100644
--- a/content/renderer/browser_plugin/browser_plugin.h
+++ b/content/renderer/browser_plugin/browser_plugin.h
@@ -180,6 +180,7 @@ class CONTENT_EXPORT BrowserPlugin :
virtual NPObject* scriptableObject() OVERRIDE;
virtual struct _NPP* pluginNPP() OVERRIDE;
virtual bool supportsKeyboardFocus() const OVERRIDE;
+ virtual bool supportsEditCommands() const OVERRIDE;
virtual bool canProcessDrag() const OVERRIDE;
virtual void paint(
WebKit::WebCanvas* canvas,
@@ -213,6 +214,8 @@ class CONTENT_EXPORT BrowserPlugin :
void* notify_data,
const WebKit::WebURLError& error) OVERRIDE;
virtual bool executeEditCommand(const WebKit::WebString& name) OVERRIDE;
+ virtual bool executeEditCommand(const WebKit::WebString& name,
+ const WebKit::WebString& value) OVERRIDE;
// MouseLockDispatcher::LockTarget implementation.
virtual void OnLockMouseACK(bool succeeded) OVERRIDE;
@@ -460,6 +463,8 @@ class CONTENT_EXPORT BrowserPlugin :
// get called after BrowserPlugin has been destroyed.
base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_;
+ std::vector<EditCommand> edit_commands_;
+
DISALLOW_COPY_AND_ASSIGN(BrowserPlugin);
};
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index e5740cd4..36481be 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -2288,7 +2288,8 @@ bool RenderViewImpl::handleCurrentKeyboardEvent() {
// key (but it's the exception). Once one edit command is not executed, it
// seems safest to not execute the rest.
if (!frame->executeCommand(WebString::fromUTF8(it->name),
- WebString::fromUTF8(it->value)))
+ WebString::fromUTF8(it->value),
+ GetFocusedNode()))
break;
did_execute_command = true;
}