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

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: 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 2971c365a1bfb1bddb53d2403bb96523e7e6f2d8..492ebfe09a15e4752224a7b22d12835256900c58 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,27 @@ 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 = web_input_event_modifiers |
+ WebKit::WebInputEvent::ShiftKey;
+ }
+ if (aura_event_flags & ui::EF_CONTROL_DOWN) {
+ web_input_event_modifiers = web_input_event_modifiers |
+ WebKit::WebInputEvent::ControlKey;
+ }
+ if (aura_event_flags & ui::EF_ALT_DOWN) {
+ web_input_event_modifiers = web_input_event_modifiers |
+ WebKit::WebInputEvent::AltKey;
+ }
+ if (aura_event_flags & ui::EF_COMMAND_DOWN) {
+ web_input_event_modifiers = web_input_event_modifiers |
+ WebKit::WebInputEvent::MetaKey;
+ }
+ return web_input_event_modifiers;
+}
+
} // namespace
@@ -584,7 +606,8 @@ void WebContentsViewAura::OnDragEntered(const aura::DropTargetEvent& event) {
gfx::Point screen_pt =
GetNativeView()->GetRootWindow()->last_mouse_location();
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());
@@ -597,7 +620,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();
@@ -614,7 +638,8 @@ void WebContentsViewAura::OnDragExited() {
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