| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/os_exchange_data_provider_win.h" | 5 #include "app/os_exchange_data_provider_win.h" |
| 6 | 6 |
| 7 #include "app/clipboard/clipboard_util_win.h" | 7 #include "app/clipboard/clipboard_util_win.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "base/file_path.h" |
| 9 #include "base/i18n/file_util_icu.h" | 10 #include "base/i18n/file_util_icu.h" |
| 10 #include "base/logging.h" | 11 #include "base/logging.h" |
| 11 #include "base/pickle.h" | 12 #include "base/pickle.h" |
| 12 #include "base/scoped_handle.h" | 13 #include "base/scoped_handle.h" |
| 13 #include "base/stl_util-inl.h" | 14 #include "base/stl_util-inl.h" |
| 14 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 15 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 16 #include "grit/app_strings.h" | 17 #include "grit/app_strings.h" |
| 17 #include "net/base/net_util.h" | 18 #include "net/base/net_util.h" |
| 18 | 19 |
| (...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 static const std::string kInternetShortcutFileEnd = | 697 static const std::string kInternetShortcutFileEnd = |
| 697 "\r\n"; | 698 "\r\n"; |
| 698 *data = kInternetShortcutFileStart + url.spec() + kInternetShortcutFileEnd; | 699 *data = kInternetShortcutFileStart + url.spec() + kInternetShortcutFileEnd; |
| 699 } | 700 } |
| 700 | 701 |
| 701 static void CreateValidFileNameFromTitle(const GURL& url, | 702 static void CreateValidFileNameFromTitle(const GURL& url, |
| 702 const std::wstring& title, | 703 const std::wstring& title, |
| 703 std::wstring* validated) { | 704 std::wstring* validated) { |
| 704 if (title.empty()) { | 705 if (title.empty()) { |
| 705 if (url.is_valid()) { | 706 if (url.is_valid()) { |
| 706 *validated = net::GetSuggestedFilename(url, std::string(), | 707 *validated = net::GetSuggestedFilename( |
| 707 std::string(), "").ToWStringHack(); | 708 url, std::string(), std::string(), FilePath()).ToWStringHack(); |
| 708 } else { | 709 } else { |
| 709 // Nothing else can be done, just use a default. | 710 // Nothing else can be done, just use a default. |
| 710 *validated = l10n_util::GetString(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME); | 711 *validated = l10n_util::GetString(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME); |
| 711 } | 712 } |
| 712 } else { | 713 } else { |
| 713 *validated = title; | 714 *validated = title; |
| 714 file_util::ReplaceIllegalCharactersInPath(validated, '-'); | 715 file_util::ReplaceIllegalCharactersInPath(validated, '-'); |
| 715 } | 716 } |
| 716 static const wchar_t extension[] = L".url"; | 717 static const wchar_t extension[] = L".url"; |
| 717 static const size_t max_length = MAX_PATH - arraysize(extension); | 718 static const size_t max_length = MAX_PATH - arraysize(extension); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 748 // static | 749 // static |
| 749 OSExchangeData::Provider* OSExchangeData::CreateProvider() { | 750 OSExchangeData::Provider* OSExchangeData::CreateProvider() { |
| 750 return new OSExchangeDataProviderWin(); | 751 return new OSExchangeDataProviderWin(); |
| 751 } | 752 } |
| 752 | 753 |
| 753 // static | 754 // static |
| 754 OSExchangeData::CustomFormat OSExchangeData::RegisterCustomFormat( | 755 OSExchangeData::CustomFormat OSExchangeData::RegisterCustomFormat( |
| 755 const std::string& type) { | 756 const std::string& type) { |
| 756 return RegisterClipboardFormat(ASCIIToWide(type).c_str()); | 757 return RegisterClipboardFormat(ASCIIToWide(type).c_str()); |
| 757 } | 758 } |
| OLD | NEW |