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

Side by Side Diff: content/browser/web_contents/web_contents_view_aura.cc

Issue 1723763002: Add WebDragData to blink::WebView::dragtargetDrop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 unified diff | Download patch
OLDNEW
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 if (!plain_text.empty()) 324 if (!plain_text.empty())
325 drop_data->text = base::NullableString16(plain_text, false); 325 drop_data->text = base::NullableString16(plain_text, false);
326 326
327 GURL url; 327 GURL url;
328 base::string16 url_title; 328 base::string16 url_title;
329 data.GetURLAndTitle( 329 data.GetURLAndTitle(
330 ui::OSExchangeData::DO_NOT_CONVERT_FILENAMES, &url, &url_title); 330 ui::OSExchangeData::DO_NOT_CONVERT_FILENAMES, &url, &url_title);
331 if (url.is_valid()) { 331 if (url.is_valid()) {
332 drop_data->url = url; 332 drop_data->url = url;
333 drop_data->url_title = url_title; 333 drop_data->url_title = url_title;
334 drop_data->has_url = true;
334 } 335 }
335 336
336 base::string16 html; 337 base::string16 html;
337 GURL html_base_url; 338 GURL html_base_url;
338 data.GetHtml(&html, &html_base_url); 339 data.GetHtml(&html, &html_base_url);
339 if (!html.empty()) 340 if (!html.empty())
340 drop_data->html = base::NullableString16(html, false); 341 drop_data->html = base::NullableString16(html, false);
341 if (html_base_url.is_valid()) 342 if (html_base_url.is_valid())
342 drop_data->html_base_url = html_base_url; 343 drop_data->html_base_url = html_base_url;
343 344
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 } 1115 }
1115 1116
1116 int WebContentsViewAura::OnPerformDrop(const ui::DropTargetEvent& event) { 1117 int WebContentsViewAura::OnPerformDrop(const ui::DropTargetEvent& event) {
1117 DCHECK(current_rvh_for_drag_); 1118 DCHECK(current_rvh_for_drag_);
1118 if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost()) 1119 if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost())
1119 OnDragEntered(event); 1120 OnDragEntered(event);
1120 1121
1121 if (!current_drop_data_) 1122 if (!current_drop_data_)
1122 return ui::DragDropTypes::DRAG_NONE; 1123 return ui::DragDropTypes::DRAG_NONE;
1123 1124
1125 current_drop_data_.reset(new DropData());
1126
1127 PrepareDropData(current_drop_data_.get(), event.data());
1128
1124 web_contents_->GetRenderViewHost()->DragTargetDrop( 1129 web_contents_->GetRenderViewHost()->DragTargetDrop(
1125 event.location(), gfx::Screen::GetScreen()->GetCursorScreenPoint(), 1130 *current_drop_data_.get(), event.location(),
1131 gfx::Screen::GetScreen()->GetCursorScreenPoint(),
1126 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); 1132 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags()));
1127 if (drag_dest_delegate_) 1133 if (drag_dest_delegate_)
1128 drag_dest_delegate_->OnDrop(); 1134 drag_dest_delegate_->OnDrop();
1129 current_drop_data_.reset(); 1135 current_drop_data_.reset();
1130 return ConvertFromWeb(current_drag_op_); 1136 return ConvertFromWeb(current_drag_op_);
1131 } 1137 }
1132 1138
1133 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window, 1139 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window,
1134 bool visible) { 1140 bool visible) {
1135 // Ignore any visibility changes in the hierarchy below. 1141 // Ignore any visibility changes in the hierarchy below.
1136 if (window != window_.get() && window_->Contains(window)) 1142 if (window != window_.get() && window_->Contains(window))
1137 return; 1143 return;
1138 1144
1139 web_contents_->UpdateWebContentsVisibility(visible); 1145 web_contents_->UpdateWebContentsVisibility(visible);
1140 } 1146 }
1141 1147
1142 } // namespace content 1148 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698