summaryrefslogtreecommitdiffstats
path: root/content/browser/download
diff options
context:
space:
mode:
Diffstat (limited to 'content/browser/download')
-rw-r--r--content/browser/download/base_file.cc4
-rw-r--r--content/browser/download/base_file_unittest.cc11
-rw-r--r--content/browser/download/download_browsertest.cc70
-rw-r--r--content/browser/download/download_create_info.cc3
-rw-r--r--content/browser/download/download_file_factory.cc8
-rw-r--r--content/browser/download/download_file_impl.cc8
-rw-r--r--content/browser/download/download_file_unittest.cc21
-rw-r--r--content/browser/download/download_item_impl.cc9
-rw-r--r--content/browser/download/download_item_impl_unittest.cc17
-rw-r--r--content/browser/download/download_manager_impl.cc29
-rw-r--r--content/browser/download/download_manager_impl_unittest.cc17
-rw-r--r--content/browser/download/download_net_log_parameters.cc28
-rw-r--r--content/browser/download/drag_download_file.cc8
-rw-r--r--content/browser/download/drag_download_util.cc2
-rw-r--r--content/browser/download/mhtml_generation_manager.cc9
-rw-r--r--content/browser/download/save_package.cc10
16 files changed, 130 insertions, 124 deletions
diff --git a/content/browser/download/base_file.cc b/content/browser/download/base_file.cc
index b90ba74..7bd2b0b 100644
--- a/content/browser/download/base_file.cc
+++ b/content/browser/download/base_file.cc
@@ -4,6 +4,8 @@
#include "content/browser/download/base_file.h"
+#include <utility>
+
#include "base/bind.h"
#include "base/files/file.h"
#include "base/files/file_util.h"
@@ -37,7 +39,7 @@ BaseFile::BaseFile(const base::FilePath& full_path,
: full_path_(full_path),
source_url_(source_url),
referrer_url_(referrer_url),
- file_(file.Pass()),
+ file_(std::move(file)),
bytes_so_far_(received_bytes),
start_tick_(base::TimeTicks::Now()),
calculate_hash_(calculate_hash),
diff --git a/content/browser/download/base_file_unittest.cc b/content/browser/download/base_file_unittest.cc
index 84f0d9e..a6ce347 100644
--- a/content/browser/download/base_file_unittest.cc
+++ b/content/browser/download/base_file_unittest.cc
@@ -6,6 +6,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <utility>
#include "base/files/file.h"
#include "base/files/file_util.h"
@@ -543,14 +544,8 @@ TEST_F(BaseFileTest, WriteWithError) {
// Pass a file handle which was opened without the WRITE flag.
// This should result in an error when writing.
base::File file(path, base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_READ);
- base_file_.reset(new BaseFile(path,
- GURL(),
- GURL(),
- 0,
- false,
- std::string(),
- file.Pass(),
- net::BoundNetLog()));
+ base_file_.reset(new BaseFile(path, GURL(), GURL(), 0, false, std::string(),
+ std::move(file), net::BoundNetLog()));
ASSERT_TRUE(InitializeFile());
#if defined(OS_WIN)
set_expected_error(DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED);
diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc
index 1a22451..794e832 100644
--- a/content/browser/download/download_browsertest.cc
+++ b/content/browser/download/download_browsertest.cc
@@ -7,7 +7,7 @@
#include <stddef.h>
#include <stdint.h>
-
+#include <utility>
#include <vector>
#include "base/callback_helpers.h"
@@ -199,9 +199,14 @@ DownloadFileWithDelay::DownloadFileWithDelay(
scoped_ptr<PowerSaveBlocker> power_save_blocker,
base::WeakPtr<DownloadDestinationObserver> observer,
base::WeakPtr<DownloadFileWithDelayFactory> owner)
- : DownloadFileImpl(
- save_info.Pass(), default_download_directory, url, referrer_url,
- calculate_hash, stream.Pass(), bound_net_log, observer),
+ : DownloadFileImpl(std::move(save_info),
+ default_download_directory,
+ url,
+ referrer_url,
+ calculate_hash,
+ std::move(stream),
+ bound_net_log,
+ observer),
owner_(owner) {}
DownloadFileWithDelay::~DownloadFileWithDelay() {}
@@ -254,9 +259,9 @@ DownloadFile* DownloadFileWithDelayFactory::CreateFile(
PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
PowerSaveBlocker::kReasonOther, "Download in progress"));
return new DownloadFileWithDelay(
- save_info.Pass(), default_download_directory, url, referrer_url,
- calculate_hash, stream.Pass(), bound_net_log,
- psb.Pass(), observer, weak_ptr_factory_.GetWeakPtr());
+ std::move(save_info), default_download_directory, url, referrer_url,
+ calculate_hash, std::move(stream), bound_net_log, std::move(psb),
+ observer, weak_ptr_factory_.GetWeakPtr());
}
void DownloadFileWithDelayFactory::AddRenameCallback(base::Closure callback) {
@@ -284,19 +289,23 @@ void DownloadFileWithDelayFactory::WaitForSomeCallback() {
class CountingDownloadFile : public DownloadFileImpl {
public:
- CountingDownloadFile(
- scoped_ptr<DownloadSaveInfo> save_info,
- const base::FilePath& default_downloads_directory,
- const GURL& url,
- const GURL& referrer_url,
- bool calculate_hash,
- scoped_ptr<ByteStreamReader> stream,
- const net::BoundNetLog& bound_net_log,
- scoped_ptr<PowerSaveBlocker> power_save_blocker,
- base::WeakPtr<DownloadDestinationObserver> observer)
- : DownloadFileImpl(save_info.Pass(), default_downloads_directory,
- url, referrer_url, calculate_hash,
- stream.Pass(), bound_net_log, observer) {}
+ CountingDownloadFile(scoped_ptr<DownloadSaveInfo> save_info,
+ const base::FilePath& default_downloads_directory,
+ const GURL& url,
+ const GURL& referrer_url,
+ bool calculate_hash,
+ scoped_ptr<ByteStreamReader> stream,
+ const net::BoundNetLog& bound_net_log,
+ scoped_ptr<PowerSaveBlocker> power_save_blocker,
+ base::WeakPtr<DownloadDestinationObserver> observer)
+ : DownloadFileImpl(std::move(save_info),
+ default_downloads_directory,
+ url,
+ referrer_url,
+ calculate_hash,
+ std::move(stream),
+ bound_net_log,
+ observer) {}
~CountingDownloadFile() override {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
@@ -352,9 +361,9 @@ class CountingDownloadFileFactory : public DownloadFileFactory {
PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
PowerSaveBlocker::kReasonOther, "Download in progress"));
return new CountingDownloadFile(
- save_info.Pass(), default_downloads_directory, url, referrer_url,
- calculate_hash, stream.Pass(), bound_net_log,
- psb.Pass(), observer);
+ std::move(save_info), default_downloads_directory, url, referrer_url,
+ calculate_hash, std::move(stream), bound_net_log, std::move(psb),
+ observer);
}
};
@@ -447,7 +456,7 @@ scoped_ptr<net::test_server::HttpResponse> HandleRequestAndSendRedirectResponse(
response->set_code(net::HTTP_FOUND);
response->AddCustomHeader("Location", target_url.spec());
}
- return response.Pass();
+ return std::move(response);
}
// Creates a request handler for EmbeddedTestServer that responds with a HTTP
@@ -474,7 +483,7 @@ scoped_ptr<net::test_server::HttpResponse> HandleRequestAndSendBasicResponse(
response->set_content_type(content_type);
response->set_content(body);
}
- return response.Pass();
+ return std::move(response);
}
// Creates a request handler for an EmbeddedTestServer that response with an
@@ -594,8 +603,7 @@ class DownloadContentTest : public ContentBrowserTest {
// Note: Cannot be used with other alternative DownloadFileFactorys
void SetupEnsureNoPendingDownloads() {
DownloadManagerForShell(shell())->SetDownloadFileFactoryForTesting(
- scoped_ptr<DownloadFileFactory>(
- new CountingDownloadFileFactory()).Pass());
+ scoped_ptr<DownloadFileFactory>(new CountingDownloadFileFactory()));
}
bool EnsureNoPendingDownloads() {
@@ -855,7 +863,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, CancelAtFinalRename) {
new DownloadFileWithDelayFactory();
DownloadManagerImpl* download_manager(DownloadManagerForShell(shell()));
download_manager->SetDownloadFileFactoryForTesting(
- scoped_ptr<DownloadFileFactory>(file_factory).Pass());
+ scoped_ptr<DownloadFileFactory>(file_factory));
// Create a download
NavigateToURL(shell(),
@@ -904,7 +912,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, CancelAtRelease) {
DownloadFileWithDelayFactory* file_factory =
new DownloadFileWithDelayFactory();
download_manager->SetDownloadFileFactoryForTesting(
- scoped_ptr<DownloadFileFactory>(file_factory).Pass());
+ scoped_ptr<DownloadFileFactory>(file_factory));
// Create a download
NavigateToURL(shell(),
@@ -1015,7 +1023,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, ShutdownAtRelease) {
DownloadFileWithDelayFactory* file_factory =
new DownloadFileWithDelayFactory();
download_manager->SetDownloadFileFactoryForTesting(
- scoped_ptr<DownloadFileFactory>(file_factory).Pass());
+ scoped_ptr<DownloadFileFactory>(file_factory));
// Create a download
NavigateToURL(shell(),
@@ -1662,7 +1670,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, CookiePolicy) {
DownloadUrlParameters::FromWebContents(shell()->web_contents(),
origin_two.GetURL("/bar")));
scoped_ptr<DownloadTestObserver> observer(CreateWaiter(shell(), 1));
- DownloadManagerForShell(shell())->DownloadUrl(download_parameters.Pass());
+ DownloadManagerForShell(shell())->DownloadUrl(std::move(download_parameters));
observer->WaitForFinished();
// Get the important info from other threads and check it.
diff --git a/content/browser/download/download_create_info.cc b/content/browser/download/download_create_info.cc
index f263d75..c09d713 100644
--- a/content/browser/download/download_create_info.cc
+++ b/content/browser/download/download_create_info.cc
@@ -5,6 +5,7 @@
#include "content/browser/download/download_create_info.h"
#include <string>
+#include <utility>
#include "base/format_macros.h"
#include "base/strings/stringprintf.h"
@@ -20,7 +21,7 @@ DownloadCreateInfo::DownloadCreateInfo(const base::Time& start_time,
download_id(DownloadItem::kInvalidId),
has_user_gesture(false),
transition_type(ui::PAGE_TRANSITION_LINK),
- save_info(save_info.Pass()),
+ save_info(std::move(save_info)),
request_bound_net_log(bound_net_log) {}
DownloadCreateInfo::DownloadCreateInfo()
diff --git a/content/browser/download/download_file_factory.cc b/content/browser/download/download_file_factory.cc
index 817bee1..bae88be 100644
--- a/content/browser/download/download_file_factory.cc
+++ b/content/browser/download/download_file_factory.cc
@@ -4,6 +4,8 @@
#include "content/browser/download/download_file_factory.h"
+#include <utility>
+
#include "content/browser/download/download_file_impl.h"
namespace content {
@@ -19,9 +21,9 @@ DownloadFile* DownloadFileFactory::CreateFile(
scoped_ptr<ByteStreamReader> stream,
const net::BoundNetLog& bound_net_log,
base::WeakPtr<DownloadDestinationObserver> observer) {
- return new DownloadFileImpl(
- save_info.Pass(), default_downloads_directory, url, referrer_url,
- calculate_hash, stream.Pass(), bound_net_log, observer);
+ return new DownloadFileImpl(std::move(save_info), default_downloads_directory,
+ url, referrer_url, calculate_hash,
+ std::move(stream), bound_net_log, observer);
}
} // namespace content
diff --git a/content/browser/download/download_file_impl.cc b/content/browser/download/download_file_impl.cc
index bf60a9d..0a1f398 100644
--- a/content/browser/download/download_file_impl.cc
+++ b/content/browser/download/download_file_impl.cc
@@ -5,6 +5,7 @@
#include "content/browser/download/download_file_impl.h"
#include <string>
+#include <utility>
#include "base/bind.h"
#include "base/files/file_util.h"
@@ -48,15 +49,14 @@ DownloadFileImpl::DownloadFileImpl(
save_info->offset,
calculate_hash,
save_info->hash_state,
- save_info->file.Pass(),
+ std::move(save_info->file),
bound_net_log),
default_download_directory_(default_download_directory),
- stream_reader_(stream.Pass()),
+ stream_reader_(std::move(stream)),
bytes_seen_(0),
bound_net_log_(bound_net_log),
observer_(observer),
- weak_factory_(this) {
-}
+ weak_factory_(this) {}
DownloadFileImpl::~DownloadFileImpl() {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
diff --git a/content/browser/download/download_file_unittest.cc b/content/browser/download/download_file_unittest.cc
index 9bf2dd2..9630a49 100644
--- a/content/browser/download/download_file_unittest.cc
+++ b/content/browser/download/download_file_unittest.cc
@@ -4,6 +4,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <utility>
#include "base/files/file.h"
#include "base/files/file_util.h"
@@ -82,12 +83,12 @@ class TestDownloadFileImpl : public DownloadFileImpl {
scoped_ptr<ByteStreamReader> stream,
const net::BoundNetLog& bound_net_log,
base::WeakPtr<DownloadDestinationObserver> observer)
- : DownloadFileImpl(save_info.Pass(),
+ : DownloadFileImpl(std::move(save_info),
default_downloads_directory,
url,
referrer_url,
calculate_hash,
- stream.Pass(),
+ std::move(stream),
bound_net_log,
observer) {}
@@ -176,16 +177,14 @@ class DownloadFileTest : public testing::Test {
scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo());
scoped_ptr<TestDownloadFileImpl> download_file_impl(
- new TestDownloadFileImpl(save_info.Pass(),
- base::FilePath(),
- GURL(), // Source
- GURL(), // Referrer
- calculate_hash,
- scoped_ptr<ByteStreamReader>(input_stream_),
- net::BoundNetLog(),
- observer_factory_.GetWeakPtr()));
+ new TestDownloadFileImpl(
+ std::move(save_info), base::FilePath(),
+ GURL(), // Source
+ GURL(), // Referrer
+ calculate_hash, scoped_ptr<ByteStreamReader>(input_stream_),
+ net::BoundNetLog(), observer_factory_.GetWeakPtr()));
download_file_impl->SetClientGuid("12345678-ABCD-1234-DCBA-123456789ABC");
- download_file_ = download_file_impl.Pass();
+ download_file_ = std::move(download_file_impl);
EXPECT_CALL(*input_stream_, Read(_, _))
.WillOnce(Return(ByteStreamReader::STREAM_EMPTY))
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc
index 26803f7..cef5773 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -23,6 +23,7 @@
#include "content/browser/download/download_item_impl.h"
+#include <utility>
#include <vector>
#include "base/bind.h"
@@ -231,7 +232,7 @@ DownloadItemImpl::DownloadItemImpl(
scoped_ptr<DownloadRequestHandleInterface> request_handle,
const net::BoundNetLog& bound_net_log)
: is_save_package_download_(true),
- request_handle_(request_handle.Pass()),
+ request_handle_(std::move(request_handle)),
download_id_(download_id),
current_path_(path),
target_path_(path),
@@ -1116,8 +1117,8 @@ void DownloadItemImpl::Start(
DCHECK(file.get());
DCHECK(req_handle.get());
- download_file_ = file.Pass();
- request_handle_ = req_handle.Pass();
+ download_file_ = std::move(file);
+ request_handle_ = std::move(req_handle);
if (GetState() == CANCELLED) {
// The download was in the process of resuming when it was cancelled. Don't
@@ -1703,7 +1704,7 @@ void DownloadItemImpl::ResumeInterruptedDownload() {
base::Bind(&DownloadItemImpl::OnResumeRequestStarted,
weak_ptr_factory_.GetWeakPtr()));
- delegate_->ResumeInterruptedDownload(download_params.Pass(), GetId());
+ delegate_->ResumeInterruptedDownload(std::move(download_params), GetId());
// Just in case we were interrupted while paused.
is_paused_ = false;
diff --git a/content/browser/download/download_item_impl_unittest.cc b/content/browser/download/download_item_impl_unittest.cc
index 742024c..0afad1b 100644
--- a/content/browser/download/download_item_impl_unittest.cc
+++ b/content/browser/download/download_item_impl_unittest.cc
@@ -2,7 +2,10 @@
// 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.h"
+
#include <stdint.h>
+#include <utility>
#include "base/callback.h"
#include "base/feature_list.h"
@@ -12,7 +15,6 @@
#include "content/browser/byte_stream.h"
#include "content/browser/download/download_create_info.h"
#include "content/browser/download/download_file_factory.h"
-#include "content/browser/download/download_item_impl.h"
#include "content/browser/download/download_item_impl_delegate.h"
#include "content/browser/download/download_request_handle.h"
#include "content/browser/download/mock_download_file.h"
@@ -218,7 +220,7 @@ class DownloadItemTest : public testing::Test {
info->url_chain.push_back(GURL());
info->etag = "SomethingToSatisfyResumption";
- return CreateDownloadItemWithCreateInfo(info.Pass());
+ return CreateDownloadItemWithCreateInfo(std::move(info));
}
DownloadItemImpl* CreateDownloadItemWithCreateInfo(
@@ -247,7 +249,7 @@ class DownloadItemTest : public testing::Test {
scoped_ptr<DownloadRequestHandleInterface> request_handle(
new NiceMock<MockRequestHandle>);
- item->Start(download_file.Pass(), request_handle.Pass());
+ item->Start(std::move(download_file), std::move(request_handle));
loop_.RunUntilIdle();
// So that we don't have a function writing to a stack variable
@@ -517,7 +519,7 @@ TEST_F(DownloadItemTest, LimitRestartsAfterInterrupted) {
// Copied key parts of DoIntermediateRename & AddDownloadFileToDownloadItem
// to allow for holding onto the request handle.
- item->Start(download_file.Pass(), request_handle.Pass());
+ item->Start(std::move(download_file), std::move(request_handle));
RunAllPendingInMessageLoops();
if (i == 0) {
// Target determination is only done the first time through.
@@ -554,7 +556,8 @@ TEST_F(DownloadItemTest, ResumeUsingFinalURL) {
create_info->url_chain.push_back(GURL("http://example.com/b"));
create_info->url_chain.push_back(GURL("http://example.com/c"));
- DownloadItemImpl* item = CreateDownloadItemWithCreateInfo(create_info.Pass());
+ DownloadItemImpl* item =
+ CreateDownloadItemWithCreateInfo(std::move(create_info));
TestDownloadItemObserver observer(item);
MockDownloadFile* download_file =
DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
@@ -672,7 +675,7 @@ TEST_F(DownloadItemTest, NotificationAfterTogglePause) {
EXPECT_CALL(*mock_download_file, Initialize(_));
EXPECT_CALL(*mock_delegate(), DetermineDownloadTarget(_, _));
- item->Start(download_file.Pass(), request_handle.Pass());
+ item->Start(std::move(download_file), std::move(request_handle));
item->Pause();
ASSERT_TRUE(observer.CheckAndResetDownloadUpdated());
@@ -719,7 +722,7 @@ TEST_F(DownloadItemTest, Start) {
scoped_ptr<DownloadRequestHandleInterface> request_handle(
new NiceMock<MockRequestHandle>);
EXPECT_CALL(*mock_delegate(), DetermineDownloadTarget(item, _));
- item->Start(download_file.Pass(), request_handle.Pass());
+ item->Start(std::move(download_file), std::move(request_handle));
RunAllPendingInMessageLoops();
CleanupItem(item, mock_download_file, DownloadItem::IN_PROGRESS);
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc
index 9099a3f..fed1fca 100644
--- a/content/browser/download/download_manager_impl.cc
+++ b/content/browser/download/download_manager_impl.cc
@@ -5,6 +5,7 @@
#include "content/browser/download/download_manager_impl.h"
#include <iterator>
+#include <utility>
#include "base/bind.h"
#include "base/callback.h"
@@ -66,7 +67,7 @@ scoped_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread> BeginDownload(
scoped_ptr<net::UploadElementReader> reader(
net::UploadOwnedBytesElementReader::CreateWithString(body));
request->set_upload(
- net::ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0));
+ net::ElementsUploadDataStream::CreateWithReader(std::move(reader), 0));
}
if (params->post_id() >= 0) {
// The POST in this case does not have an actual body, and only works
@@ -204,9 +205,8 @@ class DownloadItemFactoryImpl : public DownloadItemFactory {
const std::string& mime_type,
scoped_ptr<DownloadRequestHandleInterface> request_handle,
const net::BoundNetLog& bound_net_log) override {
- return new DownloadItemImpl(delegate, download_id, path, url,
- mime_type, request_handle.Pass(),
- bound_net_log);
+ return new DownloadItemImpl(delegate, download_id, path, url, mime_type,
+ std::move(request_handle), bound_net_log);
}
};
@@ -463,12 +463,8 @@ void DownloadManagerImpl::CreateSavePackageDownloadItem(
DCHECK_CURRENTLY_ON(BrowserThread::UI);
GetNextId(base::Bind(
&DownloadManagerImpl::CreateSavePackageDownloadItemWithId,
- weak_factory_.GetWeakPtr(),
- main_file_path,
- page_url,
- mime_type,
- base::Passed(request_handle.Pass()),
- item_created));
+ weak_factory_.GetWeakPtr(), main_file_path, page_url, mime_type,
+ base::Passed(std::move(request_handle)), item_created));
}
void DownloadManagerImpl::CreateSavePackageDownloadItemWithId(
@@ -484,12 +480,7 @@ void DownloadManagerImpl::CreateSavePackageDownloadItemWithId(
net::BoundNetLog bound_net_log =
net::BoundNetLog::Make(net_log_, net::NetLog::SOURCE_DOWNLOAD);
DownloadItemImpl* download_item = item_factory_->CreateSavePageItem(
- this,
- id,
- main_file_path,
- page_url,
- mime_type,
- request_handle.Pass(),
+ this, id, main_file_path, page_url, mime_type, std::move(request_handle),
bound_net_log);
downloads_[download_item->GetId()] = download_item;
FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCreated(
@@ -521,12 +512,12 @@ void DownloadManagerImpl::ResumeInterruptedDownload(
void DownloadManagerImpl::SetDownloadItemFactoryForTesting(
scoped_ptr<DownloadItemFactory> item_factory) {
- item_factory_ = item_factory.Pass();
+ item_factory_ = std::move(item_factory);
}
void DownloadManagerImpl::SetDownloadFileFactoryForTesting(
scoped_ptr<DownloadFileFactory> file_factory) {
- file_factory_ = file_factory.Pass();
+ file_factory_ = std::move(file_factory);
}
DownloadFileFactory* DownloadManagerImpl::GetDownloadFileFactoryForTesting() {
@@ -546,7 +537,7 @@ void DownloadManagerImpl::DownloadRemoved(DownloadItemImpl* download) {
void DownloadManagerImpl::AddUrlDownloader(
scoped_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread> downloader) {
if (downloader)
- url_downloaders_.push_back(downloader.Pass());
+ url_downloaders_.push_back(std::move(downloader));
}
void DownloadManagerImpl::RemoveUrlDownloader(UrlDownloader* downloader) {
diff --git a/content/browser/download/download_manager_impl_unittest.cc b/content/browser/download/download_manager_impl_unittest.cc
index cf73cc1..78d1386 100644
--- a/content/browser/download/download_manager_impl_unittest.cc
+++ b/content/browser/download/download_manager_impl_unittest.cc
@@ -2,11 +2,13 @@
// 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_manager_impl.h"
+
#include <stddef.h>
#include <stdint.h>
-
#include <set>
#include <string>
+#include <utility>
#include "base/bind.h"
#include "base/files/scoped_temp_dir.h"
@@ -25,7 +27,6 @@
#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/download_manager_impl.h"
#include "content/browser/download/download_request_handle.h"
#include "content/browser/download/mock_download_file.h"
#include "content/public/browser/browser_context.h"
@@ -480,11 +481,9 @@ class DownloadManagerTest : public testing::Test {
download_manager_.reset(new DownloadManagerImpl(
NULL, mock_browser_context_.get()));
download_manager_->SetDownloadItemFactoryForTesting(
- scoped_ptr<DownloadItemFactory>(
- mock_download_item_factory_.get()).Pass());
+ scoped_ptr<DownloadItemFactory>(mock_download_item_factory_.get()));
download_manager_->SetDownloadFileFactoryForTesting(
- scoped_ptr<DownloadFileFactory>(
- mock_download_file_factory_.get()).Pass());
+ scoped_ptr<DownloadFileFactory>(mock_download_file_factory_.get()));
observer_.reset(new MockDownloadManagerObserver());
download_manager_->AddObserver(observer_.get());
download_manager_->SetDelegate(mock_download_manager_delegate_.get());
@@ -530,7 +529,7 @@ class DownloadManagerTest : public testing::Test {
// we call Start on it immediately, so we need to set that expectation
// in the factory.
scoped_ptr<DownloadRequestHandleInterface> req_handle;
- item.Start(scoped_ptr<DownloadFile>(), req_handle.Pass());
+ item.Start(scoped_ptr<DownloadFile>(), std::move(req_handle));
DCHECK(id < download_urls_.size());
EXPECT_CALL(item, GetURL()).WillRepeatedly(ReturnRef(download_urls_[id]));
@@ -631,8 +630,8 @@ TEST_F(DownloadManagerTest, StartDownload) {
stream.get(), _, _))
.WillOnce(Return(mock_file));
- download_manager_->StartDownload(
- info.Pass(), stream.Pass(), DownloadUrlParameters::OnStartedCallback());
+ download_manager_->StartDownload(std::move(info), std::move(stream),
+ DownloadUrlParameters::OnStartedCallback());
EXPECT_TRUE(download_manager_->GetDownload(local_id));
}
diff --git a/content/browser/download/download_net_log_parameters.cc b/content/browser/download/download_net_log_parameters.cc
index ea920af..e81c813 100644
--- a/content/browser/download/download_net_log_parameters.cc
+++ b/content/browser/download/download_net_log_parameters.cc
@@ -4,6 +4,8 @@
#include "content/browser/download/download_net_log_parameters.h"
+#include <utility>
+
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/macros.h"
@@ -59,7 +61,7 @@ scoped_ptr<base::Value> ItemActivatedNetLogCallback(
base::Int64ToString(download_item->GetReceivedBytes()));
dict->SetBoolean("has_user_gesture", download_item->HasUserGesture());
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> ItemCheckedNetLogCallback(
@@ -69,7 +71,7 @@ scoped_ptr<base::Value> ItemCheckedNetLogCallback(
dict->SetString("danger_type", download_danger_names[danger_type]);
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> ItemRenamedNetLogCallback(
@@ -81,7 +83,7 @@ scoped_ptr<base::Value> ItemRenamedNetLogCallback(
dict->SetString("old_filename", old_filename->AsUTF8Unsafe());
dict->SetString("new_filename", new_filename->AsUTF8Unsafe());
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> ItemInterruptedNetLogCallback(
@@ -96,7 +98,7 @@ scoped_ptr<base::Value> ItemInterruptedNetLogCallback(
dict->SetString("hash_state",
base::HexEncode(hash_state->data(), hash_state->size()));
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> ItemResumingNetLogCallback(
@@ -113,7 +115,7 @@ scoped_ptr<base::Value> ItemResumingNetLogCallback(
dict->SetString("hash_state",
base::HexEncode(hash_state->data(), hash_state->size()));
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> ItemCompletingNetLogCallback(
@@ -126,7 +128,7 @@ scoped_ptr<base::Value> ItemCompletingNetLogCallback(
dict->SetString("final_hash",
base::HexEncode(final_hash->data(), final_hash->size()));
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> ItemFinishedNetLogCallback(
@@ -136,7 +138,7 @@ scoped_ptr<base::Value> ItemFinishedNetLogCallback(
dict->SetString("auto_opened", auto_opened ? "yes" : "no");
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> ItemCanceledNetLogCallback(
@@ -149,7 +151,7 @@ scoped_ptr<base::Value> ItemCanceledNetLogCallback(
dict->SetString("hash_state",
base::HexEncode(hash_state->data(), hash_state->size()));
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> FileOpenedNetLogCallback(
@@ -161,7 +163,7 @@ scoped_ptr<base::Value> FileOpenedNetLogCallback(
dict->SetString("file_name", file_name->AsUTF8Unsafe());
dict->SetString("start_offset", base::Int64ToString(start_offset));
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> FileStreamDrainedNetLogCallback(
@@ -173,7 +175,7 @@ scoped_ptr<base::Value> FileStreamDrainedNetLogCallback(
dict->SetInteger("stream_size", static_cast<int>(stream_size));
dict->SetInteger("num_buffers", static_cast<int>(num_buffers));
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> FileRenamedNetLogCallback(
@@ -185,7 +187,7 @@ scoped_ptr<base::Value> FileRenamedNetLogCallback(
dict->SetString("old_filename", old_filename->AsUTF8Unsafe());
dict->SetString("new_filename", new_filename->AsUTF8Unsafe());
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> FileErrorNetLogCallback(
@@ -197,7 +199,7 @@ scoped_ptr<base::Value> FileErrorNetLogCallback(
dict->SetString("operation", operation);
dict->SetInteger("net_error", net_error);
- return dict.Pass();
+ return std::move(dict);
}
scoped_ptr<base::Value> FileInterruptedNetLogCallback(
@@ -212,7 +214,7 @@ scoped_ptr<base::Value> FileInterruptedNetLogCallback(
dict->SetInteger("os_error", os_error);
dict->SetString("interrupt_reason", DownloadInterruptReasonToString(reason));
- return dict.Pass();
+ return std::move(dict);
}
} // namespace content
diff --git a/content/browser/download/drag_download_file.cc b/content/browser/download/drag_download_file.cc
index 3d8c0fc..afb533a 100644
--- a/content/browser/download/drag_download_file.cc
+++ b/content/browser/download/drag_download_file.cc
@@ -4,6 +4,8 @@
#include "content/browser/download/drag_download_file.h"
+#include <utility>
+
#include "base/bind.h"
#include "base/files/file.h"
#include "base/location.h"
@@ -70,8 +72,8 @@ class DragDownloadFile::DragDownloadFileUI : public DownloadItem::Observer {
params->set_callback(base::Bind(&DragDownloadFileUI::OnDownloadStarted,
weak_ptr_factory_.GetWeakPtr()));
params->set_file_path(file_path);
- params->set_file(file.Pass()); // Nulls file.
- download_manager->DownloadUrl(params.Pass());
+ params->set_file(std::move(file)); // Nulls file.
+ download_manager->DownloadUrl(std::move(params));
}
void Cancel() {
@@ -161,7 +163,7 @@ DragDownloadFile::DragDownloadFile(const base::FilePath& file_path,
const std::string& referrer_encoding,
WebContents* web_contents)
: file_path_(file_path),
- file_(file.Pass()),
+ file_(std::move(file)),
drag_message_loop_(base::MessageLoop::current()),
state_(INITIALIZED),
drag_ui_(NULL),
diff --git a/content/browser/download/drag_download_util.cc b/content/browser/download/drag_download_util.cc
index 4172150..b9e5f9e 100644
--- a/content/browser/download/drag_download_util.cc
+++ b/content/browser/download/drag_download_util.cc
@@ -82,7 +82,7 @@ base::File CreateFileForDrop(base::FilePath* file_path) {
new_file_path, base::File::FLAG_CREATE | base::File::FLAG_WRITE);
if (file.IsValid()) {
*file_path = new_file_path;
- return file.Pass();
+ return file;
}
}
diff --git a/content/browser/download/mhtml_generation_manager.cc b/content/browser/download/mhtml_generation_manager.cc
index 6c14c3b..9937db7 100644
--- a/content/browser/download/mhtml_generation_manager.cc
+++ b/content/browser/download/mhtml_generation_manager.cc
@@ -6,6 +6,7 @@
#include <map>
#include <queue>
+#include <utility>
#include "base/bind.h"
#include "base/files/file.h"
@@ -33,7 +34,7 @@ class MHTMLGenerationManager::Job : public RenderProcessHostObserver {
Job(int job_id, WebContents* web_contents, GenerateMHTMLCallback callback);
~Job() override;
- void set_browser_file(base::File file) { browser_file_ = file.Pass(); }
+ void set_browser_file(base::File file) { browser_file_ = std::move(file); }
GenerateMHTMLCallback callback() const { return callback_; }
@@ -202,7 +203,7 @@ void MHTMLGenerationManager::Job::CloseFile(
BrowserThread::PostTaskAndReplyWithResult(
BrowserThread::FILE, FROM_HERE,
base::Bind(&MHTMLGenerationManager::Job::CloseFileOnFileThread,
- base::Passed(browser_file_.Pass())),
+ base::Passed(std::move(browser_file_))),
callback);
}
@@ -300,7 +301,7 @@ base::File MHTMLGenerationManager::CreateFile(const base::FilePath& file_path) {
LOG(ERROR) << "Failed to create file to save MHTML at: " <<
file_path.value();
}
- return browser_file.Pass();
+ return browser_file;
}
void MHTMLGenerationManager::OnFileAvailable(int job_id,
@@ -317,7 +318,7 @@ void MHTMLGenerationManager::OnFileAvailable(int job_id,
if (!job)
return;
- job->set_browser_file(browser_file.Pass());
+ job->set_browser_file(std::move(browser_file));
if (!job->SendToNextRenderFrame()) {
JobFinished(job_id, JobStatus::FAILURE);
diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc
index b55220d..eae1e0d 100644
--- a/content/browser/download/save_package.cc
+++ b/content/browser/download/save_package.cc
@@ -5,6 +5,7 @@
#include "content/browser/download/save_package.h"
#include <algorithm>
+#include <utility>
#include "base/bind.h"
#include "base/files/file_path.h"
@@ -315,11 +316,10 @@ bool SavePackage::Init(
new SavePackageRequestHandle(AsWeakPtr()));
// The download manager keeps ownership but adds us as an observer.
download_manager_->CreateSavePackageDownloadItem(
- saved_main_file_path_,
- page_url_,
- ((save_type_ == SAVE_PAGE_TYPE_AS_MHTML) ?
- "multipart/related" : "text/html"),
- request_handle.Pass(),
+ saved_main_file_path_, page_url_,
+ ((save_type_ == SAVE_PAGE_TYPE_AS_MHTML) ? "multipart/related"
+ : "text/html"),
+ std::move(request_handle),
base::Bind(&SavePackage::InitWithDownloadItem, AsWeakPtr(),
download_created_callback));
return true;