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

Issue 149796: Bug fix for 10876, file extension handling refactoring (Closed)

Created:
11 years, 5 months ago by Roland
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com, darin (slow to review), brettw, Paul Godavari, willchan no longer on Chromium, Ben Goodger (Google), Nico, brettw+cc_chromium.org, ben+cc_chromium.org, Paweł Hajdan Jr.
Visibility:
Public.

Description

Fix for bug 10876 that resulted in some refactoring: The bug originates from extensions being treated case sensitive on Windows and Mac OSX, where they shouldn't be. Therefore I added generic static methods to FilePath to compare strings in the same way the file system does, and changed the relevant parts of the code to make use of them. I tested the methods under Windows and Mac OS X. I also wrote a basic version for Linux/Posix that behaves the same way as the original code, so there should at least be no regression. Also, while fixing this I found some confusion in the code about whether extensions are used with or without leading dot. For this reason I changed some functions that were taking an extension as parameter to instead take the whole file path. This makes calling these functions easier and the caller doesn't need to know whether the extension is supposed to be with or without dot. In the same vein, I split DownloadManager::IsExecutable into IsExecutableFile, where one again passes in the whole file and doesn't have to worry about getting the extension right, and IsExecutableExtension, which corresponds to the original functionality. Ideally only the former method should be public, but that again would have required further code scrubbing that was (even more) outside of the original bug fix. Finally, fixed a wrong comment in the file path tests. BUG=10876 TEST=FilePathTest.MatchesExtension, .CompareIgnoreCase Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=30323

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 11

Patch Set 3 : '' #

Total comments: 8

Patch Set 4 : BUG=10876... #

Total comments: 2

Patch Set 5 : '' #

Total comments: 3

Patch Set 6 : '' #

Total comments: 10

Patch Set 7 : '' #

Patch Set 8 : '' #

Total comments: 12

Patch Set 9 : '' #

Total comments: 1

Patch Set 10 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+812 lines, -69 lines) Patch
M base/file_path.h View 1 2 4 5 6 7 8 9 1 chunk +35 lines, -0 lines 0 comments Download
M base/file_path.cc View 1 2 3 4 5 6 7 8 9 4 chunks +606 lines, -4 lines 0 comments Download
M base/file_path_unittest.cc View 1 2 3 4 5 6 7 8 9 3 chunks +110 lines, -14 lines 0 comments Download
M chrome/browser/download/download_manager.h View 1 2 3 4 5 6 7 8 9 2 chunks +14 lines, -4 lines 0 comments Download
M chrome/browser/download/download_manager.cc View 1 2 3 4 5 6 7 8 9 10 chunks +39 lines, -26 lines 0 comments Download
M chrome/browser/download/download_shelf.cc View 1 2 3 4 5 6 7 8 9 2 chunks +4 lines, -7 lines 0 comments Download
M chrome/browser/download/download_util.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -3 lines 0 comments Download
M chrome/browser/net/url_fixer_upper_unittest.cc View 4 5 6 7 8 9 1 chunk +2 lines, -6 lines 0 comments Download
M chrome/browser/shell_integration_win.cc View 4 5 6 7 8 9 1 chunk +1 line, -5 lines 0 comments Download

Messages

