Commit 98db6a59 authored by Min Qin's avatar Min Qin Committed by Commit Bot

move DownloadItemImpl and DownloadItemImplDelegate to components/download

Just move the files and resolve all the includes, no functional change.

BUG=803135

Change-Id: Ib5a9d7958639526da697ba6556b0d9433d544cee
Reviewed-on: https://chromium-review.googlesource.com/991076Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarShakti Sahu <shaktisahu@chromium.org>
Commit-Queue: Min Qin <qinmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547786}
parent 0917c680
......@@ -7,7 +7,7 @@ if (is_android) {
import("//build/config/android/rules.gni")
}
static_library("in_progress") {
source_set("in_progress") {
sources = [
"download_entry.cc",
"download_entry.h",
......@@ -21,7 +21,6 @@ static_library("in_progress") {
deps = [
"//base",
"//components/download/downloader/in_progress/proto",
"//components/download/public/common:public",
"//net",
"//services/metrics/public/cpp:metrics_cpp",
]
......
......@@ -18,6 +18,8 @@ source_set("internal") {
"download_file_impl.cc",
"download_interrupt_reasons_impl.cc",
"download_interrupt_reasons_utils.cc",
"download_item_impl.cc",
"download_item_impl_delegate.cc",
"download_job.cc",
"download_job_factory.cc",
"download_job_impl.cc",
......@@ -42,6 +44,7 @@ source_set("internal") {
deps = [
"//base",
"//components/download/downloader/in_progress",
"//components/download/public/common:interfaces",
"//components/download/quarantine",
"//mojo/public/c/system",
......
include_rules = [
"-content",
"+components/download/downloader/in_progress",
"+components/download/public/common",
"+components/download/quarantine",
"+components/ukm/test_ukm_recorder.h",
......
......@@ -2,19 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/download/download_item_impl_delegate.h"
#include "components/download/public/common/download_item_impl_delegate.h"
#include "base/logging.h"
#include "components/download/downloader/in_progress/download_entry.h"
#include "components/download/public/common/download_danger_type.h"
#include "content/browser/download/download_item_impl.h"
#include "components/download/public/common/download_item_impl.h"
namespace content {
namespace download {
// Infrastructure in DownloadItemImplDelegate to assert invariant that
// delegate always outlives all attached DownloadItemImpls.
DownloadItemImplDelegate::DownloadItemImplDelegate()
: count_(0) {}
DownloadItemImplDelegate::DownloadItemImplDelegate() : count_(0) {}
DownloadItemImplDelegate::~DownloadItemImplDelegate() {
DCHECK_EQ(0, count_);
......@@ -30,13 +29,13 @@ void DownloadItemImplDelegate::Detach() {
}
void DownloadItemImplDelegate::DetermineDownloadTarget(
DownloadItemImpl* download, const DownloadTargetCallback& callback) {
DownloadItemImpl* download,
const DownloadTargetCallback& callback) {
// TODO(rdsmith/asanka): Do something useful if forced file path is null.
base::FilePath target_path(download->GetForcedFilePath());
callback.Run(target_path,
download::DownloadItem::TARGET_DISPOSITION_OVERWRITE,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, target_path,
download::DOWNLOAD_INTERRUPT_REASON_NONE);
callback.Run(target_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, target_path,
DOWNLOAD_INTERRUPT_REASON_NONE);
}
bool DownloadItemImplDelegate::ShouldCompleteDownload(
......@@ -46,7 +45,8 @@ bool DownloadItemImplDelegate::ShouldCompleteDownload(
}
bool DownloadItemImplDelegate::ShouldOpenDownload(
DownloadItemImpl* download, const ShouldOpenDownloadCallback& callback) {
DownloadItemImpl* download,
const ShouldOpenDownloadCallback& callback) {
return false;
}
......@@ -64,7 +64,7 @@ std::string DownloadItemImplDelegate::GetApplicationClientIdForFileScanning()
}
void DownloadItemImplDelegate::ResumeInterruptedDownload(
std::unique_ptr<download::DownloadUrlParameters> params,
std::unique_ptr<DownloadUrlParameters> params,
uint32_t id,
const GURL& site_url) {}
......@@ -88,9 +88,9 @@ void DownloadItemImplDelegate::AssertStateConsistent(
void DownloadItemImplDelegate::DownloadInterrupted(DownloadItemImpl* download) {
}
base::Optional<download::DownloadEntry>
DownloadItemImplDelegate::GetInProgressEntry(DownloadItemImpl* download) {
return base::Optional<download::DownloadEntry>();
base::Optional<DownloadEntry> DownloadItemImplDelegate::GetInProgressEntry(
DownloadItemImpl* download) {
return base::Optional<DownloadEntry>();
}
bool DownloadItemImplDelegate::IsOffTheRecord() const {
......@@ -99,4 +99,4 @@ bool DownloadItemImplDelegate::IsOffTheRecord() const {
void DownloadItemImplDelegate::ReportBytesWasted(DownloadItemImpl* download) {}
} // namespace content
} // namespace download
......@@ -30,6 +30,8 @@ component("public") {
"download_interrupt_reasons.h",
"download_interrupt_reasons_utils.h",
"download_item.h",
"download_item_impl.h",
"download_item_impl_delegate.h",
"download_job.h",
"download_job_factory.h",
"download_job_impl.h",
......@@ -65,6 +67,7 @@ component("public") {
deps = [
"//base",
"//components/download/downloader/in_progress",
"//components/download/internal/common:internal",
"//crypto",
"//net",
......@@ -74,8 +77,10 @@ component("public") {
"//ui/base",
]
allow_circular_includes_from =
[ "//components/download/internal/common:internal" ]
allow_circular_includes_from = [
"//components/download/internal/common:internal",
"//components/download/downloader/in_progress",
]
}
if (is_android) {
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_
#define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_
#ifndef COMPONENTS_DOWNLOAD_PUBLIC_COMMON_DOWNLOAD_ITEM_IMPL_DELEGATE_H_
#define COMPONENTS_DOWNLOAD_PUBLIC_COMMON_DOWNLOAD_ITEM_IMPL_DELEGATE_H_
#include <stdint.h>
......@@ -11,23 +11,19 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/optional.h"
#include "components/download/public/common/download_export.h"
#include "components/download/public/common/download_item.h"
#include "components/download/public/common/download_url_parameters.h"
#include "content/common/content_export.h"
#include "content/public/browser/download_manager_delegate.h"
namespace download {
struct DownloadEntry;
}
namespace content {
class DownloadItemImpl;
// Delegate for operations that a DownloadItemImpl can't do for itself.
// The base implementation of this class does nothing (returning false
// on predicates) so interfaces not of interest to a derived class may
// be left unimplemented.
class CONTENT_EXPORT DownloadItemImplDelegate {
class COMPONENTS_DOWNLOAD_EXPORT DownloadItemImplDelegate {
public:
// The boolean argument indicates whether or not the download was
// actually opened.
......@@ -40,22 +36,27 @@ class CONTENT_EXPORT DownloadItemImplDelegate {
void Attach();
void Detach();
using DownloadTargetCallback =
base::Callback<void(const base::FilePath& target_path,
DownloadItem::TargetDisposition disposition,
DownloadDangerType danger_type,
const base::FilePath& intermediate_path,
DownloadInterruptReason interrupt_reason)>;
// Request determination of the download target from the delegate.
virtual void DetermineDownloadTarget(
DownloadItemImpl* download, const DownloadTargetCallback& callback);
virtual void DetermineDownloadTarget(DownloadItemImpl* download,
const DownloadTargetCallback& callback);
// Allows the delegate to delay completion of the download. This function
// will either return true (if the download may complete now) or will return
// false and call the provided callback at some future point. This function
// may be called repeatedly.
virtual bool ShouldCompleteDownload(
DownloadItemImpl* download,
const base::Closure& complete_callback);
virtual bool ShouldCompleteDownload(DownloadItemImpl* download,
const base::Closure& complete_callback);
// Allows the delegate to override the opening of a download. If it returns
// true then it's reponsible for opening the item.
virtual bool ShouldOpenDownload(
DownloadItemImpl* download, const ShouldOpenDownloadCallback& callback);
virtual bool ShouldOpenDownload(DownloadItemImpl* download,
const ShouldOpenDownloadCallback& callback);
// Tests if a file type should be opened automatically.
virtual bool ShouldOpenFileBasedOnExtension(const base::FilePath& path);
......@@ -76,7 +77,7 @@ class CONTENT_EXPORT DownloadItemImplDelegate {
// Called when an interrupted download is resumed.
virtual void ResumeInterruptedDownload(
std::unique_ptr<download::DownloadUrlParameters> params,
std::unique_ptr<DownloadUrlParameters> params,
uint32_t id,
const GURL& site_url);
......@@ -94,7 +95,7 @@ class CONTENT_EXPORT DownloadItemImplDelegate {
virtual void ShowDownloadInShell(DownloadItemImpl* download);
// Handle any delegate portions of a state change operation on the
// download::DownloadItem.
// DownloadItem.
virtual void DownloadRemoved(DownloadItemImpl* download);
// Assert consistent state for delgate object at various transitions.
......@@ -104,7 +105,7 @@ class CONTENT_EXPORT DownloadItemImplDelegate {
virtual void DownloadInterrupted(DownloadItemImpl* download);
// Get the in progress entry for the download item.
virtual base::Optional<download::DownloadEntry> GetInProgressEntry(
virtual base::Optional<DownloadEntry> GetInProgressEntry(
DownloadItemImpl* download);
// Whether the download is off the record.
......@@ -120,6 +121,6 @@ class CONTENT_EXPORT DownloadItemImplDelegate {
DISALLOW_COPY_AND_ASSIGN(DownloadItemImplDelegate);
};
} // namespace content
} // namespace download
#endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_ITEM_IMPL_DELEGATE_H_
#endif // COMPONENTS_DOWNLOAD_PUBLIC_COMMON_DOWNLOAD_ITEM_IMPL_DELEGATE_H_
......@@ -695,10 +695,6 @@ jumbo_source_set("browser") {
"download/byte_stream_input_stream.cc",
"download/byte_stream_input_stream.h",
"download/download_item_factory.h",
"download/download_item_impl.cc",
"download/download_item_impl.h",
"download/download_item_impl_delegate.cc",
"download/download_item_impl_delegate.h",
"download/download_item_utils.cc",
"download/download_manager_impl.cc",
"download/download_manager_impl.h",
......
......@@ -37,7 +37,6 @@
#include "components/download/public/common/download_file_impl.h"
#include "components/download/public/common/download_task_runner.h"
#include "components/download/public/common/parallel_download_utils.h"
#include "content/browser/download/download_item_impl.h"
#include "content/browser/download/download_manager_impl.h"
#include "content/browser/download/download_resource_handler.h"
#include "content/browser/web_contents/web_contents_impl.h"
......
......@@ -25,20 +25,19 @@ class FilePath;
namespace download {
struct DownloadCreateInfo;
class DownloadItemImpl;
class DownloadItemImplDelegate;
class DownloadRequestHandleInterface;
} // namespace download
namespace content {
class DownloadItemImpl;
class DownloadItemImplDelegate;
class DownloadItemFactory {
public:
virtual ~DownloadItemFactory() {}
virtual DownloadItemImpl* CreatePersistedItem(
DownloadItemImplDelegate* delegate,
virtual download::DownloadItemImpl* CreatePersistedItem(
download::DownloadItemImplDelegate* delegate,
const std::string& guid,
uint32_t download_id,
const base::FilePath& current_path,
......@@ -66,13 +65,13 @@ public:
const std::vector<download::DownloadItem::ReceivedSlice>&
received_slices) = 0;
virtual DownloadItemImpl* CreateActiveItem(
DownloadItemImplDelegate* delegate,
virtual download::DownloadItemImpl* CreateActiveItem(
download::DownloadItemImplDelegate* delegate,
uint32_t download_id,
const download::DownloadCreateInfo& info) = 0;
virtual DownloadItemImpl* CreateSavePageItem(
DownloadItemImplDelegate* delegate,
virtual download::DownloadItemImpl* CreateSavePageItem(
download::DownloadItemImplDelegate* delegate,
uint32_t download_id,
const base::FilePath& path,
const GURL& url,
......
......@@ -20,9 +20,9 @@
#include "base/observer_list.h"
#include "base/sequenced_task_runner_helpers.h"
#include "base/synchronization/lock.h"
#include "components/download/public/common/download_item_impl_delegate.h"
#include "components/download/public/common/download_url_parameters.h"
#include "components/download/public/common/url_download_handler.h"
#include "content/browser/download/download_item_impl_delegate.h"
#include "content/browser/loader/navigation_url_loader.h"
#include "content/common/content_export.h"
#include "content/public/browser/browser_thread.h"
......@@ -34,12 +34,12 @@
namespace download {
class DownloadFileFactory;
class DownloadItemImpl;
class DownloadRequestHandleInterface;
}
namespace content {
class DownloadItemFactory;
class DownloadItemImpl;
class ResourceContext;
class StoragePartitionImpl;
class URLLoaderFactoryGetter;
......@@ -47,9 +47,10 @@ class URLLoaderFactoryGetter;
class CONTENT_EXPORT DownloadManagerImpl
: public DownloadManager,
public download::UrlDownloadHandler::Delegate,
private DownloadItemImplDelegate {
private download::DownloadItemImplDelegate {
public:
using DownloadItemImplCreated = base::Callback<void(DownloadItemImpl*)>;
using DownloadItemImplCreated =
base::Callback<void(download::DownloadItemImpl*)>;
// Caller guarantees that |net_log| will remain valid
// for the lifetime of DownloadManagerImpl (until Shutdown() is called).
......@@ -172,8 +173,9 @@ class CONTENT_EXPORT DownloadManagerImpl
private:
using DownloadSet = std::set<download::DownloadItem*>;
using DownloadGuidMap = std::unordered_map<std::string, DownloadItemImpl*>;
using DownloadItemImplVector = std::vector<DownloadItemImpl*>;
using DownloadGuidMap =
std::unordered_map<std::string, download::DownloadItemImpl*>;
using DownloadItemImplVector = std::vector<download::DownloadItemImpl*>;
// For testing.
friend class DownloadManagerTest;
......@@ -204,8 +206,9 @@ class CONTENT_EXPORT DownloadManagerImpl
// Create a new active item based on the info. Separate from
// StartDownload() for testing.
DownloadItemImpl* CreateActiveItem(uint32_t id,
const download::DownloadCreateInfo& info);
download::DownloadItemImpl* CreateActiveItem(
uint32_t id,
const download::DownloadCreateInfo& info);
// Get next download id. |callback| is called on the UI thread and may
// be called synchronously.
......@@ -218,28 +221,29 @@ class CONTENT_EXPORT DownloadManagerImpl
// Overridden from DownloadItemImplDelegate
// (Note that |GetBrowserContext| are present in both interfaces.)
void DetermineDownloadTarget(DownloadItemImpl* item,
void DetermineDownloadTarget(download::DownloadItemImpl* item,
const DownloadTargetCallback& callback) override;
bool ShouldCompleteDownload(DownloadItemImpl* item,
bool ShouldCompleteDownload(download::DownloadItemImpl* item,
const base::Closure& complete_callback) override;
bool ShouldOpenFileBasedOnExtension(const base::FilePath& path) override;
bool ShouldOpenDownload(DownloadItemImpl* item,
bool ShouldOpenDownload(download::DownloadItemImpl* item,
const ShouldOpenDownloadCallback& callback) override;
void CheckForFileRemoval(DownloadItemImpl* download_item) override;
void CheckForFileRemoval(download::DownloadItemImpl* download_item) override;
std::string GetApplicationClientIdForFileScanning() const override;
void ResumeInterruptedDownload(
std::unique_ptr<download::DownloadUrlParameters> params,
uint32_t id,
const GURL& site_url) override;
void OpenDownload(DownloadItemImpl* download) override;
bool IsMostRecentDownloadItemAtFilePath(DownloadItemImpl* download) override;
void ShowDownloadInShell(DownloadItemImpl* download) override;
void DownloadRemoved(DownloadItemImpl* download) override;
void DownloadInterrupted(DownloadItemImpl* download) override;
void OpenDownload(download::DownloadItemImpl* download) override;
bool IsMostRecentDownloadItemAtFilePath(
download::DownloadItemImpl* download) override;
void ShowDownloadInShell(download::DownloadItemImpl* download) override;
void DownloadRemoved(download::DownloadItemImpl* download) override;
void DownloadInterrupted(download::DownloadItemImpl* download) override;
base::Optional<download::DownloadEntry> GetInProgressEntry(
DownloadItemImpl* download) override;
download::DownloadItemImpl* download) override;
bool IsOffTheRecord() const override;
void ReportBytesWasted(DownloadItemImpl* download) override;
void ReportBytesWasted(download::DownloadItemImpl* download) override;
// Helper method to start or resume a download.
void BeginDownloadInternal(
......@@ -289,7 +293,8 @@ class CONTENT_EXPORT DownloadManagerImpl
// "save page as" downloads.
// TODO(asanka): Remove this container in favor of downloads_by_guid_ as a
// part of http://crbug.com/593020.
std::unordered_map<uint32_t, std::unique_ptr<DownloadItemImpl>> downloads_;
std::unordered_map<uint32_t, std::unique_ptr<download::DownloadItemImpl>>
downloads_;
// Same as the above, but maps from GUID to download item. Note that the
// container is case sensitive. Hence the key needs to be normalized to
......
......@@ -28,13 +28,13 @@
#include "components/download/public/common/download_file_factory.h"
#include "components/download/public/common/download_interrupt_reasons.h"
#include "components/download/public/common/download_item.h"
#include "components/download/public/common/download_item_impl.h"
#include "components/download/public/common/download_item_impl_delegate.h"
#include "components/download/public/common/download_request_handle_interface.h"
#include "components/download/public/common/mock_download_file.h"
#include "content/browser/byte_stream.h"
#include "content/browser/download/byte_stream_input_stream.h"
#include "content/browser/download/download_item_factory.h"
#include "content/browser/download/download_item_impl.h"
#include "content/browser/download/download_item_impl_delegate.h"
#include "content/browser/download/mock_download_item_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/download_manager_delegate.h"
......@@ -123,8 +123,8 @@ class MockDownloadItemFactory
void SetHasObserverCalls(bool observer_calls);
// Overridden methods from DownloadItemFactory.
DownloadItemImpl* CreatePersistedItem(
DownloadItemImplDelegate* delegate,
download::DownloadItemImpl* CreatePersistedItem(
download::DownloadItemImplDelegate* delegate,
const std::string& guid,
uint32_t download_id,
const base::FilePath& current_path,
......@@ -151,12 +151,12 @@ class MockDownloadItemFactory
bool transient,
const std::vector<download::DownloadItem::ReceivedSlice>& received_slices)
override;
DownloadItemImpl* CreateActiveItem(
DownloadItemImplDelegate* delegate,
download::DownloadItemImpl* CreateActiveItem(
download::DownloadItemImplDelegate* delegate,
uint32_t download_id,
const download::DownloadCreateInfo& info) override;
DownloadItemImpl* CreateSavePageItem(
DownloadItemImplDelegate* delegate,
download::DownloadItemImpl* CreateSavePageItem(
download::DownloadItemImplDelegate* delegate,
uint32_t download_id,
const base::FilePath& path,
const GURL& url,
......@@ -166,7 +166,7 @@ class MockDownloadItemFactory
private:
std::map<uint32_t, MockDownloadItemImpl*> items_;
DownloadItemImplDelegate item_delegate_;
download::DownloadItemImplDelegate item_delegate_;
bool has_observer_calls_;
DISALLOW_COPY_AND_ASSIGN(MockDownloadItemFactory);
......@@ -203,8 +203,8 @@ void MockDownloadItemFactory::SetHasObserverCalls(bool has_observer_calls) {
has_observer_calls_ = has_observer_calls;
}
DownloadItemImpl* MockDownloadItemFactory::CreatePersistedItem(
DownloadItemImplDelegate* delegate,
download::DownloadItemImpl* MockDownloadItemFactory::CreatePersistedItem(
download::DownloadItemImplDelegate* delegate,
const std::string& guid,
uint32_t download_id,
const base::FilePath& current_path,
......@@ -240,8 +240,8 @@ DownloadItemImpl* MockDownloadItemFactory::CreatePersistedItem(
return result;
}
DownloadItemImpl* MockDownloadItemFactory::CreateActiveItem(
DownloadItemImplDelegate* delegate,
download::DownloadItemImpl* MockDownloadItemFactory::CreateActiveItem(
download::DownloadItemImplDelegate* delegate,
uint32_t download_id,
const download::DownloadCreateInfo& info) {
DCHECK(items_.find(download_id) == items_.end());
......@@ -267,8 +267,8 @@ DownloadItemImpl* MockDownloadItemFactory::CreateActiveItem(
return result;
}
DownloadItemImpl* MockDownloadItemFactory::CreateSavePageItem(
DownloadItemImplDelegate* delegate,
download::DownloadItemImpl* MockDownloadItemFactory::CreateSavePageItem(
download::DownloadItemImplDelegate* delegate,
uint32_t download_id,
const base::FilePath& path,
const GURL& url,
......@@ -446,7 +446,7 @@ class DownloadManagerTest : public testing::Test {
interrupt_reason_ = interrupt_reason;
}
void DetermineDownloadTarget(DownloadItemImpl* item) {
void DetermineDownloadTarget(download::DownloadItemImpl* item) {
download_manager_->DetermineDownloadTarget(
item, base::Bind(
&DownloadManagerTest::DownloadTargetDeterminedCallback,
......
......@@ -6,8 +6,8 @@
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "components/download/public/common/download_item.h"
#include "components/download/public/common/download_url_parameters.h"
#include "content/browser/download/download_item_impl.h"
#include "content/browser/download/download_request_core.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/test_browser_thread_bundle.h"
......
......@@ -99,21 +99,4 @@ std::unique_ptr<net::URLRequest> CreateURLRequestOnIOThread(
return request;
}
base::Optional<download::DownloadEntry> GetInProgressEntry(
const std::string& guid,
BrowserContext* browser_context) {
base::Optional<download::DownloadEntry> entry;
if (!browser_context || guid.empty())
return entry;
auto* manager_delegate = browser_context->GetDownloadManagerDelegate();
if (manager_delegate) {
download::InProgressCache* in_progress_cache =
manager_delegate->GetInProgressCache();
if (in_progress_cache)
entry = in_progress_cache->RetrieveEntry(guid);
}
return entry;
}
} // namespace content
......@@ -11,7 +11,6 @@
#include "content/common/content_export.h"
namespace download {
struct DownloadEntry;
class DownloadUrlParameters;
} // namespace download
......@@ -25,18 +24,12 @@ class BlobStorageContext;
namespace content {
class BrowserContext;
class ResourceContext;
// Create a URLRequest from |params|.
std::unique_ptr<net::URLRequest> CONTENT_EXPORT
CreateURLRequestOnIOThread(download::DownloadUrlParameters* params);
// Get the entry based on |guid| from in progress cache.
CONTENT_EXPORT base::Optional<download::DownloadEntry> GetInProgressEntry(
const std::string& guid,
BrowserContext* browser_context);
storage::BlobStorageContext* BlobStorageContextGetter(
ResourceContext* resource_context);
......
......@@ -8,7 +8,6 @@
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "content/browser/download/download_item_impl.h"
#include "content/browser/download/download_manager_impl.h"
#include "content/browser/download/drag_download_file.h"
#include "content/browser/download/drag_download_util.h"
......
......@@ -6,33 +6,35 @@
namespace content {
MockDownloadItemImpl::MockDownloadItemImpl(DownloadItemImplDelegate* delegate)
: DownloadItemImpl(delegate,
std::string("7d122682-55b5-4a47-a253-36cadc3e5bee"),
download::DownloadItem::kInvalidId,
base::FilePath(),
base::FilePath(),
std::vector<GURL>(),
GURL(),
GURL(),
GURL(),
GURL(),
"application/octet-stream",
"application/octet-stream",
base::Time(),
base::Time(),
std::string(),
std::string(),
0,
0,
std::string(),
download::DownloadItem::COMPLETE,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
download::DOWNLOAD_INTERRUPT_REASON_NONE,
false,
base::Time(),
true,
download::DownloadItem::ReceivedSlices()) {}
MockDownloadItemImpl::MockDownloadItemImpl(
download::DownloadItemImplDelegate* delegate)
: download::DownloadItemImpl(
delegate,
std::string("7d122682-55b5-4a47-a253-36cadc3e5bee"),
download::DownloadItem::kInvalidId,
base::FilePath(),
base::FilePath(),
std::vector<GURL>(),
GURL(),
GURL(),
GURL(),
GURL(),
"application/octet-stream",
"application/octet-stream",
base::Time(),
base::Time(),
std::string(),
std::string(),
0,
0,
std::string(),
download::DownloadItem::COMPLETE,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
download::DOWNLOAD_INTERRUPT_REASON_NONE,
false,
base::Time(),
true,
download::DownloadItem::ReceivedSlices()) {}
MockDownloadItemImpl::~MockDownloadItemImpl() = default;
......
......@@ -12,18 +12,18 @@
#include "base/macros.h"
#include "components/download/public/common/download_create_info.h"
#include "components/download/public/common/download_file.h"
#include "components/download/public/common/download_item_impl.h"
#include "components/download/public/common/download_request_handle_interface.h"
#include "content/browser/download/download_item_impl.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace content {
class DownloadManager;
class MockDownloadItemImpl : public DownloadItemImpl {
class MockDownloadItemImpl : public download::DownloadItemImpl {
public:
// Use history constructor for minimal base object.
explicit MockDownloadItemImpl(DownloadItemImplDelegate* delegate);
explicit MockDownloadItemImpl(download::DownloadItemImplDelegate* delegate);
~MockDownloadItemImpl() override;
MOCK_METHOD5(OnDownloadTargetDetermined,
......
......@@ -24,6 +24,7 @@
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "components/download/public/common/download_item_impl.h"
#include "components/download/public/common/download_request_handle_interface.h"
#include "components/download/public/common/download_stats.h"
#include "components/download/public/common/download_task_runner.h"
......@@ -31,7 +32,6 @@
#include "components/filename_generation/filename_generation.h"
#include "components/url_formatter/url_formatter.h"
#include "content/browser/bad_message.h"
#include "content/browser/download/download_item_impl.h"
#include "content/browser/download/download_manager_impl.h"
#include "content/browser/download/save_file.h"
#include "content/browser/download/save_file_manager.h"
......@@ -297,7 +297,7 @@ bool SavePackage::Init(
void SavePackage::InitWithDownloadItem(
const SavePackageDownloadCreatedCallback& download_created_callback,
DownloadItemImpl* item) {
download::DownloadItemImpl* item) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(item);
download_ = item;
......
......@@ -34,8 +34,11 @@
class GURL;
namespace content {
namespace download {
class DownloadItemImpl;
}
namespace content {
class DownloadManagerImpl;
class FrameTreeNode;
class RenderFrameHostImpl;
......@@ -156,7 +159,7 @@ class CONTENT_EXPORT SavePackage
void InitWithDownloadItem(
const SavePackageDownloadCreatedCallback& download_created_callback,
DownloadItemImpl* item);
download::DownloadItemImpl* item);
// Callback for WebContents::GenerateMHTML().
void OnMHTMLGenerated(int64_t size);
......@@ -369,7 +372,7 @@ class CONTENT_EXPORT SavePackage
// DownloadManager owns the download::DownloadItem and handles history and UI.
DownloadManagerImpl* download_manager_ = nullptr;
DownloadItemImpl* download_ = nullptr;
download::DownloadItemImpl* download_ = nullptr;
// The URL of the page the user wants to save.
const GURL page_url_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment