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

Unified Diff: content/browser/web_contents/web_contents_view_aura.cc

Issue 10377119: Plumb event flags (shift/alt/ctrl modifiers) for drag/drop events to WebKit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 8 years, 7 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: content/browser/web_contents/web_contents_view_aura.cc
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index ff14d3a2e8fe3773aed984703818db4839d49831..b3b08bf72b359d14fc7d46fd912d59548abd74b9 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -14,6 +14,7 @@
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_view_delegate.h"
#include "content/public/browser/web_drag_dest_delegate.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/client/drag_drop_delegate.h"
#include "ui/aura/event.h"
@@ -165,6 +166,19 @@ WebKit::WebDragOperationsMask ConvertToWeb(int drag_op) {
return (WebKit::WebDragOperationsMask) web_drag_op;
}
+int ConvertAuraEventFlagsToWebInputEventModifiers(int aura_event_flags) {
+ int web_input_event_modifiers = 0;
+ if (aura_event_flags & ui::EF_SHIFT_DOWN)
+ web_input_event_modifiers |= WebKit::WebInputEvent::ShiftKey;
+ if (aura_event_flags & ui::EF_CONTROL_DOWN)
+ web_input_event_modifiers |= WebKit::WebInputEvent::ControlKey;
+ if (aura_event_flags & ui::EF_ALT_DOWN)
+ web_input_event_modifiers |= WebKit::WebInputEvent::AltKey;
+ if (aura_event_flags & ui::EF_COMMAND_DOWN)
+ web_input_event_modifiers |= WebKit::WebInputEvent::MetaKey;
+ return web_input_event_modifiers;
+}
+
} // namespace
@@ -586,7 +600,8 @@ void WebContentsViewAura::OnDragEntered(const aura::DropTargetEvent& event) {
GetNativeView()->GetRootWindow()->last_mouse_location();
current_rvh_for_drag_ = web_contents_->GetRenderViewHost();
web_contents_->GetRenderViewHost()->DragTargetDragEnter(
- drop_data, event.location(), screen_pt, op);
+ drop_data, event.location(), screen_pt, op,
+ ConvertAuraEventFlagsToWebInputEventModifiers(event.flags()));
if (drag_dest_delegate_) {
drag_dest_delegate_->OnReceiveDragData(event.data());
@@ -603,7 +618,8 @@ int WebContentsViewAura::OnDragUpdated(const aura::DropTargetEvent& event) {
gfx::Point screen_pt =
GetNativeView()->GetRootWindow()->last_mouse_location();
web_contents_->GetRenderViewHost()->DragTargetDragOver(
- event.location(), screen_pt, op);
+ event.location(), screen_pt, op,
+ ConvertAuraEventFlagsToWebInputEventModifiers(event.flags()));
if (drag_dest_delegate_)
drag_dest_delegate_->OnDragOver();
@@ -628,7 +644,8 @@ int WebContentsViewAura::OnPerformDrop(const aura::DropTargetEvent& event) {
web_contents_->GetRenderViewHost()->DragTargetDrop(
event.location(),
- GetNativeView()->GetRootWindow()->last_mouse_location());
+ GetNativeView()->GetRootWindow()->last_mouse_location(),
+ ConvertAuraEventFlagsToWebInputEventModifiers(event.flags()));
if (drag_dest_delegate_)
drag_dest_delegate_->OnDrop();
return current_drag_op_;

Powered by Google App Engine
This is Rietveld 408576698