Total messages: 39 (0 generated)
Roland
"Simple" bug fix for bug #10876 that resulted in a bit of file extension handling ...
11 years, 5 months ago (2009-07-17 08:37:49 UTC) #1
Erik does not do reviews
I added markmentovai to the review and cc'd avi, both of whom will almost certainly ...
11 years, 5 months ago (2009-07-17 16:18:35 UTC) #2
Avi (use Gerrit)
I'm ambivalent. I really do like the ability to ask for the extension with no ...
11 years, 5 months ago (2009-07-17 16:52:00 UTC) #3
Mark Mentovai
I haven't looked at the change yet but I have read the description. Doesn't MatchesExtension ...
11 years, 5 months ago (2009-07-17 16:55:15 UTC) #4
Avi (use Gerrit)
http://codereview.chromium.org/149796/diff/1020/28 File chrome/browser/download/download_manager.cc (right): http://codereview.chromium.org/149796/diff/1020/28#newcode844 Line 844: ShouldOpenFileBasedOnExtension(download->full_path())) This code has changed since you touched ...
11 years, 5 months ago (2009-07-17 17:02:37 UTC) #5
Roland
Thanks all for the detailed feedback! As for the main question regarding MatchesExtension: The issue ...
11 years, 5 months ago (2009-07-21 05:59:51 UTC) #6
Roland
On 2009/07/17 16:52:00, Avi wrote: > http://codereview.chromium.org/149796/diff/1020/23#newcode376 > Line 376: current_extension.begin()); > Er, I wrote ...
11 years, 5 months ago (2009-07-21 06:27:52 UTC) #7
Roland
One further suggestion: I wonder if it wouldn't be better to have a separate 'FileExtension' ...
11 years, 5 months ago (2009-07-21 08:34:04 UTC) #8
Mark Mentovai
Roland wrote: > One further suggestion: I wonder if it wouldn't be better to have ...
11 years, 5 months ago (2009-07-21 15:06:43 UTC) #9
Roland
Removed the contentious parts of my patch and only fixed those parts of the code ...
11 years, 4 months ago (2009-08-06 09:12:59 UTC) #10
Avi (use Gerrit)
http://codereview.chromium.org/149796/diff/3001/3007 File base/file_path.cc (right): http://codereview.chromium.org/149796/diff/3001/3007#newcode350 Line 350: // Also, the comparison should probably be case-sensitive ...
11 years, 4 months ago (2009-08-07 19:10:45 UTC) #11
Evan Stade
http://codereview.chromium.org/149796/diff/3001/3007 File base/file_path.cc (right): http://codereview.chromium.org/149796/diff/3001/3007#newcode350 Line 350: // Also, the comparison should probably be case-sensitive ...
11 years, 4 months ago (2009-08-07 19:54:14 UTC) #12
Erik does not do reviews
http://codereview.chromium.org/149796/diff/3001/3006 File base/file_path_unittest.cc (right): http://codereview.chromium.org/149796/diff/3001/3006#newcode727 Line 727: // FIXME: The following should pass, but currently ...
11 years, 4 months ago (2009-08-14 00:14:44 UTC) #13
Roland
On 2009/08/07 19:10:45, Avi wrote: > http://codereview.chromium.org/149796/diff/3001/3003#newcode1290 > Line 1290: if (open && !executable) > ...
11 years, 4 months ago (2009-08-14 05:18:32 UTC) #14
Roland
New revision: added static utility methods to FilePath that compare strings the same way as ...
11 years, 4 months ago (2009-08-20 12:33:01 UTC) #15
jungshik at Google
http://codereview.chromium.org/149796/diff/5001/5003 File base/file_path.cc (right): http://codereview.chromium.org/149796/diff/5001/5003#newcode437 Line 437: wchar_t c2 = (wchar_t)LOWORD(::CharUpperW((LPWSTR)MAKELONG(*i2, 0))); drive-in comment: I ...
11 years, 3 months ago (2009-09-02 17:34:51 UTC) #16
Roland
Well, I followed the article in http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/resources/strings/stringreference/stringfunctions/charupperbuff.asp . It mentions CharUpper as well as CharUpperBuff ...
11 years, 3 months ago (2009-09-03 01:54:30 UTC) #17
Roland
A gentle review-wanted-ping... ^_- Cheers, Roland
11 years, 3 months ago (2009-09-04 05:24:38 UTC) #18
jungshik at Google
On 2009/09/03 01:54:30, Roland wrote: > Well, I followed the article in > http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/resources/strings/stringreference/stringfunctions/charupperbuff.asp Well, ...
11 years, 3 months ago (2009-09-04 21:42:12 UTC) #19
jungshik at Google
http://codereview.chromium.org/149796/diff/5001/5002 File base/file_path_unittest.cc (right): http://codereview.chromium.org/149796/diff/5001/5002#newcode811 Line 811: TEST_F(FilePathTest, CompareIgnoreCase) { I guess this and other ...
11 years, 3 months ago (2009-09-04 21:46:40 UTC) #20
Roland
On 2009/09/04 21:42:12, Jungshik Shin wrote: > Well, that does not guarantee that it does ...
11 years, 3 months ago (2009-09-10 10:03:26 UTC) #21
Roland
Review requested! ^_- Cheers, Roland
11 years, 2 months ago (2009-09-28 03:01:02 UTC) #22
Avi (use Gerrit)
I'm OK with the changes in the download manager, but have issues with the changes ...
11 years, 2 months ago (2009-09-30 16:20:58 UTC) #23
Roland
On 2009/09/30 16:20:58, Avi wrote: > I'm OK with the changes in the download manager, ...
11 years, 2 months ago (2009-10-01 03:06:23 UTC) #24
jungshik at Google
On 2009/09/10 10:03:26, Roland wrote: > On 2009/09/04 21:42:12, Jungshik Shin wrote: > > Well, ...
11 years, 2 months ago (2009-10-01 05:51:13 UTC) #25
jungshik at Google
http://codereview.chromium.org/149796/diff/11008/10003 File base/file_path_unittest.cc (right): http://codereview.chromium.org/149796/diff/11008/10003#newcode846 Line 846: // Note that uc(<lowercase eszett>) => "SS", NOT ...
11 years, 2 months ago (2009-10-01 05:51:42 UTC) #26
Roland
On Thu, Oct 1, 2009 at 1:56 PM, Mark Mentovai <mark@chromium.org> wrote: > Try it ...
11 years, 2 months ago (2009-10-06 05:29:41 UTC) #27
Mark Mentovai
Fortunately(?) for you, I don't know of any system-provided function that directly implements FastUnicodeCompare. http://codereview.chromium.org/149796/diff/17002/18018 ...
11 years, 2 months ago (2009-10-06 16:10:03 UTC) #28
Roland
Uploaded a new version based on Mark's comments. On 2009/10/06 16:10:03, Mark Mentovai wrote: > ...
11 years, 2 months ago (2009-10-07 07:57:32 UTC) #29
Mark Mentovai
It sounds like you want to use WriteInto from base/string_util.h. You can call WriteInto on ...
11 years, 2 months ago (2009-10-07 14:14:01 UTC) #30
Roland
On 2009/10/07 14:14:01, Mark Mentovai wrote: > It sounds like you want to use WriteInto ...
11 years, 2 months ago (2009-10-08 06:32:23 UTC) #31
Mark Mentovai
The FilePath stuff LGTM with these changes. (It looks like a lot of comments but ...
11 years, 2 months ago (2009-10-08 13:52:59 UTC) #32
Roland
Uploaded a cleaned up patch set with the requested changes: .) eradicated the remaining '+1's ...
11 years, 2 months ago (2009-10-09 05:21:41 UTC) #33
Mark Mentovai
The FilePath portions LGTM. I think you've done a great job here. http://codereview.chromium.org/149796/diff/24035/24038 File base/file_path.h ...
11 years, 2 months ago (2009-10-09 05:33:23 UTC) #34
Mark Mentovai
This hasn't been checked in yet. Is it still waiting for more reviews? Are we ...
11 years, 2 months ago (2009-10-24 16:01:03 UTC) #35
Roland Steiner
I think I have all the LGMT's necessary, but I was waiting to get my ...
11 years, 2 months ago (2009-10-26 04:28:41 UTC) #36
Roland Steiner
Committed as rev. 30168
11 years, 1 month ago (2009-10-27 05:25:10 UTC) #37
Roland
Unfortunately, there was some bit rot: it seems ICU was yanked from under base/, so ...
11 years, 1 month ago (2009-10-27 13:40:31 UTC) #38
Roland
11 years, 1 month ago (2009-10-28 05:41:34 UTC) #39
> On Tue, Oct 27, 2009 at 10:44 PM, Mark Mentovai <mark@chromium.org> wrote:
> LGTM

committed (again :p) as r30323

Powered by Google App Engine
This is Rietveld 408576698