OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 } | 1048 } |
1049 | 1049 |
1050 //////////////////////////////////////////////////////////////////////////////// | 1050 //////////////////////////////////////////////////////////////////////////////// |
1051 // WebContentsViewAura, aura::client::DragDropDelegate implementation: | 1051 // WebContentsViewAura, aura::client::DragDropDelegate implementation: |
1052 | 1052 |
1053 void WebContentsViewAura::OnDragEntered(const ui::DropTargetEvent& event) { | 1053 void WebContentsViewAura::OnDragEntered(const ui::DropTargetEvent& event) { |
1054 current_rvh_for_drag_ = web_contents_->GetRenderViewHost(); | 1054 current_rvh_for_drag_ = web_contents_->GetRenderViewHost(); |
1055 current_drop_data_.reset(new DropData()); | 1055 current_drop_data_.reset(new DropData()); |
1056 | 1056 |
1057 PrepareDropData(current_drop_data_.get(), event.data()); | 1057 PrepareDropData(current_drop_data_.get(), event.data()); |
| 1058 |
| 1059 web_contents_->GetRenderViewHost()->FilterDropData(current_drop_data_.get()); |
| 1060 |
1058 blink::WebDragOperationsMask op = ConvertToWeb(event.source_operations()); | 1061 blink::WebDragOperationsMask op = ConvertToWeb(event.source_operations()); |
1059 | 1062 |
1060 // Give the delegate an opportunity to cancel the drag. | 1063 // Give the delegate an opportunity to cancel the drag. |
1061 if (web_contents_->GetDelegate() && | 1064 if (web_contents_->GetDelegate() && |
1062 !web_contents_->GetDelegate()->CanDragEnter( | 1065 !web_contents_->GetDelegate()->CanDragEnter( |
1063 web_contents_, *current_drop_data_.get(), op)) { | 1066 web_contents_, *current_drop_data_.get(), op)) { |
1064 current_drop_data_.reset(NULL); | 1067 current_drop_data_.reset(NULL); |
1065 return; | 1068 return; |
1066 } | 1069 } |
1067 | 1070 |
1068 if (drag_dest_delegate_) | 1071 if (drag_dest_delegate_) |
1069 drag_dest_delegate_->DragInitialize(web_contents_); | 1072 drag_dest_delegate_->DragInitialize(web_contents_); |
1070 | 1073 |
1071 gfx::Point screen_pt = display::Screen::GetScreen()->GetCursorScreenPoint(); | 1074 gfx::Point screen_pt = display::Screen::GetScreen()->GetCursorScreenPoint(); |
1072 web_contents_->GetRenderViewHost()->DragTargetDragEnter( | 1075 web_contents_->GetRenderViewHost()->DragTargetDragEnter( |
1073 *current_drop_data_.get(), event.location(), screen_pt, op, | 1076 *current_drop_data_, event.location(), screen_pt, op, |
1074 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1077 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
1075 | 1078 |
1076 if (drag_dest_delegate_) { | 1079 if (drag_dest_delegate_) { |
1077 drag_dest_delegate_->OnReceiveDragData(event.data()); | 1080 drag_dest_delegate_->OnReceiveDragData(event.data()); |
1078 drag_dest_delegate_->OnDragEnter(); | 1081 drag_dest_delegate_->OnDragEnter(); |
1079 } | 1082 } |
1080 } | 1083 } |
1081 | 1084 |
1082 int WebContentsViewAura::OnDragUpdated(const ui::DropTargetEvent& event) { | 1085 int WebContentsViewAura::OnDragUpdated(const ui::DropTargetEvent& event) { |
1083 DCHECK(current_rvh_for_drag_); | 1086 DCHECK(current_rvh_for_drag_); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 | 1119 |
1117 int WebContentsViewAura::OnPerformDrop(const ui::DropTargetEvent& event) { | 1120 int WebContentsViewAura::OnPerformDrop(const ui::DropTargetEvent& event) { |
1118 DCHECK(current_rvh_for_drag_); | 1121 DCHECK(current_rvh_for_drag_); |
1119 if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost()) | 1122 if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost()) |
1120 OnDragEntered(event); | 1123 OnDragEntered(event); |
1121 | 1124 |
1122 if (!current_drop_data_) | 1125 if (!current_drop_data_) |
1123 return ui::DragDropTypes::DRAG_NONE; | 1126 return ui::DragDropTypes::DRAG_NONE; |
1124 | 1127 |
1125 web_contents_->GetRenderViewHost()->DragTargetDrop( | 1128 web_contents_->GetRenderViewHost()->DragTargetDrop( |
1126 event.location(), display::Screen::GetScreen()->GetCursorScreenPoint(), | 1129 *current_drop_data_, event.location(), |
| 1130 display::Screen::GetScreen()->GetCursorScreenPoint(), |
1127 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1131 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
1128 if (drag_dest_delegate_) | 1132 if (drag_dest_delegate_) |
1129 drag_dest_delegate_->OnDrop(); | 1133 drag_dest_delegate_->OnDrop(); |
1130 current_drop_data_.reset(); | 1134 current_drop_data_.reset(); |
1131 return ConvertFromWeb(current_drag_op_); | 1135 return ConvertFromWeb(current_drag_op_); |
1132 } | 1136 } |
1133 | 1137 |
1134 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window, | 1138 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window, |
1135 bool visible) { | 1139 bool visible) { |
1136 // Ignore any visibility changes in the hierarchy below. | 1140 // Ignore any visibility changes in the hierarchy below. |
(...skipping 14 matching lines...) Expand all Loading... |
1151 bool allow_multiple_selection) { | 1155 bool allow_multiple_selection) { |
1152 NOTIMPLEMENTED() << " show " << items.size() << " menu items"; | 1156 NOTIMPLEMENTED() << " show " << items.size() << " menu items"; |
1153 } | 1157 } |
1154 | 1158 |
1155 void WebContentsViewAura::HidePopupMenu() { | 1159 void WebContentsViewAura::HidePopupMenu() { |
1156 NOTIMPLEMENTED(); | 1160 NOTIMPLEMENTED(); |
1157 } | 1161 } |
1158 #endif | 1162 #endif |
1159 | 1163 |
1160 } // namespace content | 1164 } // namespace content |
OLD | NEW |