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

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: add is_valid to dropdata Created 4 years, 9 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 if (!drop_data.custom_data.empty()) { 310 if (!drop_data.custom_data.empty()) {
311 base::Pickle pickle; 311 base::Pickle pickle;
312 ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle); 312 ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle);
313 provider->SetPickledData(ui::Clipboard::GetWebCustomDataFormatType(), 313 provider->SetPickledData(ui::Clipboard::GetWebCustomDataFormatType(),
314 pickle); 314 pickle);
315 } 315 }
316 } 316 }
317 317
318 // Utility to fill a DropData object from ui::OSExchangeData. 318 // Utility to fill a DropData object from ui::OSExchangeData.
319 void PrepareDropData(DropData* drop_data, const ui::OSExchangeData& data) { 319 void PrepareDropData(DropData* drop_data, const ui::OSExchangeData& data) {
320 drop_data->is_valid = true;
320 drop_data->did_originate_from_renderer = data.DidOriginateFromRenderer(); 321 drop_data->did_originate_from_renderer = data.DidOriginateFromRenderer();
321 322
322 base::string16 plain_text; 323 base::string16 plain_text;
323 data.GetString(&plain_text); 324 data.GetString(&plain_text);
324 if (!plain_text.empty()) 325 if (!plain_text.empty())
325 drop_data->text = base::NullableString16(plain_text, false); 326 drop_data->text = base::NullableString16(plain_text, false);
326 327
327 GURL url; 328 GURL url;
328 base::string16 url_title; 329 base::string16 url_title;
329 data.GetURLAndTitle( 330 data.GetURLAndTitle(
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 1278
1278 int WebContentsViewAura::OnPerformDrop(const ui::DropTargetEvent& event) { 1279 int WebContentsViewAura::OnPerformDrop(const ui::DropTargetEvent& event) {
1279 DCHECK(current_rvh_for_drag_); 1280 DCHECK(current_rvh_for_drag_);
1280 if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost()) 1281 if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost())
1281 OnDragEntered(event); 1282 OnDragEntered(event);
1282 1283
1283 if (!current_drop_data_) 1284 if (!current_drop_data_)
1284 return ui::DragDropTypes::DRAG_NONE; 1285 return ui::DragDropTypes::DRAG_NONE;
1285 1286
1286 web_contents_->GetRenderViewHost()->DragTargetDrop( 1287 web_contents_->GetRenderViewHost()->DragTargetDrop(
1287 event.location(), gfx::Screen::GetScreen()->GetCursorScreenPoint(), 1288 DropData(), event.location(),
1289 gfx::Screen::GetScreen()->GetCursorScreenPoint(),
1288 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); 1290 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags()));
1289 if (drag_dest_delegate_) 1291 if (drag_dest_delegate_)
1290 drag_dest_delegate_->OnDrop(); 1292 drag_dest_delegate_->OnDrop();
1291 current_drop_data_.reset(); 1293 current_drop_data_.reset();
1292 return ConvertFromWeb(current_drag_op_); 1294 return ConvertFromWeb(current_drag_op_);
1293 } 1295 }
1294 1296
1295 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window, 1297 void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window,
1296 bool visible) { 1298 bool visible) {
1297 // Ignore any visibility changes in the hierarchy below. 1299 // Ignore any visibility changes in the hierarchy below.
(...skipping 20 matching lines...) Expand all
1318 if (visible) { 1320 if (visible) {
1319 if (!web_contents_->should_normally_be_visible()) 1321 if (!web_contents_->should_normally_be_visible())
1320 web_contents_->WasShown(); 1322 web_contents_->WasShown();
1321 } else { 1323 } else {
1322 if (web_contents_->should_normally_be_visible()) 1324 if (web_contents_->should_normally_be_visible())
1323 web_contents_->WasHidden(); 1325 web_contents_->WasHidden();
1324 } 1326 }
1325 } 1327 }
1326 1328
1327 } // namespace content 1329 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698