|
This CL makes Chrome on par with Firefox in terms of 'GetSuggestedFilename' for file download via context-menu.
For a download initiated with a click on a link in a web page, a webkit-side change is necessary, which will be done later.
Add a field (referrer_charset) to URLRequestContext and DownloadCreateInfo. It's set to the character encoding of a document where the download request originates from when it's known (download initiated via "save as" in the context menu).
If it's not known (a download initiated by clicking on a download link or typing a url directly to the omnibox), it's initialized to the default character encoding in the user's preference. I guess this is marginally better than leaving it empty (in that case, step 2b below will be skipped and step 2c will be taken) because a user has a better control over how raw 8bit characters in C-D are interpreted (especially on Windows where a reboot is required to change the OS default codepage).
This is later passed to GetSuggestedFilename and used as one of fallback encodings (1. UTF-8, 2. origin_charset, 3. default OS codepage). With this change, we support the following:
1. RFC 2047
2. Raw-8bit-characters : a. UTF-8, b. origin_charset, c. default os codepage.
3. %-escaped UTF-8.
In this CL, for #3, I didn't add a fallback similar to one used for #2. If necessary, it can be added easily. New entries are added to 3 existing tests. What's previously not covered (raw 8bit Content-Disposition header) is now covered in all 3 tests.
BUG= 1148
TEST=net unit test: NetUtilTest.GetFileNameFromCD
NetUtilTest.GetSuggestedFilename
unittest : DownloadManagerTest.TestDownloadFilename
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=15113
Total comments: 10
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+257 lines, -115 lines) |
Patch |
|
M |
chrome/browser/download/download_manager.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
1 chunk |
+1 line, -0 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
|
2 chunks |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
chrome/browser/download/download_manager_unittest.cc
|
View
|
2
3
4
5
6
7
8
9
10
11
12
13
|
3 chunks |
+24 lines, -2 lines |
0 comments
|
Download
|
|
M |
chrome/browser/download/save_package.cc
|
View
|
2
3
4
5
6
7
8
9
10
11
12
13
|
1 chunk |
+3 lines, -1 line |
0 comments
|
Download
|
|
M |
chrome/browser/history/download_types.h
|
View
|
2
3
4
5
6
7
8
9
10
11
12
13
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
chrome/browser/net/chrome_url_request_context.cc
|
View
|
2
3
4
5
6
7
8
9
10
11
12
13
|
1 chunk |
+14 lines, -0 lines |
0 comments
|
Download
|
|
M |
chrome/browser/renderer_host/download_resource_handler.cc
|
View
|
2
3
4
5
6
7
8
9
10
11
12
13
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
chrome/browser/tab_contents/render_view_context_menu.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
chrome/browser/tab_contents/tab_contents.cc
|
View
|
13
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
chrome/browser/tab_contents/tab_contents_view_win.cc
|
View
|
10
11
12
13
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
chrome/common/os_exchange_data.cc
|
View
|
2
3
4
5
6
7
8
9
10
11
12
13
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
chrome/common/render_messages.h
|
View
|
5
6
7
8
9
10
11
12
13
|
2 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
|
M |
chrome/renderer/render_view.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
chrome/renderer/render_view.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
2 chunks |
+3 lines, -1 line |
0 comments
|
Download
|
|
M |
net/base/net_util.h
|
View
|
2
3
4
5
6
7
8
9
10
11
12
13
|
3 chunks |
+19 lines, -12 lines |
0 comments
|
Download
|
|
M |
net/base/net_util.cc
|
View
|
2
3
4
5
6
7
8
9
10
11
12
13
|
7 chunks |
+21 lines, -17 lines |
0 comments
|
Download
|
|
M |
net/base/net_util_unittest.cc
|
View
|
11
12
13
|
4 chunks |
+123 lines, -65 lines |
0 comments
|
Download
|
|
M |
net/url_request/url_request_context.h
|
View
|
2
3
4
5
6
7
8
9
10
11
12
13
|
2 chunks |
+11 lines, -0 lines |
0 comments
|
Download
|
|
M |
webkit/glue/context_menu.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
webkit/glue/context_menu_client_impl.cc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
3 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
|
M |
webkit/glue/resource_handle_impl.cc
|
View
|
2
3
4
5
6
7
8
9
10
11
12
13
|
1 chunk |
+3 lines, -1 line |
0 comments
|
Download
|
|
M |
webkit/glue/webview_delegate.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
2 chunks |
+6 lines, -4 lines |
0 comments
|
Download
|
|
M |
webkit/tools/test_shell/test_webview_delegate.h
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
webkit/tools/test_shell/test_webview_delegate.cc
|
View
|
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
Total messages: 8 (0 generated)
|