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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 return ClipboardUtil::GetPlainText(source_object_, data); | 404 return ClipboardUtil::GetPlainText(source_object_, data); |
405 } | 405 } |
406 | 406 |
407 bool OSExchangeDataProviderWin::GetURLAndTitle( | 407 bool OSExchangeDataProviderWin::GetURLAndTitle( |
408 OSExchangeData::FilenameToURLPolicy policy, | 408 OSExchangeData::FilenameToURLPolicy policy, |
409 GURL* url, | 409 GURL* url, |
410 base::string16* title) const { | 410 base::string16* title) const { |
411 base::string16 url_str; | 411 base::string16 url_str; |
412 bool success = ClipboardUtil::GetUrl( | 412 bool success = ClipboardUtil::GetUrl( |
413 source_object_, | 413 source_object_, |
414 &url_str, | 414 url, |
415 title, | 415 title, |
416 policy == OSExchangeData::CONVERT_FILENAMES ? true : false); | 416 policy == OSExchangeData::CONVERT_FILENAMES ? true : false); |
417 if (success) { | 417 if (success) { |
418 GURL test_url(url_str); | 418 DCHECK(url->is_valid()); |
419 if (test_url.is_valid()) { | 419 return true; |
420 *url = test_url; | |
421 return true; | |
422 } | |
423 } else if (GetPlainTextURL(source_object_, url)) { | 420 } else if (GetPlainTextURL(source_object_, url)) { |
424 if (url->is_valid()) | 421 if (url->is_valid()) |
425 *title = net::GetSuggestedFilename(*url, "", "", "", "", std::string()); | 422 *title = net::GetSuggestedFilename(*url, "", "", "", "", std::string()); |
426 else | 423 else |
427 title->clear(); | 424 title->clear(); |
428 return true; | 425 return true; |
429 } | 426 } |
430 return false; | 427 return false; |
431 } | 428 } |
432 | 429 |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 | 1048 |
1052 /////////////////////////////////////////////////////////////////////////////// | 1049 /////////////////////////////////////////////////////////////////////////////// |
1053 // OSExchangeData, public: | 1050 // OSExchangeData, public: |
1054 | 1051 |
1055 // static | 1052 // static |
1056 OSExchangeData::Provider* OSExchangeData::CreateProvider() { | 1053 OSExchangeData::Provider* OSExchangeData::CreateProvider() { |
1057 return new OSExchangeDataProviderWin(); | 1054 return new OSExchangeDataProviderWin(); |
1058 } | 1055 } |
1059 | 1056 |
1060 } // namespace ui | 1057 } // namespace ui |
OLD | NEW |