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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 ui::OSExchangeData::DownloadFileInfo file_download(base::FilePath(), | 320 ui::OSExchangeData::DownloadFileInfo file_download(base::FilePath(), |
321 download_file.get()); | 321 download_file.get()); |
322 provider->SetDownloadFileInfo(file_download); | 322 provider->SetDownloadFileInfo(file_download); |
323 } | 323 } |
324 #endif | 324 #endif |
325 | 325 |
326 // Utility to fill a ui::OSExchangeDataProvider object from DropData. | 326 // Utility to fill a ui::OSExchangeDataProvider object from DropData. |
327 void PrepareDragData(const DropData& drop_data, | 327 void PrepareDragData(const DropData& drop_data, |
328 ui::OSExchangeData::Provider* provider, | 328 ui::OSExchangeData::Provider* provider, |
329 WebContentsImpl* web_contents) { | 329 WebContentsImpl* web_contents) { |
| 330 provider->MarkOriginatedFromRenderer(); |
330 #if defined(OS_WIN) | 331 #if defined(OS_WIN) |
331 // Put download before file contents to prefer the download of a image over | 332 // Put download before file contents to prefer the download of a image over |
332 // its thumbnail link. | 333 // its thumbnail link. |
333 if (!drop_data.download_metadata.empty()) | 334 if (!drop_data.download_metadata.empty()) |
334 PrepareDragForDownload(drop_data, provider, web_contents); | 335 PrepareDragForDownload(drop_data, provider, web_contents); |
335 // We set the file contents before the URL because the URL also sets file | 336 // We set the file contents before the URL because the URL also sets file |
336 // contents (to a .URL shortcut). We want to prefer file content data over | 337 // contents (to a .URL shortcut). We want to prefer file content data over |
337 // a shortcut so we add it first. | 338 // a shortcut so we add it first. |
338 if (!drop_data.file_contents.empty()) | 339 if (!drop_data.file_contents.empty()) |
339 PrepareDragForFileContents(drop_data, provider); | 340 PrepareDragForFileContents(drop_data, provider); |
(...skipping 20 matching lines...) Expand all Loading... |
360 if (!drop_data.custom_data.empty()) { | 361 if (!drop_data.custom_data.empty()) { |
361 Pickle pickle; | 362 Pickle pickle; |
362 ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle); | 363 ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle); |
363 provider->SetPickledData(ui::Clipboard::GetWebCustomDataFormatType(), | 364 provider->SetPickledData(ui::Clipboard::GetWebCustomDataFormatType(), |
364 pickle); | 365 pickle); |
365 } | 366 } |
366 } | 367 } |
367 | 368 |
368 // Utility to fill a DropData object from ui::OSExchangeData. | 369 // Utility to fill a DropData object from ui::OSExchangeData. |
369 void PrepareDropData(DropData* drop_data, const ui::OSExchangeData& data) { | 370 void PrepareDropData(DropData* drop_data, const ui::OSExchangeData& data) { |
| 371 drop_data->did_originate_from_renderer = data.DidOriginateFromRenderer(); |
| 372 |
370 base::string16 plain_text; | 373 base::string16 plain_text; |
371 data.GetString(&plain_text); | 374 data.GetString(&plain_text); |
372 if (!plain_text.empty()) | 375 if (!plain_text.empty()) |
373 drop_data->text = base::NullableString16(plain_text, false); | 376 drop_data->text = base::NullableString16(plain_text, false); |
374 | 377 |
375 GURL url; | 378 GURL url; |
376 base::string16 url_title; | 379 base::string16 url_title; |
377 data.GetURLAndTitle( | 380 data.GetURLAndTitle( |
378 ui::OSExchangeData::DO_NOT_CONVERT_FILENAMES, &url, &url_title); | 381 ui::OSExchangeData::DO_NOT_CONVERT_FILENAMES, &url, &url_title); |
379 if (url.is_valid()) { | 382 if (url.is_valid()) { |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 event.location(), | 1538 event.location(), |
1536 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), | 1539 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), |
1537 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); | 1540 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); |
1538 if (drag_dest_delegate_) | 1541 if (drag_dest_delegate_) |
1539 drag_dest_delegate_->OnDrop(); | 1542 drag_dest_delegate_->OnDrop(); |
1540 current_drop_data_.reset(); | 1543 current_drop_data_.reset(); |
1541 return ConvertFromWeb(current_drag_op_); | 1544 return ConvertFromWeb(current_drag_op_); |
1542 } | 1545 } |
1543 | 1546 |
1544 } // namespace content | 1547 } // namespace content |
OLD | NEW |