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

Side by Side Diff: chrome/browser/android/intercept_download_resource_throttle.cc

Issue 567733002: Revert 282243 "Fix an issue that android Download Manager doesn'..." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/android/intercept_download_resource_throttle.h" 5 #include "chrome/browser/android/intercept_download_resource_throttle.h"
6 6
7 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" 7 #include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h"
8 #include "content/public/browser/android/download_controller_android.h" 8 #include "content/public/browser/android/download_controller_android.h"
9 #include "content/public/browser/resource_controller.h" 9 #include "content/public/browser/resource_controller.h"
10 #include "net/http/http_request_headers.h" 10 #include "net/http/http_request_headers.h"
11 #include "net/http/http_response_headers.h" 11 #include "net/http/http_response_headers.h"
12 #include "net/url_request/url_request.h" 12 #include "net/url_request/url_request.h"
13 13
14 namespace chrome { 14 namespace chrome {
15 15
16 static const char kOmaDrmContentMime[] = "application/vnd.oma.drm.content";
17 static const char kOmaDrmMessageMime[] = "application/vnd.oma.drm.message";
18
19 InterceptDownloadResourceThrottle::InterceptDownloadResourceThrottle( 16 InterceptDownloadResourceThrottle::InterceptDownloadResourceThrottle(
20 net::URLRequest* request, 17 net::URLRequest* request,
21 int render_process_id, 18 int render_process_id,
22 int render_view_id, 19 int render_view_id,
23 int request_id) 20 int request_id)
24 : request_(request), 21 : request_(request),
25 render_process_id_(render_process_id), 22 render_process_id_(render_process_id),
26 render_view_id_(render_view_id), 23 render_view_id_(render_view_id),
27 request_id_(request_id) { 24 request_id_(request_id) {
28 } 25 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 !(request_->response_info().headers && 60 !(request_->response_info().headers &&
64 data_reduction_proxy::HasDataReductionProxyViaHeader( 61 data_reduction_proxy::HasDataReductionProxyViaHeader(
65 request_->response_info().headers, NULL))) { 62 request_->response_info().headers, NULL))) {
66 return; 63 return;
67 } 64 }
68 #else 65 #else
69 return; 66 return;
70 #endif 67 #endif
71 } 68 }
72 69
73 // For OMA DRM downloads, Android Download Manager doesn't handle them
74 // correctly. Use chromium network stack instead. http://crbug.com/382698.
75 std::string mime;
76 request_->GetMimeType(&mime);
77 if (!mime.compare(kOmaDrmContentMime) || !mime.compare(kOmaDrmMessageMime))
78 return;
79
80 content::DownloadControllerAndroid::Get()->CreateGETDownload( 70 content::DownloadControllerAndroid::Get()->CreateGETDownload(
81 render_process_id_, render_view_id_, request_id_); 71 render_process_id_, render_view_id_, request_id_);
82 controller()->Cancel(); 72 controller()->Cancel();
83 } 73 }
84 74
85 } // namespace chrome 75 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698