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

Side by Side Diff: chrome/browser/android/download/download_controller_base.cc

Issue 2642683005: reintroduce InterceptDownloadResourceThrottle for some OMA DRM downloads (Closed)
Patch Set: function name change to avoid findbugs confusion Created 3 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/download/download_controller_base.h" 5 #include "chrome/browser/android/download/download_controller_base.h"
6 #include "chrome/common/chrome_content_client.h" 6 #include "chrome/common/chrome_content_client.h"
7 #include "content/public/browser/resource_request_info.h" 7 #include "content/public/browser/resource_request_info.h"
8 #include "net/url_request/url_request.h" 8 #include "net/url_request/url_request.h"
9 9
10 // static 10 // static
11 DownloadControllerBase* DownloadControllerBase::download_controller_ = nullptr; 11 DownloadControllerBase* DownloadControllerBase::download_controller_ = nullptr;
12 12
13 using content::ResourceRequestInfo; 13 using content::ResourceRequestInfo;
14 14
15 DownloadInfo::DownloadInfo(const net::URLRequest* request) 15 DownloadInfo::DownloadInfo(const net::URLRequest* request) {
16 : has_user_gesture(false) {
17 request->GetResponseHeaderByName("content-disposition", &content_disposition); 16 request->GetResponseHeaderByName("content-disposition", &content_disposition);
18 17
19 if (request->response_headers()) 18 if (request->response_headers())
20 request->response_headers()->GetMimeType(&original_mime_type); 19 request->response_headers()->GetMimeType(&original_mime_type);
21 20
22 request->extra_request_headers().GetHeader( 21 request->extra_request_headers().GetHeader(
23 net::HttpRequestHeaders::kUserAgent, &user_agent); 22 net::HttpRequestHeaders::kUserAgent, &user_agent);
24 if (user_agent.empty()) 23 if (user_agent.empty())
25 user_agent = GetUserAgent(); 24 user_agent = GetUserAgent();
26 GURL referer_url(request->referrer()); 25 GURL referer_url(request->referrer());
27 if (referer_url.is_valid()) 26 if (referer_url.is_valid())
28 referer = referer_url.spec(); 27 referer = referer_url.spec();
29 if (!request->url_chain().empty()) { 28 if (!request->url_chain().empty()) {
30 original_url = request->url_chain().front(); 29 original_url = request->url_chain().front();
31 url = request->url_chain().back(); 30 url = request->url_chain().back();
32 } 31 }
33
34 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
35 if (info)
36 has_user_gesture = info->HasUserGesture();
37 } 32 }
38 33
39 DownloadInfo::DownloadInfo(const DownloadInfo& other) = default; 34 DownloadInfo::DownloadInfo(const DownloadInfo& other) = default;
40 35
41 DownloadInfo::~DownloadInfo() {} 36 DownloadInfo::~DownloadInfo() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698