Chromium Code Reviews| 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 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1123 !web_contents_->GetDelegate()->CanDragEnter( | 1123 !web_contents_->GetDelegate()->CanDragEnter( |
| 1124 web_contents_, *current_drop_data_.get(), op)) { | 1124 web_contents_, *current_drop_data_.get(), op)) { |
| 1125 current_drop_data_.reset(NULL); | 1125 current_drop_data_.reset(NULL); |
| 1126 return; | 1126 return; |
| 1127 } | 1127 } |
| 1128 | 1128 |
| 1129 if (drag_dest_delegate_) | 1129 if (drag_dest_delegate_) |
| 1130 drag_dest_delegate_->DragInitialize(web_contents_); | 1130 drag_dest_delegate_->DragInitialize(web_contents_); |
| 1131 | 1131 |
| 1132 gfx::Point screen_pt = display::Screen::GetScreen()->GetCursorScreenPoint(); | 1132 gfx::Point screen_pt = display::Screen::GetScreen()->GetCursorScreenPoint(); |
| 1133 web_contents_->GetRenderViewHost()->DragTargetDragEnter( | 1133 web_contents_->GetRenderViewHost()->GetWidget()->DragTargetDragEnter( |
| 1134 *current_drop_data_, event.location(), screen_pt, op, | 1134 *current_drop_data_, event.location(), screen_pt, op, |
| 1135 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1135 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
| 1136 | 1136 |
| 1137 if (drag_dest_delegate_) { | 1137 if (drag_dest_delegate_) { |
| 1138 drag_dest_delegate_->OnReceiveDragData(event.data()); | 1138 drag_dest_delegate_->OnReceiveDragData(event.data()); |
| 1139 drag_dest_delegate_->OnDragEnter(); | 1139 drag_dest_delegate_->OnDragEnter(); |
| 1140 } | 1140 } |
| 1141 } | 1141 } |
| 1142 | 1142 |
| 1143 int WebContentsViewAura::OnDragUpdated(const ui::DropTargetEvent& event) { | 1143 int WebContentsViewAura::OnDragUpdated(const ui::DropTargetEvent& event) { |
| 1144 DCHECK(current_rvh_for_drag_); | 1144 DCHECK(current_rvh_for_drag_); |
| 1145 if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost()) | 1145 if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost()) |
| 1146 OnDragEntered(event); | 1146 OnDragEntered(event); |
| 1147 | 1147 |
| 1148 if (!current_drop_data_) | 1148 if (!current_drop_data_) |
| 1149 return ui::DragDropTypes::DRAG_NONE; | 1149 return ui::DragDropTypes::DRAG_NONE; |
| 1150 | 1150 |
| 1151 blink::WebDragOperationsMask op = ConvertToWeb(event.source_operations()); | 1151 blink::WebDragOperationsMask op = ConvertToWeb(event.source_operations()); |
| 1152 gfx::Point screen_pt = event.root_location(); | 1152 gfx::Point screen_pt = event.root_location(); |
| 1153 web_contents_->GetRenderViewHost()->DragTargetDragOver( | 1153 web_contents_->GetRenderViewHost()->GetWidget()->DragTargetDragOver( |
|
dcheng
2016/11/09 20:23:17
Ditto: worth annotating this with a TODO?
paulmeyer
2016/11/09 23:19:11
Done.
| |
| 1154 event.location(), screen_pt, op, | 1154 event.location(), screen_pt, op, |
| 1155 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1155 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
| 1156 | 1156 |
| 1157 if (drag_dest_delegate_) | 1157 if (drag_dest_delegate_) |
| 1158 drag_dest_delegate_->OnDragOver(); | 1158 drag_dest_delegate_->OnDragOver(); |
| 1159 | 1159 |
| 1160 return ConvertFromWeb(current_drag_op_); | 1160 return ConvertFromWeb(current_drag_op_); |
| 1161 } | 1161 } |
| 1162 | 1162 |
| 1163 void WebContentsViewAura::OnDragExited() { | 1163 void WebContentsViewAura::OnDragExited() { |
| 1164 DCHECK(current_rvh_for_drag_); | 1164 DCHECK(current_rvh_for_drag_); |
| 1165 if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost()) | 1165 if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost()) |
| 1166 return; | 1166 return; |
| 1167 | 1167 |
| 1168 if (!current_drop_data_) | 1168 if (!current_drop_data_) |
| 1169 return; | 1169 return; |
| 1170 | 1170 |
| 1171 web_contents_->GetRenderViewHost()->DragTargetDragLeave(); | 1171 web_contents_->GetRenderViewHost()->GetWidget()->DragTargetDragLeave(); |
| 1172 if (drag_dest_delegate_) | 1172 if (drag_dest_delegate_) |
| 1173 drag_dest_delegate_->OnDragLeave(); | 1173 drag_dest_delegate_->OnDragLeave(); |
| 1174 | 1174 |
| 1175 current_drop_data_.reset(); | 1175 current_drop_data_.reset(); |
| 1176 } | 1176 } |
| 1177 | 1177 |
| 1178 int WebContentsViewAura::OnPerformDrop(const ui::DropTargetEvent& event) { | 1178 int WebContentsViewAura::OnPerformDrop(const ui::DropTargetEvent& event) { |
| 1179 DCHECK(current_rvh_for_drag_); | 1179 DCHECK(current_rvh_for_drag_); |
| 1180 if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost()) | 1180 if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost()) |
| 1181 OnDragEntered(event); | 1181 OnDragEntered(event); |
| 1182 | 1182 |
| 1183 if (!current_drop_data_) | 1183 if (!current_drop_data_) |
| 1184 return ui::DragDropTypes::DRAG_NONE; | 1184 return ui::DragDropTypes::DRAG_NONE; |
| 1185 | 1185 |
| 1186 web_contents_->GetRenderViewHost()->DragTargetDrop( | 1186 web_contents_->GetRenderViewHost()->GetWidget()->DragTargetDrop( |
| 1187 *current_drop_data_, event.location(), | 1187 *current_drop_data_, event.location(), |
| 1188 display::Screen::GetScreen()->GetCursorScreenPoint(), | 1188 display::Screen::GetScreen()->GetCursorScreenPoint(), |
| 1189 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1189 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
| 1190 if (drag_dest_delegate_) | 1190 if (drag_dest_delegate_) |
| 1191 drag_dest_delegate_->OnDrop(); | 1191 drag_dest_delegate_->OnDrop(); |
| 1192 current_drop_data_.reset(); | 1192 current_drop_data_.reset(); |
| 1193 return ConvertFromWeb(current_drag_op_); | 1193 return ConvertFromWeb(current_drag_op_); |
| 1194 } | 1194 } |
| 1195 | 1195 |
| 1196 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window, | 1196 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window, |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1213 bool allow_multiple_selection) { | 1213 bool allow_multiple_selection) { |
| 1214 NOTIMPLEMENTED() << " show " << items.size() << " menu items"; | 1214 NOTIMPLEMENTED() << " show " << items.size() << " menu items"; |
| 1215 } | 1215 } |
| 1216 | 1216 |
| 1217 void WebContentsViewAura::HidePopupMenu() { | 1217 void WebContentsViewAura::HidePopupMenu() { |
| 1218 NOTIMPLEMENTED(); | 1218 NOTIMPLEMENTED(); |
| 1219 } | 1219 } |
| 1220 #endif | 1220 #endif |
| 1221 | 1221 |
| 1222 } // namespace content | 1222 } // namespace content |
| OLD | NEW |