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

Unified Diff: chrome/browser/android/offline_pages/offline_page_utils.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
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/offline_pages/offline_page_utils.cc
diff --git a/chrome/browser/android/offline_pages/offline_page_utils.cc b/chrome/browser/android/offline_pages/offline_page_utils.cc
index 1fdff62a48491771916071118f8e3da26e7c54b0..48dda928449c6dea04058e40600f8323dc871da5 100644
--- a/chrome/browser/android/offline_pages/offline_page_utils.cc
+++ b/chrome/browser/android/offline_pages/offline_page_utils.cc
@@ -29,6 +29,7 @@
#include "content/public/browser/browser_context.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
+#include "net/base/mime_util.h"
namespace offline_pages {
namespace {
@@ -298,4 +299,13 @@ void OfflinePageUtils::ScheduleDownload(content::WebContents* web_contents,
tab_helper->ScheduleDownloadHelper(web_contents, name_space, url, ui_action);
}
+// static
+bool OfflinePageUtils::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"));
+}
+
} // namespace offline_pages
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698