Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: chrome/common/os_exchange_data.cc

Issue 83002: download filename fix (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/tab_contents/tab_contents_view_win.cc ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/tab_contents_view_win.cc ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698