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

Side by Side Diff: app/os_exchange_data_provider_win.cc

Issue 271056: Do some cleanup of file path name handling. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 | « no previous file | base/i18n/file_util_icu.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) 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/i18n/file_util_icu.h" 9 #include "base/i18n/file_util_icu.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 static const std::string kInternetShortcutFileEnd = 696 static const std::string kInternetShortcutFileEnd =
697 "\r\n"; 697 "\r\n";
698 *data = kInternetShortcutFileStart + url.spec() + kInternetShortcutFileEnd; 698 *data = kInternetShortcutFileStart + url.spec() + kInternetShortcutFileEnd;
699 } 699 }
700 700
701 static void CreateValidFileNameFromTitle(const GURL& url, 701 static void CreateValidFileNameFromTitle(const GURL& url,
702 const std::wstring& title, 702 const std::wstring& title,
703 std::wstring* validated) { 703 std::wstring* validated) {
704 if (title.empty()) { 704 if (title.empty()) {
705 if (url.is_valid()) { 705 if (url.is_valid()) {
706 *validated = net::GetSuggestedFilename( 706 *validated = net::GetSuggestedFilename(url, std::string(),
707 url, std::string(), std::string(), std::wstring()); 707 std::string(), "").ToWStringHack();
708 } else { 708 } else {
709 // Nothing else can be done, just use a default. 709 // Nothing else can be done, just use a default.
710 *validated = l10n_util::GetString(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME); 710 *validated = l10n_util::GetString(IDS_APP_UNTITLED_SHORTCUT_FILE_NAME);
711 } 711 }
712 } else { 712 } else {
713 *validated = title; 713 *validated = title;
714 file_util::ReplaceIllegalCharacters(validated, '-'); 714 file_util::ReplaceIllegalCharactersInPath(validated, '-');
715 } 715 }
716 static const wchar_t extension[] = L".url"; 716 static const wchar_t extension[] = L".url";
717 static const size_t max_length = MAX_PATH - arraysize(extension); 717 static const size_t max_length = MAX_PATH - arraysize(extension);
718 if (validated->size() > max_length) 718 if (validated->size() > max_length)
719 validated->erase(max_length); 719 validated->erase(max_length);
720 *validated += extension; 720 *validated += extension;
721 } 721 }
722 722
723 static STGMEDIUM* GetStorageForFileDescriptor( 723 static STGMEDIUM* GetStorageForFileDescriptor(
724 const std::wstring& valid_file_name) { 724 const std::wstring& valid_file_name) {
(...skipping 23 matching lines...) Expand all
748 // static 748 // static
749 OSExchangeData::Provider* OSExchangeData::CreateProvider() { 749 OSExchangeData::Provider* OSExchangeData::CreateProvider() {
750 return new OSExchangeDataProviderWin(); 750 return new OSExchangeDataProviderWin();
751 } 751 }
752 752
753 // static 753 // static
754 OSExchangeData::CustomFormat OSExchangeData::RegisterCustomFormat( 754 OSExchangeData::CustomFormat OSExchangeData::RegisterCustomFormat(
755 const std::string& type) { 755 const std::string& type) {
756 return RegisterClipboardFormat(ASCIIToWide(type).c_str()); 756 return RegisterClipboardFormat(ASCIIToWide(type).c_str());
757 } 757 }
OLDNEW
« no previous file with comments | « no previous file | base/i18n/file_util_icu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698