Merge lp:~abreu-alexandre/oxide/mimetype-from-suggested-filename into lp:~oxide-developers/oxide/oxide.trunk

Proposed by Alexandre Abreu
Status: Merged
Merged at revision: 1108
Proposed branch: lp:~abreu-alexandre/oxide/mimetype-from-suggested-filename
Merge into: lp:~oxide-developers/oxide/oxide.trunk
Prerequisite: lp:~abreu-alexandre/oxide/add-ua-to-downloadrequested
Diff against target: 50 lines (+10/-2)
3 files modified
qt/tests/qmltests/api/tst_WebView_downloadRequested.qml (+2/-1)
qt/tests/qmltests/api/tst_WebView_downloadRequestedAnchor.html (+1/-1)
shared/browser/oxide_resource_dispatcher_host_delegate.cc (+7/-0)
To merge this branch: bzr merge lp:~abreu-alexandre/oxide/mimetype-from-suggested-filename
Reviewer Review Type Date Requested Status
Chris Coulson Approve
Review via email: mp+260602@code.launchpad.net

Commit message

Guess mimetype based on suggested filename when available

Description of the change

Guess mimetype based on suggested filename when available

To post a comment you must log in.
1104. By Alexandre Abreu

Expose user agent as part of downloadRequest

1105. By Alexandre Abreu

Guess mimetype based on suggested filename when available

Revision history for this message
Chris Coulson (chrisccoulson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'qt/tests/qmltests/api/tst_WebView_downloadRequested.qml'
--- qt/tests/qmltests/api/tst_WebView_downloadRequested.qml 2015-05-29 18:10:18 +0000
+++ qt/tests/qmltests/api/tst_WebView_downloadRequested.qml 2015-05-29 18:10:19 +0000
@@ -86,7 +86,8 @@
86 spy.wait();86 spy.wait();
8787
88 compare(spy.count, 1)88 compare(spy.count, 1)
89 compare(webView.latestSuggestedFilename, "MyDownload")89 compare(webView.latestSuggestedFilename, "MyDownload.html")
90 compare(webView.latestMimeType, "text/html")
90 }91 }
9192
92 function test_WebView_downloadRequestUnhandledMimeType() {93 function test_WebView_downloadRequestUnhandledMimeType() {
9394
=== modified file 'qt/tests/qmltests/api/tst_WebView_downloadRequestedAnchor.html'
--- qt/tests/qmltests/api/tst_WebView_downloadRequestedAnchor.html 2015-05-29 18:10:18 +0000
+++ qt/tests/qmltests/api/tst_WebView_downloadRequestedAnchor.html 2015-05-29 18:10:19 +0000
@@ -2,6 +2,6 @@
2<body>2<body>
3</body>3</body>
4<div>4<div>
5<a id="content" href="http://testsuite/empty.html" download="MyDownload">download me</a>5<a id="content" href="http://testsuite/empty.html" download="MyDownload.html">download me</a>
6</div>6</div>
7</html>7</html>
88
=== modified file 'shared/browser/oxide_resource_dispatcher_host_delegate.cc'
--- shared/browser/oxide_resource_dispatcher_host_delegate.cc 2015-05-29 18:10:18 +0000
+++ shared/browser/oxide_resource_dispatcher_host_delegate.cc 2015-05-29 18:10:19 +0000
@@ -25,6 +25,7 @@
25#include "content/public/browser/render_view_host.h"25#include "content/public/browser/render_view_host.h"
26#include "content/public/browser/resource_context.h"26#include "content/public/browser/resource_context.h"
27#include "content/public/common/referrer.h"27#include "content/public/common/referrer.h"
28#include "net/base/mime_util.h"
28#include "net/cookies/cookie_monster.h"29#include "net/cookies/cookie_monster.h"
29#include "net/http/http_content_disposition.h"30#include "net/http/http_content_disposition.h"
30#include "net/http/http_request_headers.h"31#include "net/http/http_request_headers.h"
@@ -80,6 +81,12 @@
80 }81 }
81 request->Cancel();82 request->Cancel();
8283
84 if (!suggested_name.empty() && mime_type.empty()) {
85 net::GetMimeTypeFromExtension(
86 base::FilePath(suggested_name).Extension(),
87 &mime_type);
88 }
89
83 // POST request cannot be repeated in general, so prevent client from90 // POST request cannot be repeated in general, so prevent client from
84 // retrying the same request, even if it is with a GET.91 // retrying the same request, even if it is with a GET.
85 if ("GET" == request->method()) {92 if ("GET" == request->method()) {

Subscribers

People subscribed via source and target branches