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

Side by Side Diff: ui/base/dragdrop/os_exchange_data_provider_win.cc

Issue 2824773002: Rename ScopedComPtr::get() to ScopedComPtr::Get() (Closed)
Patch Set: Update to 5293966 Created 3 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 "ui/base/dragdrop/os_exchange_data_provider_win.h" 5 #include "ui/base/dragdrop/os_exchange_data_provider_win.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>( 397 data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>(
398 Clipboard::GetHtmlFormatType().ToFormatEtc(), storage)); 398 Clipboard::GetHtmlFormatType().ToFormatEtc(), storage));
399 399
400 STGMEDIUM* storage_plain = GetStorageForBytes(utf8_html.c_str(), 400 STGMEDIUM* storage_plain = GetStorageForBytes(utf8_html.c_str(),
401 utf8_html.size()); 401 utf8_html.size());
402 data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>( 402 data_->contents_.push_back(base::MakeUnique<DataObjectImpl::StoredDataInfo>(
403 Clipboard::GetTextHtmlFormatType().ToFormatEtc(), storage_plain)); 403 Clipboard::GetTextHtmlFormatType().ToFormatEtc(), storage_plain));
404 } 404 }
405 405
406 bool OSExchangeDataProviderWin::GetString(base::string16* data) const { 406 bool OSExchangeDataProviderWin::GetString(base::string16* data) const {
407 return ClipboardUtil::GetPlainText(source_object_.get(), data); 407 return ClipboardUtil::GetPlainText(source_object_.Get(), data);
408 } 408 }
409 409
410 bool OSExchangeDataProviderWin::GetURLAndTitle( 410 bool OSExchangeDataProviderWin::GetURLAndTitle(
411 OSExchangeData::FilenameToURLPolicy policy, 411 OSExchangeData::FilenameToURLPolicy policy,
412 GURL* url, 412 GURL* url,
413 base::string16* title) const { 413 base::string16* title) const {
414 base::string16 url_str; 414 base::string16 url_str;
415 bool success = ClipboardUtil::GetUrl( 415 bool success = ClipboardUtil::GetUrl(
416 source_object_.get(), url, title, 416 source_object_.Get(), url, title,
417 policy == OSExchangeData::CONVERT_FILENAMES ? true : false); 417 policy == OSExchangeData::CONVERT_FILENAMES ? true : false);
418 if (success) { 418 if (success) {
419 DCHECK(url->is_valid()); 419 DCHECK(url->is_valid());
420 return true; 420 return true;
421 } else if (GetPlainTextURL(source_object_.get(), url)) { 421 } else if (GetPlainTextURL(source_object_.Get(), url)) {
422 if (url->is_valid()) 422 if (url->is_valid())
423 *title = net::GetSuggestedFilename(*url, "", "", "", "", std::string()); 423 *title = net::GetSuggestedFilename(*url, "", "", "", "", std::string());
424 else 424 else
425 title->clear(); 425 title->clear();
426 return true; 426 return true;
427 } 427 }
428 return false; 428 return false;
429 } 429 }
430 430
431 bool OSExchangeDataProviderWin::GetFilename(base::FilePath* path) const { 431 bool OSExchangeDataProviderWin::GetFilename(base::FilePath* path) const {
432 std::vector<base::string16> filenames; 432 std::vector<base::string16> filenames;
433 bool success = ClipboardUtil::GetFilenames(source_object_.get(), &filenames); 433 bool success = ClipboardUtil::GetFilenames(source_object_.Get(), &filenames);
434 if (success) 434 if (success)
435 *path = base::FilePath(filenames[0]); 435 *path = base::FilePath(filenames[0]);
436 return success; 436 return success;
437 } 437 }
438 438
439 bool OSExchangeDataProviderWin::GetFilenames( 439 bool OSExchangeDataProviderWin::GetFilenames(
440 std::vector<FileInfo>* filenames) const { 440 std::vector<FileInfo>* filenames) const {
441 std::vector<base::string16> filenames_local; 441 std::vector<base::string16> filenames_local;
442 bool success = 442 bool success =
443 ClipboardUtil::GetFilenames(source_object_.get(), &filenames_local); 443 ClipboardUtil::GetFilenames(source_object_.Get(), &filenames_local);
444 if (success) { 444 if (success) {
445 for (size_t i = 0; i < filenames_local.size(); ++i) 445 for (size_t i = 0; i < filenames_local.size(); ++i)
446 filenames->push_back( 446 filenames->push_back(
447 FileInfo(base::FilePath(filenames_local[i]), base::FilePath())); 447 FileInfo(base::FilePath(filenames_local[i]), base::FilePath()));
448 } 448 }
449 return success; 449 return success;
450 } 450 }
451 451
452 bool OSExchangeDataProviderWin::GetPickledData( 452 bool OSExchangeDataProviderWin::GetPickledData(
453 const Clipboard::FormatType& format, 453 const Clipboard::FormatType& format,
(...skipping 11 matching lines...) Expand all
465 } 465 }
466 ReleaseStgMedium(&medium); 466 ReleaseStgMedium(&medium);
467 } 467 }
468 return success; 468 return success;
469 } 469 }
470 470
471 bool OSExchangeDataProviderWin::GetFileContents( 471 bool OSExchangeDataProviderWin::GetFileContents(
472 base::FilePath* filename, 472 base::FilePath* filename,
473 std::string* file_contents) const { 473 std::string* file_contents) const {
474 base::string16 filename_str; 474 base::string16 filename_str;
475 if (!ClipboardUtil::GetFileContents(source_object_.get(), &filename_str, 475 if (!ClipboardUtil::GetFileContents(source_object_.Get(), &filename_str,
476 file_contents)) { 476 file_contents)) {
477 return false; 477 return false;
478 } 478 }
479 *filename = base::FilePath(filename_str); 479 *filename = base::FilePath(filename_str);
480 return true; 480 return true;
481 } 481 }
482 482
483 bool OSExchangeDataProviderWin::GetHtml(base::string16* html, 483 bool OSExchangeDataProviderWin::GetHtml(base::string16* html,
484 GURL* base_url) const { 484 GURL* base_url) const {
485 std::string url; 485 std::string url;
486 bool success = ClipboardUtil::GetHtml(source_object_.get(), html, &url); 486 bool success = ClipboardUtil::GetHtml(source_object_.Get(), html, &url);
487 if (success) 487 if (success)
488 *base_url = GURL(url); 488 *base_url = GURL(url);
489 return success; 489 return success;
490 } 490 }
491 491
492 bool OSExchangeDataProviderWin::HasString() const { 492 bool OSExchangeDataProviderWin::HasString() const {
493 return ClipboardUtil::HasPlainText(source_object_.get()); 493 return ClipboardUtil::HasPlainText(source_object_.Get());
494 } 494 }
495 495
496 bool OSExchangeDataProviderWin::HasURL( 496 bool OSExchangeDataProviderWin::HasURL(
497 OSExchangeData::FilenameToURLPolicy policy) const { 497 OSExchangeData::FilenameToURLPolicy policy) const {
498 return (ClipboardUtil::HasUrl( 498 return (ClipboardUtil::HasUrl(
499 source_object_.get(), 499 source_object_.Get(),
500 policy == OSExchangeData::CONVERT_FILENAMES ? true : false) || 500 policy == OSExchangeData::CONVERT_FILENAMES ? true : false) ||
501 HasPlainTextURL(source_object_.get())); 501 HasPlainTextURL(source_object_.Get()));
502 } 502 }
503 503
504 bool OSExchangeDataProviderWin::HasFile() const { 504 bool OSExchangeDataProviderWin::HasFile() const {
505 return ClipboardUtil::HasFilenames(source_object_.get()); 505 return ClipboardUtil::HasFilenames(source_object_.Get());
506 } 506 }
507 507
508 bool OSExchangeDataProviderWin::HasFileContents() const { 508 bool OSExchangeDataProviderWin::HasFileContents() const {
509 return ClipboardUtil::HasFileContents(source_object_.get()); 509 return ClipboardUtil::HasFileContents(source_object_.Get());
510 } 510 }
511 511
512 bool OSExchangeDataProviderWin::HasHtml() const { 512 bool OSExchangeDataProviderWin::HasHtml() const {
513 return ClipboardUtil::HasHtml(source_object_.get()); 513 return ClipboardUtil::HasHtml(source_object_.Get());
514 } 514 }
515 515
516 bool OSExchangeDataProviderWin::HasCustomFormat( 516 bool OSExchangeDataProviderWin::HasCustomFormat(
517 const Clipboard::FormatType& format) const { 517 const Clipboard::FormatType& format) const {
518 FORMATETC format_etc = format.ToFormatEtc(); 518 FORMATETC format_etc = format.ToFormatEtc();
519 return (source_object_->QueryGetData(&format_etc) == S_OK); 519 return (source_object_->QueryGetData(&format_etc) == S_OK);
520 } 520 }
521 521
522 void OSExchangeDataProviderWin::SetDownloadFileInfo( 522 void OSExchangeDataProviderWin::SetDownloadFileInfo(
523 const OSExchangeData::DownloadFileInfo& download) { 523 const OSExchangeData::DownloadFileInfo& download) {
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1059 std::min(file_name.size(), static_cast<size_t>(MAX_PATH - 1u))); 1059 std::min(file_name.size(), static_cast<size_t>(MAX_PATH - 1u)));
1060 1060
1061 STGMEDIUM* storage = new STGMEDIUM; 1061 STGMEDIUM* storage = new STGMEDIUM;
1062 storage->tymed = TYMED_HGLOBAL; 1062 storage->tymed = TYMED_HGLOBAL;
1063 storage->hGlobal = hdata; 1063 storage->hGlobal = hdata;
1064 storage->pUnkForRelease = NULL; 1064 storage->pUnkForRelease = NULL;
1065 return storage; 1065 return storage;
1066 } 1066 }
1067 1067
1068 } // namespace ui 1068 } // namespace ui
OLDNEW
« no previous file with comments | « ui/accessibility/platform/ax_platform_node_win_unittest.cc ('k') | ui/base/dragdrop/os_exchange_data_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698