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

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

Issue 212693004: Merge 259353 "Mark drags starting in web content as tainted to a..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1847/src/
Patch Set: Created 6 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 | Annotate | Revision Log
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 "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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 ui::OSExchangeData::DownloadFileInfo file_download(base::FilePath(), 319 ui::OSExchangeData::DownloadFileInfo file_download(base::FilePath(),
320 download_file.get()); 320 download_file.get());
321 provider->SetDownloadFileInfo(file_download); 321 provider->SetDownloadFileInfo(file_download);
322 } 322 }
323 #endif 323 #endif
324 324
325 // Utility to fill a ui::OSExchangeDataProvider object from DropData. 325 // Utility to fill a ui::OSExchangeDataProvider object from DropData.
326 void PrepareDragData(const DropData& drop_data, 326 void PrepareDragData(const DropData& drop_data,
327 ui::OSExchangeData::Provider* provider, 327 ui::OSExchangeData::Provider* provider,
328 WebContentsImpl* web_contents) { 328 WebContentsImpl* web_contents) {
329 provider->MarkOriginatedFromRenderer();
329 #if defined(OS_WIN) 330 #if defined(OS_WIN)
330 // Put download before file contents to prefer the download of a image over 331 // Put download before file contents to prefer the download of a image over
331 // its thumbnail link. 332 // its thumbnail link.
332 if (!drop_data.download_metadata.empty()) 333 if (!drop_data.download_metadata.empty())
333 PrepareDragForDownload(drop_data, provider, web_contents); 334 PrepareDragForDownload(drop_data, provider, web_contents);
334 // We set the file contents before the URL because the URL also sets file 335 // We set the file contents before the URL because the URL also sets file
335 // contents (to a .URL shortcut). We want to prefer file content data over 336 // contents (to a .URL shortcut). We want to prefer file content data over
336 // a shortcut so we add it first. 337 // a shortcut so we add it first.
337 if (!drop_data.file_contents.empty()) 338 if (!drop_data.file_contents.empty())
338 PrepareDragForFileContents(drop_data, provider); 339 PrepareDragForFileContents(drop_data, provider);
(...skipping 20 matching lines...) Expand all
359 if (!drop_data.custom_data.empty()) { 360 if (!drop_data.custom_data.empty()) {
360 Pickle pickle; 361 Pickle pickle;
361 ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle); 362 ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle);
362 provider->SetPickledData(ui::Clipboard::GetWebCustomDataFormatType(), 363 provider->SetPickledData(ui::Clipboard::GetWebCustomDataFormatType(),
363 pickle); 364 pickle);
364 } 365 }
365 } 366 }
366 367
367 // Utility to fill a DropData object from ui::OSExchangeData. 368 // Utility to fill a DropData object from ui::OSExchangeData.
368 void PrepareDropData(DropData* drop_data, const ui::OSExchangeData& data) { 369 void PrepareDropData(DropData* drop_data, const ui::OSExchangeData& data) {
370 drop_data->did_originate_from_renderer = data.DidOriginateFromRenderer();
371
369 base::string16 plain_text; 372 base::string16 plain_text;
370 data.GetString(&plain_text); 373 data.GetString(&plain_text);
371 if (!plain_text.empty()) 374 if (!plain_text.empty())
372 drop_data->text = base::NullableString16(plain_text, false); 375 drop_data->text = base::NullableString16(plain_text, false);
373 376
374 GURL url; 377 GURL url;
375 base::string16 url_title; 378 base::string16 url_title;
376 data.GetURLAndTitle( 379 data.GetURLAndTitle(
377 ui::OSExchangeData::DO_NOT_CONVERT_FILENAMES, &url, &url_title); 380 ui::OSExchangeData::DO_NOT_CONVERT_FILENAMES, &url, &url_title);
378 if (url.is_valid()) { 381 if (url.is_valid()) {
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 event.location(), 1518 event.location(),
1516 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(), 1519 gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(),
1517 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags())); 1520 ConvertAuraEventFlagsToWebInputEventModifiers(event.flags()));
1518 if (drag_dest_delegate_) 1521 if (drag_dest_delegate_)
1519 drag_dest_delegate_->OnDrop(); 1522 drag_dest_delegate_->OnDrop();
1520 current_drop_data_.reset(); 1523 current_drop_data_.reset();
1521 return ConvertFromWeb(current_drag_op_); 1524 return ConvertFromWeb(current_drag_op_);
1522 } 1525 }
1523 1526
1524 } // namespace content 1527 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | content/browser/web_contents/web_drag_dest_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698