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/memory/scoped_handle.h" | 10 #include "base/memory/scoped_handle.h" |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 static const std::string kInternetShortcutFileEnd = | 841 static const std::string kInternetShortcutFileEnd = |
842 "\r\n"; | 842 "\r\n"; |
843 *data = kInternetShortcutFileStart + url.spec() + kInternetShortcutFileEnd; | 843 *data = kInternetShortcutFileStart + url.spec() + kInternetShortcutFileEnd; |
844 } | 844 } |
845 | 845 |
846 static void CreateValidFileNameFromTitle(const GURL& url, | 846 static void CreateValidFileNameFromTitle(const GURL& url, |
847 const string16& title, | 847 const string16& title, |
848 string16* validated) { | 848 string16* validated) { |
849 if (title.empty()) { | 849 if (title.empty()) { |
850 if (url.is_valid()) { | 850 if (url.is_valid()) { |
851 *validated = net::GetSuggestedFilename(url, "", "", string16()); | 851 *validated = net::GetSuggestedFilename(url, "", "", "", string16()); |
852 } else { | 852 } else { |
853 // Nothing else can be done, just use a default. | 853 // Nothing else can be done, just use a default. |
854 *validated = | 854 *validated = |
855 l10n_util::GetStringUTF16(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME); | 855 l10n_util::GetStringUTF16(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME); |
856 } | 856 } |
857 } else { | 857 } else { |
858 *validated = title; | 858 *validated = title; |
859 file_util::ReplaceIllegalCharactersInPath(validated, '-'); | 859 file_util::ReplaceIllegalCharactersInPath(validated, '-'); |
860 } | 860 } |
861 static const wchar_t extension[] = L".url"; | 861 static const wchar_t extension[] = L".url"; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 return new OSExchangeDataProviderWin(); | 920 return new OSExchangeDataProviderWin(); |
921 } | 921 } |
922 | 922 |
923 // static | 923 // static |
924 OSExchangeData::CustomFormat OSExchangeData::RegisterCustomFormat( | 924 OSExchangeData::CustomFormat OSExchangeData::RegisterCustomFormat( |
925 const std::string& type) { | 925 const std::string& type) { |
926 return RegisterClipboardFormat(ASCIIToUTF16(type).c_str()); | 926 return RegisterClipboardFormat(ASCIIToUTF16(type).c_str()); |
927 } | 927 } |
928 | 928 |
929 } // namespace ui | 929 } // namespace ui |
OLD | NEW |