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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/DownloadInfo.java

Issue 2014803002: Move DownloadControllerAndroid from content/ to chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix failing tests/bugs Created 4 years, 6 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: content/public/android/java/src/org/chromium/content/browser/DownloadInfo.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/DownloadInfo.java b/content/public/android/java/src/org/chromium/content/browser/DownloadInfo.java
deleted file mode 100644
index a3ab93f842213ff807fcb923216af53c27493d2d..0000000000000000000000000000000000000000
--- a/content/public/android/java/src/org/chromium/content/browser/DownloadInfo.java
+++ /dev/null
@@ -1,286 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.content.browser;
-
-/**
- * Class representing the state of a single download.
- */
-public final class DownloadInfo {
- private final String mUrl;
- private final String mUserAgent;
- private final String mMimeType;
- private final String mCookie;
- private final String mFileName;
- private final String mDescription;
- private final String mFilePath;
- private final String mReferer;
- private final String mOriginalUrl;
- private final long mContentLength;
- private final String mDownloadGuid;
- private final boolean mHasUserGesture;
- private final String mContentDisposition;
- private final boolean mIsGETRequest;
- private final int mPercentCompleted;
- private final long mTimeRemainingInMillis;
- private final boolean mIsResumable;
- private final boolean mIsPaused;
- private final boolean mIsOffTheRecord;
-
- private DownloadInfo(Builder builder) {
- mUrl = builder.mUrl;
- mUserAgent = builder.mUserAgent;
- mMimeType = builder.mMimeType;
- mCookie = builder.mCookie;
- mFileName = builder.mFileName;
- mDescription = builder.mDescription;
- mFilePath = builder.mFilePath;
- mReferer = builder.mReferer;
- mOriginalUrl = builder.mOriginalUrl;
- mContentLength = builder.mContentLength;
- mDownloadGuid = builder.mDownloadGuid;
- mHasUserGesture = builder.mHasUserGesture;
- mIsGETRequest = builder.mIsGETRequest;
- mContentDisposition = builder.mContentDisposition;
- mPercentCompleted = builder.mPercentCompleted;
- mTimeRemainingInMillis = builder.mTimeRemainingInMillis;
- mIsResumable = builder.mIsResumable;
- mIsPaused = builder.mIsPaused;
- mIsOffTheRecord = builder.mIsOffTheRecord;
- }
-
- public String getUrl() {
- return mUrl;
- }
-
- public String getUserAgent() {
- return mUserAgent;
- }
-
- public String getMimeType() {
- return mMimeType;
- }
-
- public String getCookie() {
- return mCookie;
- }
-
- public String getFileName() {
- return mFileName;
- }
-
- public String getDescription() {
- return mDescription;
- }
-
- public String getFilePath() {
- return mFilePath;
- }
-
- public String getReferer() {
- return mReferer;
- }
-
- public String getOriginalUrl() {
- return mOriginalUrl;
- }
-
- public long getContentLength() {
- return mContentLength;
- }
-
- public boolean isGETRequest() {
- return mIsGETRequest;
- }
-
- public String getDownloadGuid() {
- return mDownloadGuid;
- }
-
- public boolean hasUserGesture() {
- return mHasUserGesture;
- }
-
- public String getContentDisposition() {
- return mContentDisposition;
- }
-
- /**
- * @return percent completed as an integer, -1 if there is no download progress.
- */
- public int getPercentCompleted() {
- return mPercentCompleted;
- }
-
- public long getTimeRemainingInMillis() {
- return mTimeRemainingInMillis;
- }
-
- public boolean isResumable() {
- return mIsResumable;
- }
-
- public boolean isPaused() {
- return mIsPaused;
- }
-
- public boolean isOffTheRecord() {
- return mIsOffTheRecord;
- }
-
- /**
- * Helper class for building the DownloadInfo object.
- */
- public static class Builder {
- private String mUrl;
- private String mUserAgent;
- private String mMimeType;
- private String mCookie;
- private String mFileName;
- private String mDescription;
- private String mFilePath;
- private String mReferer;
- private String mOriginalUrl;
- private long mContentLength;
- private boolean mIsGETRequest;
- private String mDownloadGuid;
- private boolean mHasUserGesture;
- private String mContentDisposition;
- private int mPercentCompleted = -1;
- private long mTimeRemainingInMillis;
- private boolean mIsResumable = true;
- private boolean mIsPaused;
- private boolean mIsOffTheRecord;
-
- public Builder setUrl(String url) {
- mUrl = url;
- return this;
- }
-
- public Builder setUserAgent(String userAgent) {
- mUserAgent = userAgent;
- return this;
- }
-
- public Builder setMimeType(String mimeType) {
- mMimeType = mimeType;
- return this;
- }
-
- public Builder setCookie(String cookie) {
- mCookie = cookie;
- return this;
- }
-
- public Builder setFileName(String fileName) {
- mFileName = fileName;
- return this;
- }
-
- public Builder setDescription(String description) {
- mDescription = description;
- return this;
- }
-
- public Builder setFilePath(String filePath) {
- mFilePath = filePath;
- return this;
- }
-
- public Builder setReferer(String referer) {
- mReferer = referer;
- return this;
- }
-
- public Builder setOriginalUrl(String originalUrl) {
- mOriginalUrl = originalUrl;
- return this;
- }
-
- public Builder setContentLength(long contentLength) {
- mContentLength = contentLength;
- return this;
- }
-
- public Builder setIsGETRequest(boolean isGETRequest) {
- mIsGETRequest = isGETRequest;
- return this;
- }
-
- public Builder setDownloadGuid(String downloadGuid) {
- mDownloadGuid = downloadGuid;
- return this;
- }
-
- public Builder setHasUserGesture(boolean hasUserGesture) {
- mHasUserGesture = hasUserGesture;
- return this;
- }
-
- public Builder setContentDisposition(String contentDisposition) {
- mContentDisposition = contentDisposition;
- return this;
- }
-
- public Builder setPercentCompleted(int percentCompleted) {
- assert percentCompleted <= 100;
- mPercentCompleted = percentCompleted;
- return this;
- }
-
- public Builder setTimeRemainingInMillis(long timeRemainingInMillis) {
- mTimeRemainingInMillis = timeRemainingInMillis;
- return this;
- }
-
- public Builder setIsResumable(boolean isResumable) {
- mIsResumable = isResumable;
- return this;
- }
-
- public Builder setIsPaused(boolean isPaused) {
- mIsPaused = isPaused;
- return this;
- }
-
- public Builder setIsOffTheRecord(boolean isOffTheRecord) {
- mIsOffTheRecord = isOffTheRecord;
- return this;
- }
-
- public DownloadInfo build() {
- return new DownloadInfo(this);
- }
-
- /**
- * Create a builder from the DownloadInfo object.
- * @param downloadInfo DownloadInfo object from which builder fields are populated.
- * @return A builder initialized with fields from downloadInfo object.
- */
- public static Builder fromDownloadInfo(final DownloadInfo downloadInfo) {
- Builder builder = new Builder();
- builder.setUrl(downloadInfo.getUrl())
- .setUserAgent(downloadInfo.getUserAgent())
- .setMimeType(downloadInfo.getMimeType())
- .setCookie(downloadInfo.getCookie())
- .setFileName(downloadInfo.getFileName())
- .setDescription(downloadInfo.getDescription())
- .setFilePath(downloadInfo.getFilePath())
- .setReferer(downloadInfo.getReferer())
- .setOriginalUrl(downloadInfo.getOriginalUrl())
- .setContentLength(downloadInfo.getContentLength())
- .setDownloadGuid(downloadInfo.getDownloadGuid())
- .setHasUserGesture(downloadInfo.hasUserGesture())
- .setContentDisposition(downloadInfo.getContentDisposition())
- .setIsGETRequest(downloadInfo.isGETRequest())
- .setPercentCompleted(downloadInfo.getPercentCompleted())
- .setTimeRemainingInMillis(downloadInfo.getTimeRemainingInMillis())
- .setIsResumable(downloadInfo.isResumable())
- .setIsPaused(downloadInfo.isPaused())
- .setIsOffTheRecord(downloadInfo.isOffTheRecord());
- return builder;
- }
-
- }
-}

Powered by Google App Engine
This is Rietveld 408576698