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

Issue 271056: Do some cleanup of file path name handling. (Closed)

Created:
11 years, 2 months ago by brettw
Modified:
9 years, 7 months ago
Reviewers:
Evan Martin
CC:
chromium-reviews_googlegroups.com, brettw+cc_chromium.org, ben+cc_chromium.org, John Grabowski, Paul Godavari, jam, pam+watch_chromium.org, darin (slow to review)
Visibility:
Public.

Description

Do some cleanup of file path name handling. This started trying to cleanup DownloadManager::GenerateFilename which asserts if your system locale isn't UTF-8 (I ran into this when mine got messed up). The solution is to have GetSuggestedFilename return a FilePath rather than calling FromWStringHack. The rest of the patch is a result of trying to write GetSuggestedFilename in a reasonable way. I changed ReplaceIllegalCharacters to work on a FilePath::StringType. Some places in the code calling these functions got cleaner, some got messier. I think overall the ones that got messier are the ones doing sketchy things with paths and the ones that got cleaner are the ones doing things more properly. The only code here that gets called a nontrivial number of times is the weburlloader, and I think the new code does about the same number of string conversions overall (though on certain platforms the number will be higher or lower). BUG=none TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=29832

Patch Set 1 #

Total comments: 12

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Total comments: 3

Patch Set 7 : '' #

Patch Set 8 : '' #

Patch Set 9 : '' #

Patch Set 10 : '' #

Patch Set 11 : '' #

Patch Set 12 : '' #

Patch Set 13 : '' #

Patch Set 14 : '' #

Patch Set 15 : '' #

Patch Set 16 : '' #

Patch Set 17 : '' #

Patch Set 18 : '' #

Patch Set 19 : '' #

Patch Set 20 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+223 lines, -151 lines) Patch
M app/os_exchange_data_provider_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +3 lines, -3 lines 0 comments Download
M base/i18n/file_util_icu.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +5 lines, -3 lines 0 comments Download
M base/i18n/file_util_icu.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +32 lines, -35 lines 0 comments Download
M base/i18n/file_util_icu_unittest.cc View 5 6 7 8 9 10 11 12 13 14 4 chunks +40 lines, -6 lines 0 comments Download
M chrome/browser/bookmarks/bookmark_utils.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/cocoa/web_drag_source.mm View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/download/download_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +4 lines, -5 lines 0 comments Download
M chrome/browser/download/save_package.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +6 lines, -10 lines 0 comments Download
M chrome/browser/shell_integration_linux.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +4 lines, -6 lines 0 comments Download
M chrome/browser/views/new_profile_dialog.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +8 lines, -6 lines 0 comments Download
M chrome/browser/views/tab_contents/tab_contents_view_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +6 lines, -4 lines 0 comments Download
M net/base/net_util.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 4 chunks +14 lines, -11 lines 0 comments Download
M net/base/net_util.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +48 lines, -24 lines 0 comments Download
M net/base/net_util_unittest.cc View 7 8 9 10 11 12 13 14 15 16 17 18 19 4 chunks +36 lines, -31 lines 0 comments Download
M printing/printed_document.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +7 lines, -1 line 0 comments Download
M printing/printing_context_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M webkit/glue/weburlloader_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +7 lines, -2 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
brettw
11 years, 2 months ago (2009-10-12 18:48:13 UTC) #1
Evan Martin
http://codereview.chromium.org/271056/diff/1/11 File base/i18n/file_util_icu.cc (left): http://codereview.chromium.org/271056/diff/1/11#oldcode170 Line 170: #endif Beautiful. http://codereview.chromium.org/271056/diff/1/15 File chrome/browser/shell_integration_linux.cc (right): http://codereview.chromium.org/271056/diff/1/15#newcode301 Line ...
11 years, 2 months ago (2009-10-12 19:02:49 UTC) #2
brettw
http://codereview.chromium.org/271056/diff/1/11 File base/i18n/file_util_icu.cc (right): http://codereview.chromium.org/271056/diff/1/11#newcode142 Line 142: U8_NEXT(file_name->data(), cursor, file_name->length(), code_point); Actually, I have a ...
11 years, 2 months ago (2009-10-12 19:22:48 UTC) #3
Evan Martin
http://codereview.chromium.org/271056/diff/1/11 File base/i18n/file_util_icu.cc (right): http://codereview.chromium.org/271056/diff/1/11#newcode142 Line 142: U8_NEXT(file_name->data(), cursor, file_name->length(), code_point); On 2009/10/12 19:22:48, brettw ...
11 years, 2 months ago (2009-10-12 19:36:00 UTC) #4
brettw
Please take another look. GetSuggestedFilename has been modified to do no UTF validation on Linux, ...
11 years, 2 months ago (2009-10-14 16:46:36 UTC) #5
Evan Martin
My substr observation makes me wonder whether this should be using string16 instead of FilePath. ...
11 years, 2 months ago (2009-10-14 17:21:59 UTC) #6
brettw
New snap up http://codereview.chromium.org/271056/diff/7003/3041 File chrome/browser/views/tab_contents/tab_contents_view_win.cc (right): http://codereview.chromium.org/271056/diff/7003/3041#newcode145 Line 145: 0, MAX_PATH - drop_data.file_extension.size() - ...
11 years, 2 months ago (2009-10-15 15:44:02 UTC) #7
brettw
New new snap up with the bug exposed by the mac unittests fixed.
11 years, 2 months ago (2009-10-19 17:10:54 UTC) #8
Evan Martin
OK (hard to review diffs across 12 iterations of a patch)
11 years, 2 months ago (2009-10-19 17:13:05 UTC) #9
Evan Martin
11 years, 2 months ago (2009-10-19 17:13:20 UTC) #10
On 2009/10/19 17:13:05, Evan Martin wrote:
> (hard to review diffs across 12 iterations of a patch)

^^^ by that i mean, i feel sorry for you and impressed you persevered

Powered by Google App Engine
This is Rietveld 408576698