Add kEditingModifier constant.
This constant represents the WebInputEvent::kMetaKey on Mac, and
WebInputEvent::kControlKey on other platforms. It can be checked against
web event modifiers to determine if the editing key (command on Mac
and control on other platforms) is held down.
BUG=59266
Change-Id: Ibdc67e56441fbf3855169fbf6ca1101884d86f38
Reviewed-on: https://chromium-review.googlesource.com/583855
Commit-Queue: Diana Gage <drgage@google.com>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#489464}
diff --git a/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp b/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp
index 0381a7d..187377a 100644
--- a/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp
+++ b/third_party/WebKit/Source/core/exported/WebPluginContainerImpl.cpp
@@ -109,6 +109,16 @@
namespace blink {
+namespace {
+
+#if defined(OS_MACOSX)
+WebInputEvent::Modifiers kEditingModifier = WebInputEvent::kMetaKey;
+#else
+WebInputEvent::Modifiers kEditingModifier = WebInputEvent::kControlKey;
+#endif
+
+} // namespace
+
// Public methods --------------------------------------------------------------
void WebPluginContainerImpl::AttachToLayout() {
@@ -823,15 +833,10 @@
if (web_event.GetType() == WebInputEvent::kRawKeyDown ||
web_event.GetType() == WebInputEvent::kKeyDown) {
-#if defined(OS_MACOSX)
if ((web_event.GetModifiers() & WebInputEvent::kInputModifiers) ==
- WebInputEvent::kMetaKey
-#else
- if ((web_event.GetModifiers() & WebInputEvent::kInputModifiers) ==
- WebInputEvent::kControlKey
-#endif
- && (web_event.windows_key_code == VKEY_C ||
- web_event.windows_key_code == VKEY_INSERT)
+ kEditingModifier &&
+ (web_event.windows_key_code == VKEY_C ||
+ web_event.windows_key_code == VKEY_INSERT)
// Only copy if there's a selection, so that we only ever do this
// for Pepper plugins that support copying. Windowless NPAPI
// plugins will get the event as before.