Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/android/download/download_controller_base.h" | |
| 6 #include "chrome/common/chrome_content_client.h" | |
| 7 #include "content/public/browser/resource_request_info.h" | |
| 8 #include "net/url_request/url_request.h" | |
| 9 | |
| 10 // static | |
| 11 DownloadControllerBase* DownloadControllerBase::download_controller_ = nullptr; | |
| 12 | |
| 13 using content::ResourceRequestInfo; | |
| 14 | |
| 15 DownloadInfo::DownloadInfo(const net::URLRequest* request) | |
| 16 : has_user_gesture(false) { | |
|
qinmin
2016/06/13 18:31:44
nit: fix indent
Jinsuk Kim
2016/06/14 00:55:58
Done.
| |
| 17 request->GetResponseHeaderByName("content-disposition", &content_disposition); | |
| 18 | |
| 19 if (request->response_headers()) | |
| 20 request->response_headers()->GetMimeType(&original_mime_type); | |
|
qinmin
2016/06/13 18:31:44
ditto
Jinsuk Kim
2016/06/14 00:55:58
Done.
| |
| 21 | |
| 22 request->extra_request_headers().GetHeader( | |
| 23 net::HttpRequestHeaders::kUserAgent, &user_agent); | |
| 24 if (user_agent.empty()) | |
| 25 user_agent = GetUserAgent(); | |
|
qinmin
2016/06/13 18:31:44
ditto here and below
Jinsuk Kim
2016/06/14 00:55:58
Done.
| |
| 26 GURL referer_url(request->referrer()); | |
| 27 if (referer_url.is_valid()) | |
| 28 referer = referer_url.spec(); | |
| 29 if (!request->url_chain().empty()) { | |
| 30 original_url = request->url_chain().front(); | |
| 31 url = request->url_chain().back(); | |
| 32 } | |
| 33 | |
| 34 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | |
| 35 if (info) | |
| 36 has_user_gesture = info->HasUserGesture(); | |
| 37 } | |
| 38 | |
| 39 DownloadInfo::DownloadInfo(const DownloadInfo& other) = default; | |
| 40 | |
| 41 DownloadInfo::~DownloadInfo() {} | |
| OLD | NEW |