OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/i18n/file_util_icu.h" | 8 #include "base/i18n/file_util_icu.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 static const std::string kInternetShortcutFileEnd = | 837 static const std::string kInternetShortcutFileEnd = |
838 "\r\n"; | 838 "\r\n"; |
839 *data = kInternetShortcutFileStart + url.spec() + kInternetShortcutFileEnd; | 839 *data = kInternetShortcutFileStart + url.spec() + kInternetShortcutFileEnd; |
840 } | 840 } |
841 | 841 |
842 static void CreateValidFileNameFromTitle(const GURL& url, | 842 static void CreateValidFileNameFromTitle(const GURL& url, |
843 const std::wstring& title, | 843 const std::wstring& title, |
844 std::wstring* validated) { | 844 std::wstring* validated) { |
845 if (title.empty()) { | 845 if (title.empty()) { |
846 if (url.is_valid()) { | 846 if (url.is_valid()) { |
847 *validated = net::GetSuggestedFilename( | 847 *validated = UTF16ToWide( |
848 url, std::string(), std::string(), FilePath()).ToWStringHack(); | 848 net::GetSuggestedFilename(url, "", "", string16())); |
849 } else { | 849 } else { |
850 // Nothing else can be done, just use a default. | 850 // Nothing else can be done, just use a default. |
851 *validated = | 851 *validated = |
852 l10n_util::GetStringUTF16(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME); | 852 l10n_util::GetStringUTF16(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME); |
853 } | 853 } |
854 } else { | 854 } else { |
855 *validated = title; | 855 *validated = title; |
856 file_util::ReplaceIllegalCharactersInPath(validated, '-'); | 856 file_util::ReplaceIllegalCharactersInPath(validated, '-'); |
857 } | 857 } |
858 static const wchar_t extension[] = L".url"; | 858 static const wchar_t extension[] = L".url"; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 return new OSExchangeDataProviderWin(); | 916 return new OSExchangeDataProviderWin(); |
917 } | 917 } |
918 | 918 |
919 // static | 919 // static |
920 OSExchangeData::CustomFormat OSExchangeData::RegisterCustomFormat( | 920 OSExchangeData::CustomFormat OSExchangeData::RegisterCustomFormat( |
921 const std::string& type) { | 921 const std::string& type) { |
922 return RegisterClipboardFormat(ASCIIToWide(type).c_str()); | 922 return RegisterClipboardFormat(ASCIIToWide(type).c_str()); |
923 } | 923 } |
924 | 924 |
925 } // namespace ui | 925 } // namespace ui |
OLD | NEW |