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

Unified Diff: chrome/browser/android/offline_pages/downloads/resource_throttle.cc

Issue 2841823004: Use DownloadManager to download non-html res when download icon pressed (Closed)
Patch Set: Add comment Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/offline_pages/downloads/resource_throttle.cc
diff --git a/chrome/browser/android/offline_pages/downloads/resource_throttle.cc b/chrome/browser/android/offline_pages/downloads/resource_throttle.cc
index ee6aec8c702f1dfd0ea6a899ba3b019f13d9023f..dcdea5c7bfed7824e91c0162eb25928906cb1802 100644
--- a/chrome/browser/android/offline_pages/downloads/resource_throttle.cc
+++ b/chrome/browser/android/offline_pages/downloads/resource_throttle.cc
@@ -10,18 +10,8 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/resource_request_info.h"
#include "content/public/browser/web_contents.h"
-#include "net/base/mime_util.h"
namespace {
-// Check if the url and mime type of a download resource should trigger handoff
-// to OfflinePages backend for full page load and snapshot.
-bool CanDownloadAsOfflinePage(
- const GURL& url, const std::string& contents_mime_type) {
- return url.SchemeIsHTTPOrHTTPS() &&
- (net::MatchesMimeType(contents_mime_type, "text/html") ||
- net::MatchesMimeType(contents_mime_type, "application/xhtml+xml"));
-}
-
void WillStartOfflineRequestOnUIThread(
const GURL& url,
const content::ResourceRequestInfo::WebContentsGetter& contents_getter) {
@@ -51,8 +41,8 @@ void ResourceThrottle::WillProcessResponse(bool* defer) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
std::string mime_type;
request_->GetMimeType(&mime_type);
-
- if (CanDownloadAsOfflinePage(request_->url(), mime_type)) {
+ if (offline_pages::OfflinePageUtils::CanDownloadAsOfflinePage(request_->url(),
+ mime_type)) {
const content::ResourceRequestInfo* info =
content::ResourceRequestInfo::ForRequest(request_);
if (!info)

Powered by Google App Engine
This is Rietveld 408576698