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 "ui/base/dragdrop/os_exchange_data_provider_win.h" | 5 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 STGMEDIUM* storage_plain = GetStorageForBytes(utf8_html.c_str(), | 379 STGMEDIUM* storage_plain = GetStorageForBytes(utf8_html.c_str(), |
380 utf8_html.size()); | 380 utf8_html.size()); |
381 data_->contents_.push_back(new DataObjectImpl::StoredDataInfo( | 381 data_->contents_.push_back(new DataObjectImpl::StoredDataInfo( |
382 Clipboard::GetTextHtmlFormatType().ToFormatEtc(), storage_plain)); | 382 Clipboard::GetTextHtmlFormatType().ToFormatEtc(), storage_plain)); |
383 } | 383 } |
384 | 384 |
385 bool OSExchangeDataProviderWin::GetString(base::string16* data) const { | 385 bool OSExchangeDataProviderWin::GetString(base::string16* data) const { |
386 return ClipboardUtil::GetPlainText(source_object_, data); | 386 return ClipboardUtil::GetPlainText(source_object_, data); |
387 } | 387 } |
388 | 388 |
389 bool OSExchangeDataProviderWin::GetURLAndTitle(GURL* url, | 389 bool OSExchangeDataProviderWin::GetURLAndTitle( |
390 base::string16* title) const { | 390 OSExchangeData::FilenameToURLPolicy policy, |
| 391 GURL* url, |
| 392 base::string16* title) const { |
391 base::string16 url_str; | 393 base::string16 url_str; |
392 bool success = ClipboardUtil::GetUrl(source_object_, &url_str, title, true); | 394 bool success = ClipboardUtil::GetUrl( |
| 395 source_object_, |
| 396 &url_str, |
| 397 title, |
| 398 policy == OSExchangeData::CONVERT_FILENAMES ? true : false); |
393 if (success) { | 399 if (success) { |
394 GURL test_url(url_str); | 400 GURL test_url(url_str); |
395 if (test_url.is_valid()) { | 401 if (test_url.is_valid()) { |
396 *url = test_url; | 402 *url = test_url; |
397 return true; | 403 return true; |
398 } | 404 } |
399 } else if (GetPlainTextURL(source_object_, url)) { | 405 } else if (GetPlainTextURL(source_object_, url)) { |
400 if (url->is_valid()) | 406 if (url->is_valid()) |
401 *title = net::GetSuggestedFilename(*url, "", "", "", "", std::string()); | 407 *title = net::GetSuggestedFilename(*url, "", "", "", "", std::string()); |
402 else | 408 else |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 | 1039 |
1034 /////////////////////////////////////////////////////////////////////////////// | 1040 /////////////////////////////////////////////////////////////////////////////// |
1035 // OSExchangeData, public: | 1041 // OSExchangeData, public: |
1036 | 1042 |
1037 // static | 1043 // static |
1038 OSExchangeData::Provider* OSExchangeData::CreateProvider() { | 1044 OSExchangeData::Provider* OSExchangeData::CreateProvider() { |
1039 return new OSExchangeDataProviderWin(); | 1045 return new OSExchangeDataProviderWin(); |
1040 } | 1046 } |
1041 | 1047 |
1042 } // namespace ui | 1048 } // namespace ui |
OLD | NEW |