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 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 static const std::string kInternetShortcutFileEnd = | 861 static const std::string kInternetShortcutFileEnd = |
862 "\r\n"; | 862 "\r\n"; |
863 *data = kInternetShortcutFileStart + url.spec() + kInternetShortcutFileEnd; | 863 *data = kInternetShortcutFileStart + url.spec() + kInternetShortcutFileEnd; |
864 } | 864 } |
865 | 865 |
866 static void CreateValidFileNameFromTitle(const GURL& url, | 866 static void CreateValidFileNameFromTitle(const GURL& url, |
867 const string16& title, | 867 const string16& title, |
868 string16* validated) { | 868 string16* validated) { |
869 if (title.empty()) { | 869 if (title.empty()) { |
870 if (url.is_valid()) { | 870 if (url.is_valid()) { |
871 *validated = net::GetSuggestedFilename(url, "", "", "", string16()); | 871 *validated = net::GetSuggestedFilename(url, "", "", "", "", string16()); |
872 } else { | 872 } else { |
873 // Nothing else can be done, just use a default. | 873 // Nothing else can be done, just use a default. |
874 *validated = | 874 *validated = |
875 l10n_util::GetStringUTF16(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME); | 875 l10n_util::GetStringUTF16(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME); |
876 } | 876 } |
877 } else { | 877 } else { |
878 *validated = title; | 878 *validated = title; |
879 file_util::ReplaceIllegalCharactersInPath(validated, '-'); | 879 file_util::ReplaceIllegalCharactersInPath(validated, '-'); |
880 } | 880 } |
881 static const wchar_t extension[] = L".url"; | 881 static const wchar_t extension[] = L".url"; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 return new OSExchangeDataProviderWin(); | 940 return new OSExchangeDataProviderWin(); |
941 } | 941 } |
942 | 942 |
943 // static | 943 // static |
944 OSExchangeData::CustomFormat OSExchangeData::RegisterCustomFormat( | 944 OSExchangeData::CustomFormat OSExchangeData::RegisterCustomFormat( |
945 const std::string& type) { | 945 const std::string& type) { |
946 return RegisterClipboardFormat(ASCIIToUTF16(type).c_str()); | 946 return RegisterClipboardFormat(ASCIIToUTF16(type).c_str()); |
947 } | 947 } |
948 | 948 |
949 } // namespace ui | 949 } // namespace ui |
OLD | NEW |