| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <shlobj.h> | 5 #include <shlobj.h> |
| 6 | 6 |
| 7 #include "chrome/common/os_exchange_data.h" | 7 #include "chrome/common/os_exchange_data.h" |
| 8 | 8 |
| 9 #include "base/clipboard_util.h" | 9 #include "base/clipboard_util.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 "\r\n"; | 661 "\r\n"; |
| 662 *data = kInternetShortcutFileStart + url.spec() + kInternetShortcutFileEnd; | 662 *data = kInternetShortcutFileStart + url.spec() + kInternetShortcutFileEnd; |
| 663 } | 663 } |
| 664 | 664 |
| 665 static void CreateValidFileNameFromTitle(const GURL& url, | 665 static void CreateValidFileNameFromTitle(const GURL& url, |
| 666 const std::wstring& title, | 666 const std::wstring& title, |
| 667 std::wstring* validated) { | 667 std::wstring* validated) { |
| 668 if (title.empty()) { | 668 if (title.empty()) { |
| 669 if (url.is_valid()) { | 669 if (url.is_valid()) { |
| 670 *validated = net::GetSuggestedFilename( | 670 *validated = net::GetSuggestedFilename( |
| 671 url, std::wstring(), std::wstring()); | 671 url, std::string(), std::string(), std::wstring()); |
| 672 } else { | 672 } else { |
| 673 // Nothing else can be done, just use a default. | 673 // Nothing else can be done, just use a default. |
| 674 *validated = l10n_util::GetString(IDS_UNTITLED_SHORTCUT_FILE_NAME); | 674 *validated = l10n_util::GetString(IDS_UNTITLED_SHORTCUT_FILE_NAME); |
| 675 } | 675 } |
| 676 } else { | 676 } else { |
| 677 *validated = title; | 677 *validated = title; |
| 678 file_util::ReplaceIllegalCharacters(validated, '-'); | 678 file_util::ReplaceIllegalCharacters(validated, '-'); |
| 679 } | 679 } |
| 680 static const wchar_t extension[] = L".url"; | 680 static const wchar_t extension[] = L".url"; |
| 681 static const size_t max_length = MAX_PATH - arraysize(extension); | 681 static const size_t max_length = MAX_PATH - arraysize(extension); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 698 descriptor->fgd[0].dwFlags = FD_LINKUI; | 698 descriptor->fgd[0].dwFlags = FD_LINKUI; |
| 699 | 699 |
| 700 GlobalUnlock(handle); | 700 GlobalUnlock(handle); |
| 701 | 701 |
| 702 STGMEDIUM* storage = new STGMEDIUM; | 702 STGMEDIUM* storage = new STGMEDIUM; |
| 703 storage->hGlobal = handle; | 703 storage->hGlobal = handle; |
| 704 storage->tymed = TYMED_HGLOBAL; | 704 storage->tymed = TYMED_HGLOBAL; |
| 705 storage->pUnkForRelease = NULL; | 705 storage->pUnkForRelease = NULL; |
| 706 return storage; | 706 return storage; |
| 707 } | 707 } |
| OLD | NEW |