0

Apply modernize-make-unique to content/

This is a large-scale change: go/chromium-modernize-make-unique

Bug: 1194272
Change-Id: Id035e6a5058ab109a4333f1b8f8225da1c6989e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2803034
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#869261}
This commit is contained in:
Peter Boström
2021-04-05 20:40:10 +00:00
committed by Chromium LUCI CQ
parent 279a92a41a
commit dd7e40ec31
154 changed files with 639 additions and 458 deletions
content
app
app_shim_remote_cocoa
browser
accessibility
background_sync
bluetooth
browser_child_process_host_impl.ccbrowser_main_loop.ccbrowser_main_runner_impl.cc
browsing_data
byte_stream.cc
code_cache
cross_site_transfer_browsertest.cc
device_sensors
devtools
download
font_unique_name_lookup
generic_sensor
geolocation
gpu
loader
manifest
media
mojo_sandbox_browsertest.ccnavigation_browsertest.cc
payments
presentation
renderer_host
service_worker
site_per_process_browsertest.ccsite_per_process_hit_test_browsertest.cc
speech
tracing
utility_process_host.cc
web_contents
webrtc
child
gpu
ppapi_plugin
public
renderer
shell
test
utility
web_test

@ -710,7 +710,7 @@ int ContentMainRunnerImpl::Initialize(const ContentMainParams& params) {
// When running browser tests, don't create a second AtExitManager as that
// interfers with shutdown when objects created before ContentMain is
// called are destructed when it returns.
exit_manager_.reset(new base::AtExitManager);
exit_manager_ = std::make_unique<base::AtExitManager>();
}
#endif // !OS_ANDROID

@ -6,6 +6,7 @@
#include <sys/param.h>
#include <memory>
#include <utility>
#include "base/bind.h"
@ -62,7 +63,7 @@ using content::DropData;
_contentsView = contentsView;
DCHECK(_contentsView);
_dropData.reset(new DropData(*dropData));
_dropData = std::make_unique<DropData>(*dropData);
DCHECK(_dropData.get());
_dragImage.reset([image retain]);

@ -102,8 +102,8 @@ class BrowserAccessibilityMacTest : public ui::CocoaTest {
child2.relative_bounds.bounds.set_height(100);
child2.role = ax::mojom::Role::kHeading;
manager_.reset(new BrowserAccessibilityManagerMac(
MakeAXTreeUpdate(root_, child1, child2), nullptr));
manager_ = std::make_unique<BrowserAccessibilityManagerMac>(
MakeAXTreeUpdate(root_, child1, child2), nullptr);
accessibility_.reset(
[ToBrowserAccessibilityCocoa(manager_->GetRoot()) retain]);
}
@ -175,8 +175,8 @@ TEST_F(BrowserAccessibilityMacTest, TestComputeTextEdit) {
root_ = ui::AXNodeData();
root_.id = 1;
root_.role = ax::mojom::Role::kTextField;
manager_.reset(
new BrowserAccessibilityManagerMac(MakeAXTreeUpdate(root_), nullptr));
manager_ = std::make_unique<BrowserAccessibilityManagerMac>(
MakeAXTreeUpdate(root_), nullptr);
accessibility_.reset(
[ToBrowserAccessibilityCocoa(manager_->GetRoot()) retain]);
@ -260,7 +260,8 @@ TEST_F(BrowserAccessibilityMacTest, TableAPIs) {
MakeCell(&initial_state.nodes[5], 6, 1, 0);
MakeCell(&initial_state.nodes[6], 7, 1, 1);
manager_.reset(new BrowserAccessibilityManagerMac(initial_state, nullptr));
manager_ =
std::make_unique<BrowserAccessibilityManagerMac>(initial_state, nullptr);
base::scoped_nsobject<BrowserAccessibilityCocoa> ax_table_(
[ToBrowserAccessibilityCocoa(manager_->GetRoot()) retain]);
id children = [ax_table_ children];

@ -4,6 +4,7 @@
#include <stddef.h>
#include <memory>
#include <set>
#include <string>
#include <vector>
@ -149,8 +150,8 @@ std::vector<std::string> DumpAccessibilityEventsTest::Dump(
{});
event_recorder->SetOnlyWebEvents(true);
waiter.reset(new AccessibilityNotificationWaiter(
shell()->web_contents(), ui::kAXModeComplete, ax::mojom::Event::kNone));
waiter = std::make_unique<AccessibilityNotificationWaiter>(
shell()->web_contents(), ui::kAXModeComplete, ax::mojom::Event::kNone);
// It's possible for platform events to be received after all blink or
// generated events have been fired. Unblock the |waiter| when this happens.
@ -177,9 +178,9 @@ std::vector<std::string> DumpAccessibilityEventsTest::Dump(
// To make sure we've received all accessibility events, add a
// sentinel by calling SignalEndOfTest and waiting for a kEndOfTest
// event in response.
waiter.reset(new AccessibilityNotificationWaiter(
waiter = std::make_unique<AccessibilityNotificationWaiter>(
shell()->web_contents(), ui::kAXModeComplete,
ax::mojom::Event::kEndOfTest));
ax::mojom::Event::kEndOfTest);
BrowserAccessibilityManager* manager =
web_contents->GetRootBrowserAccessibilityManager();
manager->SignalEndOfTest();

@ -124,9 +124,9 @@ void OneShotAccessibilityTreeSearchTest::SetUp() {
list.child_ids = {list_item_1.id, list_item_2.id};
root.child_ids = {heading.id, table.id, list.id, footer.id};
tree_.reset(new TestBrowserAccessibilityManager(MakeAXTreeUpdate(
tree_ = std::make_unique<TestBrowserAccessibilityManager>(MakeAXTreeUpdate(
root, heading, table, table_row, table_column_header_1,
table_column_header_2, list, list_item_1, list_item_2, footer)));
table_column_header_2, list, list_item_1, list_item_2, footer));
}
TEST_F(OneShotAccessibilityTreeSearchTest, GetAll) {

@ -115,7 +115,7 @@ class BackgroundSyncManagerTest
// TODO(jkarlin): Create a new object with all of the necessary SW calls
// so that we can inject test versions instead of bringing up all of this
// extra SW stuff.
helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath()));
helper_ = std::make_unique<EmbeddedWorkerTestHelper>(base::FilePath());
std::unique_ptr<MockPermissionManager> mock_permission_manager(
new testing::NiceMock<MockPermissionManager>());

@ -11,6 +11,7 @@
#include "content/browser/bluetooth/web_bluetooth_service_impl.h"
#include <algorithm>
#include <memory>
#include <utility>
#include "base/bind.h"
@ -1607,8 +1608,9 @@ void WebBluetoothServiceImpl::RequestDeviceImpl(
// before constructing the new one to make sure they can't conflict.
device_chooser_controller_.reset();
device_chooser_controller_.reset(new BluetoothDeviceChooserController(
this, render_frame_host_, std::move(adapter)));
device_chooser_controller_ =
std::make_unique<BluetoothDeviceChooserController>(
this, render_frame_host_, std::move(adapter));
// TODO(crbug.com/730593): Remove AdaptCallbackForRepeating() by updating
// the callee interface.
@ -2248,8 +2250,8 @@ void WebBluetoothServiceImpl::ClearState() {
descriptor_id_to_characteristic_id_.clear();
characteristic_id_to_service_id_.clear();
service_id_to_device_address_.clear();
connected_devices_.reset(
new FrameConnectedBluetoothDevices(render_frame_host_));
connected_devices_ =
std::make_unique<FrameConnectedBluetoothDevices>(render_frame_host_);
device_chooser_controller_.reset();
device_scanning_prompt_controller_.reset();
ClearAdvertisementClients();

@ -4,6 +4,8 @@
#include "content/browser/browser_child_process_host_impl.h"
#include <memory>
#include "base/base_switches.h"
#include "base/bind.h"
#include "base/command_line.h"
@ -353,13 +355,13 @@ void BrowserChildProcessHostImpl::LaunchWithoutExtraCommandLineSwitches(
data_.sandbox_type = delegate->GetSandboxType();
notify_child_disconnected_ = true;
child_process_.reset(new ChildProcessLauncher(
child_process_ = std::make_unique<ChildProcessLauncher>(
std::move(delegate), std::move(cmd_line), data_.id, this,
std::move(*child_process_host_->GetMojoInvitation()),
base::BindRepeating(&BrowserChildProcessHostImpl::OnMojoError,
weak_factory_.GetWeakPtr(),
base::ThreadTaskRunnerHandle::Get()),
std::move(files_to_preload), terminate_on_shutdown));
std::move(files_to_preload), terminate_on_shutdown);
ShareMetricsAllocatorToProcess();
}

@ -655,7 +655,7 @@ void BrowserMainLoop::PostMainMessageLoopStart() {
TRACE_EVENT0("startup", "BrowserMainLoop::PostMainMessageLoopStart");
{
TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:SystemMonitor");
system_monitor_.reset(new base::SystemMonitor);
system_monitor_ = std::make_unique<base::SystemMonitor>();
}
{
TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:PowerMonitor");
@ -666,7 +666,8 @@ void BrowserMainLoop::PostMainMessageLoopStart() {
}
{
TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:HighResTimerManager");
hi_res_timer_manager_.reset(new base::HighResolutionTimerManager);
hi_res_timer_manager_ =
std::make_unique<base::HighResolutionTimerManager>();
}
{
TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:NetworkChangeNotifier");
@ -690,7 +691,7 @@ void BrowserMainLoop::PostMainMessageLoopStart() {
{
TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:OnlineStateObserver");
online_state_observer_.reset(new BrowserOnlineStateObserver);
online_state_observer_ = std::make_unique<BrowserOnlineStateObserver>();
}
{ base::SetRecordActionTaskRunner(GetUIThreadTaskRunner({})); }
@ -1235,7 +1236,7 @@ void BrowserMainLoop::PostCreateThreadsImpl() {
{
TRACE_EVENT0("startup", "PostCreateThreads::Subsystem:MidiService");
midi_service_.reset(new midi::MidiService);
midi_service_ = std::make_unique<midi::MidiService>();
}
{
@ -1257,8 +1258,8 @@ void BrowserMainLoop::PostCreateThreadsImpl() {
// See audio_thread_impl.cc and https://crbug.com/158170.
DCHECK(!audio_manager_ ||
audio_manager_->GetTaskRunner()->BelongsToCurrentThread());
device_monitor_mac_.reset(
new media::DeviceMonitorMac(base::ThreadTaskRunnerHandle::Get()));
device_monitor_mac_ = std::make_unique<media::DeviceMonitorMac>(
base::ThreadTaskRunnerHandle::Get());
#endif
// Instantiated once using CreateSingletonInstance(), and accessed only using

@ -4,6 +4,8 @@
#include "content/browser/browser_main_runner_impl.h"
#include <memory>
#include "base/base_switches.h"
#include "base/check.h"
#include "base/command_line.h"
@ -83,7 +85,7 @@ int BrowserMainRunnerImpl::Initialize(const MainFunctionParams& parameters) {
if (parameters.command_line.HasSwitch(switches::kBrowserStartupDialog))
WaitForDebugger("Browser");
notification_service_.reset(new NotificationServiceImpl);
notification_service_ = std::make_unique<NotificationServiceImpl>();
#if defined(OS_WIN)
// Ole must be initialized before starting message pump, so that TSF
@ -94,8 +96,8 @@ int BrowserMainRunnerImpl::Initialize(const MainFunctionParams& parameters) {
gfx::InitializeFonts();
main_loop_.reset(
new BrowserMainLoop(parameters, std::move(scoped_execution_fence_)));
main_loop_ = std::make_unique<BrowserMainLoop>(
parameters, std::move(scoped_execution_fence_));
main_loop_->Init();

@ -146,8 +146,8 @@ class ClearSiteDataHandlerBrowserTest : public ContentBrowserTest {
ASSERT_TRUE(embedded_test_server()->Start());
// Set up HTTPS server.
https_server_.reset(new net::EmbeddedTestServer(
net::test_server::EmbeddedTestServer::TYPE_HTTPS));
https_server_ = std::make_unique<net::EmbeddedTestServer>(
net::test_server::EmbeddedTestServer::TYPE_HTTPS);
https_server_->SetSSLConfig(net::EmbeddedTestServer::CERT_OK);
https_server_->RegisterRequestHandler(
base::BindRepeating(&ClearSiteDataHandlerBrowserTest::HandleRequest,

@ -43,8 +43,8 @@ class SameSiteDataRemoverBrowserTest : public ContentBrowserTest {
if (IsOutOfProcessNetworkService())
browsing_data_browsertest_utils::SetUpMockCertVerifier(net::OK);
https_server_.reset(new net::EmbeddedTestServer(
net::test_server::EmbeddedTestServer::TYPE_HTTPS));
https_server_ = std::make_unique<net::EmbeddedTestServer>(
net::test_server::EmbeddedTestServer::TYPE_HTTPS);
https_server_->SetSSLConfig(net::EmbeddedTestServer::CERT_OK);
https_server_->RegisterRequestHandler(
base::BindRepeating(&SameSiteDataRemoverBrowserTest::HandleRequest,

@ -4,6 +4,7 @@
#include "content/browser/byte_stream.h"
#include <memory>
#include <set>
#include <utility>
@ -290,7 +291,7 @@ void ByteStreamWriterImpl::PostToPeer(bool complete, int status) {
std::unique_ptr<ContentVector> transfer_buffer;
size_t buffer_size = 0;
if (0 != input_contents_size_) {
transfer_buffer.reset(new ContentVector);
transfer_buffer = std::make_unique<ContentVector>();
transfer_buffer->swap(input_contents_);
buffer_size = input_contents_size_;
output_size_used_ += input_contents_size_;

@ -2,6 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/code_cache/generated_code_cache_context.h"
#include <memory>
#include "base/bind.h"
#include "base/files/file_path.h"
#include "base/task/post_task.h"
@ -20,13 +23,13 @@ void GeneratedCodeCacheContext::Initialize(const base::FilePath& path,
int max_bytes) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
generated_js_code_cache_.reset(
new GeneratedCodeCache(path.AppendASCII("js"), max_bytes,
GeneratedCodeCache::CodeCacheType::kJavaScript));
generated_js_code_cache_ = std::make_unique<GeneratedCodeCache>(
path.AppendASCII("js"), max_bytes,
GeneratedCodeCache::CodeCacheType::kJavaScript);
generated_wasm_code_cache_.reset(
new GeneratedCodeCache(path.AppendASCII("wasm"), max_bytes,
GeneratedCodeCache::CodeCacheType::kWebAssembly));
generated_wasm_code_cache_ = std::make_unique<GeneratedCodeCache>(
path.AppendASCII("wasm"), max_bytes,
GeneratedCodeCache::CodeCacheType::kWebAssembly);
}
void GeneratedCodeCacheContext::Shutdown() {

@ -4,6 +4,7 @@
#include "content/browser/code_cache/generated_code_cache.h"
#include <memory>
#include <utility>
#include "base/bind.h"
@ -69,8 +70,8 @@ class GeneratedCodeCacheTest : public testing::Test {
// to test the pending operaions path.
void InitializeCacheAndReOpen(GeneratedCodeCache::CodeCacheType cache_type) {
InitializeCache(cache_type);
generated_code_cache_.reset(
new GeneratedCodeCache(cache_path_, kMaxSizeInBytes, cache_type));
generated_code_cache_ = std::make_unique<GeneratedCodeCache>(
cache_path_, kMaxSizeInBytes, cache_type);
}
void WriteToCache(const GURL& url,

@ -72,10 +72,9 @@ class CrossSiteTransferTest : public ContentBrowserTest {
bool should_replace_current_entry,
bool should_wait_for_navigation) {
std::unique_ptr<TestNavigationManager> navigation_manager =
should_wait_for_navigation
? std::unique_ptr<TestNavigationManager>(
new TestNavigationManager(window->web_contents(), url))
: nullptr;
should_wait_for_navigation ? std::make_unique<TestNavigationManager>(
window->web_contents(), url)
: nullptr;
std::string script;
if (should_replace_current_entry)
script = base::StringPrintf("location.replace('%s')", url.spec().c_str());

@ -56,8 +56,8 @@ class DeviceSensorBrowserTest : public ContentBrowserTest {
}
void SetUpOnMainThread() override {
https_embedded_test_server_.reset(
new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS));
https_embedded_test_server_ = std::make_unique<net::EmbeddedTestServer>(
net::EmbeddedTestServer::TYPE_HTTPS);
// Serve both a.com and b.com (and any other domain).
host_resolver()->AddRule("*", "127.0.0.1");
ASSERT_TRUE(https_embedded_test_server_->InitializeAndListen());

@ -6,6 +6,7 @@
#include <stdint.h>
#include <algorithm>
#include <memory>
#include <utility>
#include "base/bind.h"
@ -263,9 +264,9 @@ void StartServerOnHandlerThread(
socket_factory->CreateForHttpServer();
std::unique_ptr<net::IPEndPoint> ip_address(new net::IPEndPoint);
if (server_socket) {
server_wrapper.reset(new ServerWrapper(handler, std::move(server_socket),
debug_frontend_dir,
bundles_resources));
server_wrapper =
std::make_unique<ServerWrapper>(handler, std::move(server_socket),
debug_frontend_dir, bundles_resources);
if (server_wrapper->GetLocalAddress(ip_address.get()) != net::OK)
ip_address.reset();
} else {
@ -716,9 +717,10 @@ void DevToolsHttpHandler::OnWebSocketRequest(
thread_->task_runner(),
base::BindRepeating(&DevToolsSocketFactory::CreateForTethering,
base::Unretained(socket_factory_.get())));
connection_to_client_[connection_id].reset(new DevToolsAgentHostClientImpl(
thread_->task_runner(), server_wrapper_.get(), connection_id,
browser_agent));
connection_to_client_[connection_id] =
std::make_unique<DevToolsAgentHostClientImpl>(
thread_->task_runner(), server_wrapper_.get(), connection_id,
browser_agent);
AcceptWebSocket(connection_id, request);
return;
}
@ -737,8 +739,9 @@ void DevToolsHttpHandler::OnWebSocketRequest(
return;
}
connection_to_client_[connection_id].reset(new DevToolsAgentHostClientImpl(
thread_->task_runner(), server_wrapper_.get(), connection_id, agent));
connection_to_client_[connection_id] =
std::make_unique<DevToolsAgentHostClientImpl>(
thread_->task_runner(), server_wrapper_.get(), connection_id, agent);
AcceptWebSocket(connection_id, request);
}

@ -3,6 +3,9 @@
// found in the LICENSE file.
#include "content/browser/devtools/devtools_url_loader_interceptor.h"
#include <memory>
#include "base/barrier_closure.h"
#include "base/base64.h"
#include "base/bind.h"
@ -219,7 +222,8 @@ void BodyReader::StartReading(mojo::ScopedDataPipeConsumerHandle body) {
DCHECK(!body_pipe_drainer_);
DCHECK(!data_complete_);
body_pipe_drainer_.reset(new mojo::DataPipeDrainer(this, std::move(body)));
body_pipe_drainer_ =
std::make_unique<mojo::DataPipeDrainer>(this, std::move(body));
}
void BodyReader::OnDataComplete() {

@ -64,7 +64,7 @@ class DevToolsVideoConsumerTest : public ContentBrowserTest {
}
void WaitUntilFrameReceived() {
run_loop_.reset(new base::RunLoop);
run_loop_ = std::make_unique<base::RunLoop>();
run_loop_->Run();
}

@ -440,7 +440,7 @@ class CaptureScreenshotTest : public DevToolsProtocolTest {
EXPECT_TRUE(result_->GetString("data", &base64));
std::unique_ptr<SkBitmap> result_bitmap;
if (encoding == ENCODING_PNG) {
result_bitmap.reset(new SkBitmap());
result_bitmap = std::make_unique<SkBitmap>();
EXPECT_TRUE(DecodePNG(base64, result_bitmap.get()));
} else {
result_bitmap = DecodeJPEG(base64);
@ -509,7 +509,7 @@ class CaptureScreenshotTest : public DevToolsProtocolTest {
// change during screenshotting. This verifies that the page doesn't observe
// a change in frame size as a side effect of screenshotting.
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
params->SetInteger("width", frame_size.width());
params->SetInteger("height", frame_size.height());
params->SetDouble("deviceScaleFactor", device_scale_factor);
@ -985,7 +985,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, PageCrash) {
Attach();
std::unique_ptr<base::DictionaryValue> command_params;
command_params.reset(new base::DictionaryValue());
command_params = std::make_unique<base::DictionaryValue>();
command_params->SetBoolean("discover", true);
SendCommand("Target.setDiscoverTargets", std::move(command_params));
@ -1021,7 +1021,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessDevToolsProtocolTest, PageCrashInFrame) {
Attach();
std::unique_ptr<base::DictionaryValue> command_params;
command_params.reset(new base::DictionaryValue());
command_params = std::make_unique<base::DictionaryValue>();
command_params->SetBoolean("discover", true);
SendCommand("Target.setDiscoverTargets", std::move(command_params));
@ -1038,7 +1038,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessDevToolsProtocolTest, PageCrashInFrame) {
ASSERT_LT(targetCount, 2);
}
command_params.reset(new base::DictionaryValue());
command_params = std::make_unique<base::DictionaryValue>();
command_params->SetString("targetId", frame_target_id);
command_params->SetBoolean("flatten", true);
base::DictionaryValue* result =
@ -1426,7 +1426,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, JavaScriptDialogNotifications) {
EXPECT_TRUE(params->GetString("defaultPrompt", &default_prompt));
EXPECT_EQ("default", default_prompt);
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
params->SetBoolean("accept", true);
params->SetString("promptText", "hi!");
SendCommand("Page.handleJavaScriptDialog", std::move(params), false);
@ -1488,7 +1488,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, PageDisableWithOpenedDialog) {
dialog_manager.Handle();
EXPECT_FALSE(wc->IsJavaScriptDialogShowing());
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
params->SetString("expression", "42");
SendCommand("Runtime.evaluate", std::move(params), true);
@ -1526,7 +1526,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, BeforeUnloadDialog) {
std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue());
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
params->SetString("expression",
"window.onbeforeunload=()=>{return 'prompt';}");
params->SetBoolean("userGesture", true);
@ -1544,7 +1544,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, BeforeUnloadDialog) {
EXPECT_TRUE(params->GetString("type", &type));
EXPECT_EQ("beforeunload", type);
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
params->SetBoolean("accept", true);
SendCommand("Page.handleJavaScriptDialog", std::move(params), false);
WaitForNotification("Page.javascriptDialogClosed", true);
@ -1566,7 +1566,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, BrowserCreateAndCloseTarget) {
// TODO(eseckler): Since the RenderView is closed asynchronously, we currently
// don't verify that the command actually closes the shell.
bool success;
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
params->SetString("targetId", target_id);
SendCommand("Target.closeTarget", std::move(params), true);
EXPECT_TRUE(result_->GetBoolean("success", &success));
@ -1600,7 +1600,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, VirtualTimeTest) {
params->SetString("policy", "pause");
SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true);
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
params->SetString("expression",
"setTimeout(function(){console.log('before')}, 999);"
"setTimeout(function(){console.log('at')}, 1000);"
@ -1608,14 +1608,14 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, VirtualTimeTest) {
SendCommand("Runtime.evaluate", std::move(params), true);
// Let virtual time advance for one second.
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
params->SetString("policy", "advance");
params->SetInteger("budget", 1000);
SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true);
WaitForNotification("Emulation.virtualTimeBudgetExpired");
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
params->SetString("expression", "console.log('done')");
SendCommand("Runtime.evaluate", std::move(params), true);
@ -1624,7 +1624,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, VirtualTimeTest) {
// Let virtual time advance for another second, which should make the third
// timer fire.
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
params->SetString("policy", "advance");
params->SetInteger("budget", 1000);
SendCommand("Emulation.setVirtualTimePolicy", std::move(params), true);
@ -1650,7 +1650,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, CertificateError) {
Attach();
SendCommand("Network.enable", nullptr, true);
SendCommand("Security.enable", nullptr, false);
command_params.reset(new base::DictionaryValue());
command_params = std::make_unique<base::DictionaryValue>();
command_params->SetBoolean("override", true);
SendCommand("Security.setOverrideCertificateErrors",
std::move(command_params), true);
@ -1666,7 +1666,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, CertificateError) {
test_url,
shell()->web_contents()->GetController().GetPendingEntry()->GetURL());
EXPECT_TRUE(params->GetInteger("eventId", &eventId));
command_params.reset(new base::DictionaryValue());
command_params = std::make_unique<base::DictionaryValue>();
command_params->SetInteger("eventId", eventId);
command_params->SetString("action", "cancel");
SendCommand("Security.handleCertificateError", std::move(command_params),
@ -1686,7 +1686,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, CertificateError) {
shell()->LoadURL(test_url);
params = WaitForNotification("Security.certificateError", false);
EXPECT_TRUE(params->GetInteger("eventId", &eventId));
command_params.reset(new base::DictionaryValue());
command_params = std::make_unique<base::DictionaryValue>();
command_params->SetInteger("eventId", eventId);
command_params->SetString("action", "continue");
SendCommand("Security.handleCertificateError", std::move(command_params),
@ -1703,7 +1703,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, CertificateError) {
SendCommand("Security.disable", nullptr, true);
// Test ignoring all certificate errors.
command_params.reset(new base::DictionaryValue());
command_params = std::make_unique<base::DictionaryValue>();
command_params->SetBoolean("ignore", true);
SendCommand("Security.setIgnoreCertificateErrors", std::move(command_params),
true);
@ -1784,7 +1784,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, CertificateErrorBrowserTarget) {
// Test that browser target can ignore cert errors.
AttachToBrowserTarget();
command_params.reset(new base::DictionaryValue());
command_params = std::make_unique<base::DictionaryValue>();
command_params->SetBoolean("ignore", true);
SendCommand("Security.setIgnoreCertificateErrors", std::move(command_params),
true);
@ -1814,7 +1814,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, SubresourceWithCertificateError) {
Attach();
SendCommand("Security.enable", nullptr, false);
command_params.reset(new base::DictionaryValue());
command_params = std::make_unique<base::DictionaryValue>();
command_params->SetBoolean("override", true);
SendCommand("Security.setOverrideCertificateErrors",
std::move(command_params), true);
@ -1825,7 +1825,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, SubresourceWithCertificateError) {
// Expect certificateError event for main frame.
params = WaitForNotification("Security.certificateError", false);
EXPECT_TRUE(params->GetInteger("eventId", &eventId));
command_params.reset(new base::DictionaryValue());
command_params = std::make_unique<base::DictionaryValue>();
command_params->SetInteger("eventId", eventId);
command_params->SetString("action", "continue");
SendCommand("Security.handleCertificateError", std::move(command_params),
@ -1834,7 +1834,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, SubresourceWithCertificateError) {
// Expect certificateError event for image.
params = WaitForNotification("Security.certificateError", false);
EXPECT_TRUE(params->GetInteger("eventId", &eventId));
command_params.reset(new base::DictionaryValue());
command_params = std::make_unique<base::DictionaryValue>();
command_params->SetInteger("eventId", eventId);
command_params->SetString("action", "continue");
SendCommand("Security.handleCertificateError", std::move(command_params),
@ -1865,7 +1865,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, TargetDiscovery) {
Attach();
int attached_count = 0;
command_params.reset(new base::DictionaryValue());
command_params = std::make_unique<base::DictionaryValue>();
command_params->SetBoolean("discover", true);
SendCommand("Target.setDiscoverTargets", std::move(command_params), true);
params = WaitForNotification("Target.targetCreated", true);
@ -1918,7 +1918,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, TargetDiscovery) {
ids.erase(temp);
EXPECT_TRUE(notifications_.empty());
command_params.reset(new base::DictionaryValue());
command_params = std::make_unique<base::DictionaryValue>();
command_params->SetString("targetId", attached_id);
SendCommand("Target.attachToTarget", std::move(command_params), true);
params = WaitForNotification("Target.targetInfoChanged", true);
@ -1950,12 +1950,12 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, TargetDiscovery) {
EXPECT_EQ("page", temp);
EXPECT_TRUE(notifications_.empty());
command_params.reset(new base::DictionaryValue());
command_params = std::make_unique<base::DictionaryValue>();
command_params->SetBoolean("discover", false);
SendCommand("Target.setDiscoverTargets", std::move(command_params), true);
EXPECT_TRUE(notifications_.empty());
command_params.reset(new base::DictionaryValue());
command_params = std::make_unique<base::DictionaryValue>();
command_params->SetString("sessionId", session_id);
SendCommand("Target.detachFromTarget", std::move(command_params), true);
params = WaitForNotification("Target.detachedFromTarget", true);
@ -1975,13 +1975,13 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, SetAndGetCookies) {
// Set two cookies, one of which matches the loaded URL and another that
// doesn't.
std::unique_ptr<base::DictionaryValue> command_params;
command_params.reset(new base::DictionaryValue());
command_params = std::make_unique<base::DictionaryValue>();
command_params->SetString("url", test_url.spec());
command_params->SetString("name", "cookie_for_this_url");
command_params->SetString("value", "mendacious");
SendCommand("Network.setCookie", std::move(command_params), false);
command_params.reset(new base::DictionaryValue());
command_params = std::make_unique<base::DictionaryValue>();
command_params->SetString("url", "https://www.chromium.org");
command_params->SetString("name", "cookie_for_another_url");
command_params->SetString("value", "polyglottal");
@ -2137,7 +2137,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTouchTest, EnableTouch) {
NavigateToURLBlockUntilNavigationsComplete(shell(), test_url1, 1);
Attach();
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
SendCommand("Page.enable", std::move(params), true);
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
@ -2145,7 +2145,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTouchTest, EnableTouch) {
"domAutomationController.send(checkProtos(false))", &result));
EXPECT_TRUE(result);
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
params->SetBoolean("enabled", true);
SendCommand("Emulation.setTouchEmulationEnabled", std::move(params), true);
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
@ -2153,7 +2153,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTouchTest, EnableTouch) {
"domAutomationController.send(checkProtos(false))", &result));
EXPECT_TRUE(result);
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
params->SetString("url", test_url2.spec());
SendCommand("Page.navigate", std::move(params), false);
WaitForNotification("Page.frameStoppedLoading");
@ -2162,7 +2162,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTouchTest, EnableTouch) {
"domAutomationController.send(checkProtos(true))", &result));
EXPECT_TRUE(result);
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
params->SetBoolean("enabled", false);
SendCommand("Emulation.setTouchEmulationEnabled", std::move(params), true);
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
@ -2170,7 +2170,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTouchTest, EnableTouch) {
"domAutomationController.send(checkProtos(true))", &result));
EXPECT_TRUE(result);
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
SendCommand("Page.reload", std::move(params), false);
WaitForNotification("Page.frameStoppedLoading");
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
@ -2462,7 +2462,7 @@ class DevToolsDownloadContentTest : public DevToolsProtocolTest {
ASSERT_TRUE(downloads_directory_.CreateUniqueTempDir());
// Set shell default download manager to test proxy reset behavior.
test_delegate_.reset(new ShellDownloadManagerDelegate());
test_delegate_ = std::make_unique<ShellDownloadManagerDelegate>();
test_delegate_->SetDownloadBehaviorForTesting(
downloads_directory_.GetPath());
DownloadManager* manager = DownloadManagerForShell(shell());

@ -3,6 +3,9 @@
// found in the LICENSE file.
#include "content/browser/devtools/protocol/devtools_protocol_test_support.h"
#include <memory>
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/memory/ptr_util.h"
@ -209,7 +212,7 @@ void DevToolsProtocolTest::ProcessNavigationsAnyOrder(
url = RemovePort(GURL(url));
if (!is_navigation) {
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
params->SetString("interceptionId", interception_id);
SendCommand("Network.continueInterceptedRequest", std::move(params),
false);
@ -222,7 +225,7 @@ void DevToolsProtocolTest::ProcessNavigationsAnyOrder(
if (url != it->url || is_redirect != it->is_redirect)
continue;
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
params->SetString("interceptionId", interception_id);
if (it->abort)
params->SetString("errorReason", "Aborted");

@ -40,7 +40,7 @@ FetchHandler::FetchHandler(
FetchHandler::~FetchHandler() = default;
void FetchHandler::Wire(UberDispatcher* dispatcher) {
frontend_.reset(new Fetch::Frontend(dispatcher->channel()));
frontend_ = std::make_unique<Fetch::Frontend>(dispatcher->channel());
Fetch::Dispatcher::wire(dispatcher, this);
}

@ -4,6 +4,8 @@
#include "content/browser/devtools/protocol/inspector_handler.h"
#include <memory>
#include "content/browser/devtools/devtools_agent_host_impl.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
@ -23,7 +25,7 @@ std::vector<InspectorHandler*> InspectorHandler::ForAgentHost(
}
void InspectorHandler::Wire(UberDispatcher* dispatcher) {
frontend_.reset(new Inspector::Frontend(dispatcher->channel()));
frontend_ = std::make_unique<Inspector::Frontend>(dispatcher->channel());
Inspector::Dispatcher::wire(dispatcher, this);
}

@ -7,6 +7,8 @@
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include "base/bind.h"
#include "base/files/file.h"
#include "base/files/file_util.h"
@ -32,7 +34,7 @@ IOHandler::IOHandler(DevToolsIOContext* io_context)
IOHandler::~IOHandler() = default;
void IOHandler::Wire(UberDispatcher* dispatcher) {
frontend_.reset(new IO::Frontend(dispatcher->channel()));
frontend_ = std::make_unique<IO::Frontend>(dispatcher->channel());
IO::Dispatcher::wire(dispatcher, this);
}

@ -1206,7 +1206,7 @@ std::vector<NetworkHandler*> NetworkHandler::ForAgentHost(
}
void NetworkHandler::Wire(UberDispatcher* dispatcher) {
frontend_.reset(new Network::Frontend(dispatcher->channel()));
frontend_ = std::make_unique<Network::Frontend>(dispatcher->channel());
Network::Dispatcher::wire(dispatcher, this);
}

@ -266,7 +266,7 @@ void PageHandler::SetRenderer(int process_host_id,
}
void PageHandler::Wire(UberDispatcher* dispatcher) {
frontend_.reset(new Page::Frontend(dispatcher->channel()));
frontend_ = std::make_unique<Page::Frontend>(dispatcher->channel());
Page::Dispatcher::wire(dispatcher, this);
}

@ -124,7 +124,7 @@ SecurityHandler::SecurityHandler()
SecurityHandler::~SecurityHandler() = default;
void SecurityHandler::Wire(UberDispatcher* dispatcher) {
frontend_.reset(new Security::Frontend(dispatcher->channel()));
frontend_ = std::make_unique<Security::Frontend>(dispatcher->channel());
Security::Dispatcher::wire(dispatcher, this);
}

@ -4,6 +4,8 @@
#include "content/browser/devtools/protocol/service_worker_handler.h"
#include <memory>
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/containers/flat_set.h"
@ -189,7 +191,7 @@ ServiceWorkerHandler::ServiceWorkerHandler(bool allow_inspect_worker)
ServiceWorkerHandler::~ServiceWorkerHandler() = default;
void ServiceWorkerHandler::Wire(UberDispatcher* dispatcher) {
frontend_.reset(new ServiceWorker::Frontend(dispatcher->channel()));
frontend_ = std::make_unique<ServiceWorker::Frontend>(dispatcher->channel());
ServiceWorker::Dispatcher::wire(dispatcher, this);
}

@ -4,6 +4,8 @@
#include "content/browser/devtools/protocol/target_handler.h"
#include <memory>
#include "base/base64.h"
#include "base/bind.h"
#include "base/callback_helpers.h"
@ -583,7 +585,7 @@ std::vector<TargetHandler*> TargetHandler::ForAgentHost(
}
void TargetHandler::Wire(UberDispatcher* dispatcher) {
frontend_.reset(new Target::Frontend(dispatcher->channel()));
frontend_ = std::make_unique<Target::Frontend>(dispatcher->channel());
Target::Dispatcher::wire(dispatcher, this);
}

@ -5,6 +5,7 @@
#include "content/browser/devtools/protocol/tethering_handler.h"
#include <map>
#include <memory>
#include "base/bind.h"
#include "content/public/browser/browser_task_traits.h"
@ -358,7 +359,7 @@ TetheringHandler::~TetheringHandler() {
}
void TetheringHandler::Wire(UberDispatcher* dispatcher) {
frontend_.reset(new Tethering::Frontend(dispatcher->channel()));
frontend_ = std::make_unique<Tethering::Frontend>(dispatcher->channel());
Tethering::Dispatcher::wire(dispatcher, this);
}

@ -546,7 +546,7 @@ void TracingHandler::SetRenderer(int process_host_id,
}
void TracingHandler::Wire(UberDispatcher* dispatcher) {
frontend_.reset(new Tracing::Frontend(dispatcher->channel()));
frontend_ = std::make_unique<Tracing::Frontend>(dispatcher->channel());
Tracing::Dispatcher::wire(dispatcher, this);
}
@ -1082,7 +1082,7 @@ void TracingHandler::SetupTimer(double usage_reporting_interval) {
base::TimeDelta interval =
base::TimeDelta::FromMilliseconds(std::ceil(usage_reporting_interval));
buffer_usage_poll_timer_.reset(new base::RepeatingTimer());
buffer_usage_poll_timer_ = std::make_unique<base::RepeatingTimer>();
buffer_usage_poll_timer_->Start(
FROM_HERE, interval,
base::BindRepeating(&TracingHandler::UpdateBufferUsage,

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "base/json/json_reader.h"
#include "base/trace_event/trace_config.h"
#include "base/values.h"
@ -72,7 +74,7 @@ const char kCustomTraceConfigStringDevToolsStyle[] =
class TracingHandlerTest : public testing::Test {
public:
void SetUp() override {
tracing_handler_.reset(new TracingHandler(nullptr, nullptr));
tracing_handler_ = std::make_unique<TracingHandler>(nullptr, nullptr);
}
void TearDown() override { tracing_handler_.reset(); }

@ -7,6 +7,8 @@
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <utility>
#include <vector>
@ -797,7 +799,7 @@ HandleRequestAndSendRedirectResponse(
const net::test_server::HttpRequest& request) {
std::unique_ptr<net::test_server::BasicHttpResponse> response;
if (request.relative_url == relative_url) {
response.reset(new net::test_server::BasicHttpResponse);
response = std::make_unique<net::test_server::BasicHttpResponse>();
response->set_code(net::HTTP_FOUND);
response->AddCustomHeader("Location", target_url.spec());
}
@ -824,7 +826,7 @@ HandleRequestAndSendBasicResponse(
const net::test_server::HttpRequest& request) {
std::unique_ptr<net::test_server::BasicHttpResponse> response;
if (request.relative_url == relative_url) {
response.reset(new net::test_server::BasicHttpResponse);
response = std::make_unique<net::test_server::BasicHttpResponse>();
for (const auto& pair : headers)
response->AddCustomHeader(pair.first, pair.second);
response->set_content_type(content_type);
@ -851,7 +853,7 @@ std::unique_ptr<net::test_server::HttpResponse> HandleRequestAndEchoCookies(
const net::test_server::HttpRequest& request) {
std::unique_ptr<net::test_server::BasicHttpResponse> response;
if (request.relative_url == relative_url) {
response.reset(new net::test_server::BasicHttpResponse);
response = std::make_unique<net::test_server::BasicHttpResponse>();
response->AddCustomHeader("Content-Disposition", "attachment");
response->AddCustomHeader("Vary", "");
response->AddCustomHeader("Cache-Control", "no-cache");
@ -928,7 +930,7 @@ class DownloadContentTest : public ContentBrowserTest {
void SetUpOnMainThread() override {
ASSERT_TRUE(downloads_directory_.CreateUniqueTempDir());
test_delegate_.reset(new TestShellDownloadManagerDelegate());
test_delegate_ = std::make_unique<TestShellDownloadManagerDelegate>();
test_delegate_->SetDownloadBehaviorForTesting(
downloads_directory_.GetPath());
DownloadManager* manager = DownloadManagerForShell(shell());
@ -4542,9 +4544,9 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, FetchErrorResponseBodyResumption) {
DownloadManager* download_manager = DownloadManagerForShell(shell());
std::unique_ptr<DownloadTestObserver> observer;
observer.reset(new content::DownloadTestObserverInterrupted(
observer = std::make_unique<content::DownloadTestObserverInterrupted>(
download_manager, 1,
content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL));
content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL);
download_manager->DownloadUrl(std::move(download_parameters));
observer->WaitForFinished();
std::vector<download::DownloadItem*> items;

@ -421,19 +421,20 @@ class DownloadManagerTest : public testing::Test {
mock_download_item_factory_ = (new MockDownloadItemFactory())->AsWeakPtr();
mock_download_file_factory_ = (new MockDownloadFileFactory())->AsWeakPtr();
mock_download_manager_delegate_.reset(
new StrictMock<MockDownloadManagerDelegate>);
mock_download_manager_delegate_ =
std::make_unique<StrictMock<MockDownloadManagerDelegate>>();
EXPECT_CALL(*mock_download_manager_delegate_.get(), Shutdown())
.WillOnce(Return());
browser_context_ = std::make_unique<TestBrowserContext>();
download_manager_.reset(new DownloadManagerImpl(browser_context_.get()));
download_manager_ =
std::make_unique<DownloadManagerImpl>(browser_context_.get());
download_manager_->SetDownloadItemFactoryForTesting(
std::unique_ptr<download::DownloadItemFactory>(
mock_download_item_factory_.get()));
download_manager_->SetDownloadFileFactoryForTesting(
std::unique_ptr<download::DownloadFileFactory>(
mock_download_file_factory_.get()));
observer_.reset(new MockDownloadManagerObserver());
observer_ = std::make_unique<MockDownloadManagerObserver>();
download_manager_->AddObserver(observer_.get());
download_manager_->SetDelegate(mock_download_manager_delegate_.get());
download_urls_.push_back(GURL("http://www.url1.com"));

@ -4,6 +4,8 @@
#include "content/public/browser/download_request_utils.h"
#include <memory>
#include "content/public/browser/browser_context.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/render_frame_host.h"
@ -20,10 +22,9 @@ DownloadRequestUtils::CreateDownloadForWebContentsMainFrame(
const GURL& url,
const net::NetworkTrafficAnnotationTag& traffic_annotation) {
RenderFrameHost* render_frame_host = web_contents->GetMainFrame();
return std::unique_ptr<download::DownloadUrlParameters>(
new download::DownloadUrlParameters(
url, render_frame_host->GetProcess()->GetID(),
render_frame_host->GetRoutingID(), traffic_annotation));
return std::make_unique<download::DownloadUrlParameters>(
url, render_frame_host->GetProcess()->GetID(),
render_frame_host->GetRoutingID(), traffic_annotation);
}
// static

@ -316,7 +316,7 @@ class MHTMLGenerationTest : public ContentBrowserTest,
void GenerateMHTMLForCurrentPage(MHTMLGenerationParams& params) {
base::RunLoop run_loop;
histogram_tester_.reset(new base::HistogramTester());
histogram_tester_ = std::make_unique<base::HistogramTester>();
bool use_result_callback = GetParam();

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "base/stl_util.h"
#include "base/test/scoped_feature_list.h"
#include "base/threading/thread_restrictions.h"
@ -174,7 +176,7 @@ IN_PROC_BROWSER_TEST_F(FontUniqueNameBrowserTest, ContentLocalFontsMatching) {
ASSERT_TRUE(result);
ASSERT_TRUE(result->is_int());
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
params->SetInteger("nodeId", result->GetInt());
params->SetString("selector", ".testnode");
result = SendCommand("DOM.querySelectorAll", std::move(params));
@ -187,7 +189,7 @@ IN_PROC_BROWSER_TEST_F(FontUniqueNameBrowserTest, ContentLocalFontsMatching) {
ASSERT_EQ(nodes_view.size(), base::size(kExpectedFontFamilyNames));
for (size_t i = 0; i < nodes_view.size(); ++i) {
const base::Value& nodeId = nodes_view[i];
params.reset(new base::DictionaryValue());
params = std::make_unique<base::DictionaryValue>();
params->SetInteger("nodeId", nodeId.GetInt());
const base::Value* font_info =
SendCommand("CSS.getPlatformFontsForNode", std::move(params));

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/macros.h"
@ -57,8 +59,8 @@ class GenericSensorBrowserTest : public ContentBrowserTest {
}
void SetUpOnMainThread() override {
https_embedded_test_server_.reset(
new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS));
https_embedded_test_server_ = std::make_unique<net::EmbeddedTestServer>(
net::EmbeddedTestServer::TYPE_HTTPS);
// Serve both a.com and b.com (and any other domain).
host_resolver()->AddRule("*", "127.0.0.1");
ASSERT_TRUE(https_embedded_test_server_->InitializeAndListen());

@ -4,6 +4,8 @@
#include "content/browser/geolocation/geolocation_service_impl.h"
#include <memory>
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/run_loop.h"
@ -69,7 +71,7 @@ class GeolocationServiceTest : public RenderViewHostImplTestHarness {
void SetUp() override {
RenderViewHostImplTestHarness::SetUp();
NavigateAndCommit(GURL("https://www.google.com/maps"));
browser_context_.reset(new content::TestBrowserContext());
browser_context_ = std::make_unique<content::TestBrowserContext>();
browser_context_->SetPermissionControllerDelegate(
std::make_unique<TestPermissionManager>());
@ -109,7 +111,8 @@ class GeolocationServiceTest : public RenderViewHostImplTestHarness {
BrowserContext::SetPermissionControllerForTesting(
embedded_rfh->GetProcess()->GetBrowserContext(),
std::make_unique<PermissionControllerImpl>(browser_context_.get()));
service_.reset(new GeolocationServiceImpl(context_.get(), embedded_rfh));
service_ =
std::make_unique<GeolocationServiceImpl>(context_.get(), embedded_rfh);
service_->Bind(service_remote_.BindNewPipeAndPassReceiver());
}

@ -8,6 +8,7 @@
#include <algorithm>
#include <list>
#include <memory>
#include <utility>
#include "base/base64.h"
@ -722,8 +723,8 @@ GpuProcessHost::GpuProcessHost(int host_id, GpuProcessKind kind)
g_gpu_process_hosts[kind] = this;
process_.reset(new BrowserChildProcessHostImpl(
PROCESS_TYPE_GPU, this, ChildProcessHost::IpcMode::kNormal));
process_ = std::make_unique<BrowserChildProcessHostImpl>(
PROCESS_TYPE_GPU, this, ChildProcessHost::IpcMode::kNormal);
}
GpuProcessHost::~GpuProcessHost() {

@ -148,7 +148,7 @@ class NavigationURLLoaderImplTest : public testing::Test {
base::test::TaskEnvironment::MainThreadType::IO)),
network_change_notifier_(
net::test::MockNetworkChangeNotifier::Create()) {
browser_context_.reset(new TestBrowserContext);
browser_context_ = std::make_unique<TestBrowserContext>();
http_test_server_.AddDefaultHandlers(
base::FilePath(FILE_PATH_LITERAL("content/test/data")));

@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <stdint.h>
#include <memory>
#include <string>
#include <utility>
@ -83,8 +84,8 @@ class ManifestBrowserTest : public ContentBrowserTest,
ContentBrowserTest::SetUpOnMainThread();
DCHECK(shell()->web_contents());
mock_web_contents_delegate_.reset(
new MockWebContentsDelegate(shell()->web_contents(), this));
mock_web_contents_delegate_ = std::make_unique<MockWebContentsDelegate>(
shell()->web_contents(), this);
shell()->web_contents()->SetDelegate(mock_web_contents_delegate_.get());
Observe(shell()->web_contents());
ASSERT_TRUE(embedded_test_server()->Start());

@ -7,6 +7,8 @@
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <memory>
#include <utility>
#include "base/bind.h"
@ -277,7 +279,7 @@ void DesktopCaptureDevice::Core::SetMockTimeForTesting(
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const base::TickClock* tick_clock) {
tick_clock_ = tick_clock;
capture_timer_.reset(new base::OneShotTimer(tick_clock_));
capture_timer_ = std::make_unique<base::OneShotTimer>(tick_clock_);
capture_timer_->SetTaskRunner(task_runner);
}
@ -363,7 +365,7 @@ void DesktopCaptureDevice::Core::OnCaptureResult(
// replace it with a black frame to avoid the video appearing frozen at the
// last frame.
if (!black_frame_ || !black_frame_->size().equals(output_size)) {
black_frame_.reset(new webrtc::BasicDesktopFrame(output_size));
black_frame_ = std::make_unique<webrtc::BasicDesktopFrame>(output_size);
}
output_data = black_frame_->data();
} else {
@ -393,7 +395,8 @@ void DesktopCaptureDevice::Core::OnCaptureResult(
// don't need to worry about clearing out stale pixel data in
// letterboxed areas.
if (!output_frame_) {
output_frame_.reset(new webrtc::BasicDesktopFrame(output_size));
output_frame_ =
std::make_unique<webrtc::BasicDesktopFrame>(output_size);
}
DCHECK(output_frame_->size().equals(output_size));
@ -414,7 +417,8 @@ void DesktopCaptureDevice::Core::OnCaptureResult(
// crbug.com/306876), or if |frame| is cropped form a larger frame (see
// crbug.com/437740).
if (!output_frame_) {
output_frame_.reset(new webrtc::BasicDesktopFrame(output_size));
output_frame_ =
std::make_unique<webrtc::BasicDesktopFrame>(output_size);
}
output_frame_->CopyPixelsFrom(
@ -515,7 +519,7 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create(
// For browser tests, to create a fake desktop capturer.
if (source.id == DesktopMediaID::kFakeId) {
capturer.reset(new webrtc::FakeDesktopCapturer());
capturer = std::make_unique<webrtc::FakeDesktopCapturer>();
result.reset(new DesktopCaptureDevice(std::move(capturer), source.type));
return result;
}
@ -533,8 +537,8 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create(
webrtc::DesktopCapturer::CreateScreenCapturer(options));
#endif
if (screen_capturer && screen_capturer->SelectSource(source.id)) {
capturer.reset(new webrtc::DesktopAndCursorComposer(
std::move(screen_capturer), options));
capturer = std::make_unique<webrtc::DesktopAndCursorComposer>(
std::move(screen_capturer), options);
IncrementDesktopCaptureCounter(SCREEN_CAPTURER_CREATED);
IncrementDesktopCaptureCounter(
source.audio_share ? SCREEN_CAPTURER_CREATED_WITH_AUDIO
@ -554,8 +558,8 @@ std::unique_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create(
#endif
if (window_capturer && window_capturer->SelectSource(source.id)) {
window_capturer->FocusOnSelectedSource();
capturer.reset(new webrtc::DesktopAndCursorComposer(
std::move(window_capturer), options));
capturer = std::make_unique<webrtc::DesktopAndCursorComposer>(
std::move(window_capturer), options);
IncrementDesktopCaptureCounter(WINDOW_CAPTURER_CREATED);
}
break;
@ -616,7 +620,8 @@ DesktopCaptureDevice::DesktopCaptureDevice(
thread_.StartWithOptions(base::Thread::Options(thread_type, 0));
core_.reset(new Core(thread_.task_runner(), std::move(capturer), type));
core_ =
std::make_unique<Core>(thread_.task_runner(), std::move(capturer), type);
}
void DesktopCaptureDevice::SetMockTimeForTesting(

@ -7,7 +7,9 @@
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <algorithm>
#include <memory>
#include <string>
#include <utility>
@ -160,9 +162,9 @@ class FakeScreenCapturer : public webrtc::DesktopCapturer {
std::unique_ptr<webrtc::DesktopFrame> frame = CreateBasicFrame(size);
if (generate_inverted_frames_) {
frame.reset(new InvertedDesktopFrame(std::move(frame)));
frame = std::make_unique<InvertedDesktopFrame>(std::move(frame));
} else if (generate_cropped_frames_) {
frame.reset(new UnpackedDesktopFrame(std::move(frame)));
frame = std::make_unique<UnpackedDesktopFrame>(std::move(frame));
}
if (run_callback_asynchronously_) {
@ -467,8 +469,8 @@ TEST_F(DesktopCaptureDeviceTest, UnpackedFrame) {
base::WaitableEvent::InitialState::NOT_SIGNALED);
int frame_size = 0;
output_frame_.reset(new webrtc::BasicDesktopFrame(
webrtc::DesktopSize(kTestFrameWidth1, kTestFrameHeight1)));
output_frame_ = std::make_unique<webrtc::BasicDesktopFrame>(
webrtc::DesktopSize(kTestFrameWidth1, kTestFrameHeight1));
std::unique_ptr<media::MockVideoCaptureDeviceClient> client(
CreateMockVideoCaptureDeviceClient());
@ -516,8 +518,8 @@ TEST_F(DesktopCaptureDeviceTest, InvertedFrame) {
base::WaitableEvent::InitialState::NOT_SIGNALED);
int frame_size = 0;
output_frame_.reset(new webrtc::BasicDesktopFrame(
webrtc::DesktopSize(kTestFrameWidth1, kTestFrameHeight1)));
output_frame_ = std::make_unique<webrtc::BasicDesktopFrame>(
webrtc::DesktopSize(kTestFrameWidth1, kTestFrameHeight1));
std::unique_ptr<media::MockVideoCaptureDeviceClient> client(
CreateMockVideoCaptureDeviceClient());

@ -4,6 +4,8 @@
#include "content/browser/media/cdm_storage_impl.h"
#include <memory>
#include "base/bind.h"
#include "base/callback.h"
#include "base/files/file.h"
@ -51,7 +53,7 @@ class RunLoopWithExpectedCount {
DCHECK_GT(expected_quit_calls, 0);
DCHECK_EQ(remaining_quit_calls_, 0);
remaining_quit_calls_ = expected_quit_calls;
run_loop_.reset(new base::RunLoop());
run_loop_ = std::make_unique<base::RunLoop>();
run_loop_->Run();
}

@ -4,6 +4,8 @@
#include "content/browser/media/media_browsertest.h"
#include <memory>
#include "base/command_line.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
@ -71,7 +73,7 @@ void MediaBrowserTest::RunMediaTestPage(const std::string& html_page,
std::string query = media::GetURLQueryString(query_params);
std::unique_ptr<net::EmbeddedTestServer> http_test_server;
if (http) {
http_test_server.reset(new net::EmbeddedTestServer);
http_test_server = std::make_unique<net::EmbeddedTestServer>();
http_test_server->ServeFilesFromSourceDirectory(media::GetTestDataPath());
CHECK(http_test_server->Start());
gurl = http_test_server->GetURL("/" + html_page + "?" + query);

@ -7,6 +7,7 @@
#include <stddef.h>
#include <list>
#include <memory>
#include <vector>
#include "base/atomic_sequence_num.h"
@ -239,8 +240,9 @@ class MediaSessionImplBrowserTest : public ContentBrowserTest {
void SystemStopDucking() { media_session_->StopDucking(); }
void EnsureMediaSessionService() {
mock_media_session_service_.reset(new NiceMock<MockMediaSessionServiceImpl>(
shell()->web_contents()->GetMainFrame()));
mock_media_session_service_ =
std::make_unique<NiceMock<MockMediaSessionServiceImpl>>(
shell()->web_contents()->GetMainFrame());
}
void SetPlaybackState(blink::mojom::MediaSessionPlaybackState state) {

@ -99,9 +99,9 @@ class MediaSessionImplUmaTest : public RenderViewHostImplTestHarness {
contents()->GetMainFrame()->InitializeRenderFrameIfNeeded();
StartPlayer();
mock_media_session_service_.reset(
new testing::NiceMock<MockMediaSessionServiceImpl>(
contents()->GetMainFrame()));
mock_media_session_service_ =
std::make_unique<testing::NiceMock<MockMediaSessionServiceImpl>>(
contents()->GetMainFrame());
}
void TearDown() override {
@ -113,8 +113,8 @@ class MediaSessionImplUmaTest : public RenderViewHostImplTestHarness {
MediaSessionImpl* GetSession() { return MediaSessionImpl::Get(contents()); }
void StartPlayer() {
player_.reset(
new MockMediaSessionPlayerObserver(contents()->GetMainFrame()));
player_ = std::make_unique<MockMediaSessionPlayerObserver>(
contents()->GetMainFrame());
GetSession()->AddPlayer(player_.get(), kPlayerId,
media::MediaContentType::Persistent);
}

@ -96,9 +96,11 @@ class MediaSessionImplTest : public RenderViewHostTestHarness {
RenderViewHostTestHarness::SetUp();
player_observer_.reset(new MockMediaSessionPlayerObserver(main_rfh()));
mock_media_session_service_.reset(
new testing::NiceMock<MockMediaSessionServiceImpl>(main_rfh()));
player_observer_ =
std::make_unique<MockMediaSessionPlayerObserver>(main_rfh());
mock_media_session_service_ =
std::make_unique<testing::NiceMock<MockMediaSessionServiceImpl>>(
main_rfh());
// Connect to the Media Session service and bind |audio_focus_remote_| to
// it.

@ -4,6 +4,8 @@
#include "content/browser/media/session/media_session_service_impl.h"
#include <memory>
#include "content/browser/media/session/media_metadata_sanitizer.h"
#include "content/browser/media/session/media_session_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
@ -156,8 +158,9 @@ MediaSessionImpl* MediaSessionServiceImpl::GetMediaSession() {
void MediaSessionServiceImpl::Bind(
mojo::PendingReceiver<blink::mojom::MediaSessionService> receiver) {
receiver_.reset(new mojo::Receiver<blink::mojom::MediaSessionService>(
this, std::move(receiver)));
receiver_ =
std::make_unique<mojo::Receiver<blink::mojom::MediaSessionService>>(
this, std::move(receiver));
}
} // namespace content

@ -4,6 +4,8 @@
#include "content/browser/media/session/media_session_service_impl.h"
#include <memory>
#include "base/command_line.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
@ -125,8 +127,8 @@ class MediaSessionServiceImplBrowserTest : public ContentBrowserTest {
if (player_)
return;
player_.reset(new MockMediaSessionPlayerObserver(
shell()->web_contents()->GetMainFrame()));
player_ = std::make_unique<MockMediaSessionPlayerObserver>(
shell()->web_contents()->GetMainFrame());
MediaSessionImpl::Get(shell()->web_contents())
->AddPlayer(player_.get(), kPlayerId,

@ -4,6 +4,8 @@
#include "content/browser/media/session/pepper_playback_observer.h"
#include <memory>
#include "base/command_line.h"
#include "base/metrics/histogram_macros.h"
#include "content/browser/media/session/media_session_impl.h"
@ -69,8 +71,8 @@ void PepperPlaybackObserver::PepperStartsPlayback(
if (players_map_.count(id))
return;
players_map_[id].reset(new PepperPlayerDelegate(
render_frame_host, pp_instance));
players_map_[id] =
std::make_unique<PepperPlayerDelegate>(render_frame_host, pp_instance);
MediaSessionImpl::Get(contents_)->AddPlayer(
players_map_[id].get(), PepperPlayerDelegate::kPlayerId,

@ -74,7 +74,7 @@ class MojoSandboxTest : public ContentBrowserTest {
private:
void StartUtilityProcessOnIoThread(BeforeStartCallback callback) {
host_.reset(new UtilityProcessHost());
host_ = std::make_unique<UtilityProcessHost>();
host_->SetMetricsName("mojo_sandbox_test_process");
if (callback)
std::move(callback).Run(host_.get());

@ -4,6 +4,8 @@
#include <stdint.h>
#include <memory>
#include "base/bind.h"
#include "base/callback.h"
#include "base/command_line.h"
@ -102,7 +104,7 @@ class InterceptAndCancelDidCommitProvisionalLoad
void Wait(size_t number_of_messages) {
while (intercepted_messages_.size() < number_of_messages) {
loop_.reset(new base::RunLoop);
loop_ = std::make_unique<base::RunLoop>();
loop_->Run();
}
}
@ -1679,8 +1681,8 @@ class PreviewsStateBrowserTest : public ContentBrowserTest {
ASSERT_TRUE(embedded_test_server()->Start());
client_.reset(new PreviewsStateContentBrowserClient(
embedded_test_server()->GetURL("/title1.html")));
client_ = std::make_unique<PreviewsStateContentBrowserClient>(
embedded_test_server()->GetURL("/title1.html"));
client_->SetClient();
}

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "base/bind.h"
#include "base/command_line.h"
#include "base/macros.h"
@ -80,8 +82,8 @@ class PaymentAppBrowserTest : public ContentBrowserTest {
}
void SetUpOnMainThread() override {
https_server_.reset(
new net::EmbeddedTestServer(net::EmbeddedTestServer::TYPE_HTTPS));
https_server_ = std::make_unique<net::EmbeddedTestServer>(
net::EmbeddedTestServer::TYPE_HTTPS);
https_server_->ServeFilesFromSourceDirectory(GetTestDataFilePath());
ASSERT_TRUE(https_server_->Start());
ASSERT_TRUE(NavigateToURL(

@ -6,7 +6,9 @@
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <memory>
#include <utility>
#include "base/bind.h"
@ -229,8 +231,8 @@ void PresentationServiceImpl::StartPresentation(
}
start_presentation_request_id_ = GetNextRequestId();
pending_start_presentation_cb_.reset(
new NewPresentationCallbackWrapper(std::move(callback)));
pending_start_presentation_cb_ =
std::make_unique<NewPresentationCallbackWrapper>(std::move(callback));
PresentationRequest request({render_process_id_, render_frame_id_},
presentation_urls,
render_frame_host_->GetLastCommittedOrigin());

@ -6,6 +6,8 @@
#import <Cocoa/Cocoa.h>
#include <stdint.h>
#include <memory>
#include <utility>
#include "base/command_line.h"
@ -58,12 +60,12 @@ BrowserCompositorMac::BrowserCompositorMac(
weak_factory_(this) {
g_browser_compositors.Get().insert(this);
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
root_layer_ = std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR);
// Ensure that this layer draws nothing when it does not not have delegated
// content (otherwise this solid color will be flashed during navigation).
root_layer_->SetColor(SK_ColorTRANSPARENT);
delegated_frame_host_.reset(new DelegatedFrameHost(
frame_sink_id, this, true /* should_register_frame_sink_id */));
delegated_frame_host_ = std::make_unique<DelegatedFrameHost>(
frame_sink_id, this, true /* should_register_frame_sink_id */);
SetRenderWidgetHostIsHidden(render_widget_host_is_hidden);
}

@ -51,7 +51,8 @@ class GestureEventQueueTest : public testing::Test,
// testing::Test
void SetUp() override {
queue_.reset(new GestureEventQueue(this, this, this, DefaultConfig()));
queue_ =
std::make_unique<GestureEventQueue>(this, this, this, DefaultConfig());
}
void TearDown() override {
@ -67,7 +68,8 @@ class GestureEventQueueTest : public testing::Test,
gesture_config.fling_config.touchscreen_tap_suppression_config
.max_cancel_to_down_time =
base::TimeDelta::FromMilliseconds(max_cancel_to_down_time_ms);
queue_.reset(new GestureEventQueue(this, this, this, gesture_config));
queue_ =
std::make_unique<GestureEventQueue>(this, this, this, gesture_config);
}
// GestureEventQueueClient
@ -188,13 +190,14 @@ class GestureEventQueueTest : public testing::Test,
}
void set_synchronous_ack(blink::mojom::InputEventResultState ack_result) {
sync_ack_result_.reset(new blink::mojom::InputEventResultState(ack_result));
sync_ack_result_ =
std::make_unique<blink::mojom::InputEventResultState>(ack_result);
}
void set_sync_followup_event(WebInputEvent::Type type,
WebGestureDevice sourceDevice) {
sync_followup_event_.reset(new WebGestureEvent(
blink::SyntheticWebGestureEventBuilder::Build(type, sourceDevice)));
sync_followup_event_ = std::make_unique<WebGestureEvent>(
blink::SyntheticWebGestureEventBuilder::Build(type, sourceDevice));
}
unsigned GestureEventQueueSize() {

@ -230,11 +230,11 @@ class InputRouterImplTestBase : public testing::Test {
void SetUp() override {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
command_line->AppendSwitch(switches::kValidateInputEventStream);
client_.reset(new MockInputRouterImplClient());
disposition_handler_.reset(new MockInputDispositionHandler());
input_router_.reset(
new InputRouterImpl(client_.get(), disposition_handler_.get(),
&client_->input_router_client_, config_));
client_ = std::make_unique<MockInputRouterImplClient>();
disposition_handler_ = std::make_unique<MockInputDispositionHandler>();
input_router_ = std::make_unique<InputRouterImpl>(
client_.get(), disposition_handler_.get(),
&client_->input_router_client_, config_);
client_->set_input_router(input_router());
disposition_handler_->set_input_router(input_router());

@ -150,7 +150,7 @@ class MouseWheelEventQueueTest : public testing::Test,
base::test::SingleThreadTaskEnvironment::MainThreadType::UI),
acked_event_count_(0),
last_acked_event_state_(blink::mojom::InputEventResultState::kUnknown) {
queue_.reset(new MouseWheelEventQueue(this));
queue_ = std::make_unique<MouseWheelEventQueue>(this);
}
~MouseWheelEventQueueTest() override {}

@ -4,6 +4,7 @@
#include "content/browser/renderer_host/input/passthrough_touch_event_queue.h"
#include <memory>
#include <string>
#include <utility>
@ -66,9 +67,9 @@ PassthroughTouchEventQueue::PassthroughTouchEventQueue(
skip_touch_filter_(config.skip_touch_filter),
events_to_always_forward_(config.events_to_always_forward) {
if (config.touch_ack_timeout_supported) {
timeout_handler_.reset(
new TouchTimeoutHandler(this, config.desktop_touch_ack_timeout_delay,
config.mobile_touch_ack_timeout_delay));
timeout_handler_ = std::make_unique<TouchTimeoutHandler>(
this, config.desktop_touch_ack_timeout_delay,
config.mobile_touch_ack_timeout_delay);
}
}
@ -281,7 +282,7 @@ void PassthroughTouchEventQueue::SendTouchEventImmediately(
if (last_sent_touchevent_)
*last_sent_touchevent_ = touch->event;
else
last_sent_touchevent_.reset(new WebTouchEvent(touch->event));
last_sent_touchevent_ = std::make_unique<WebTouchEvent>(touch->event);
}
if (timeout_handler_)

@ -172,12 +172,12 @@ class PassthroughTouchEventQueueTest : public testing::Test,
}
void SetFollowupEvent(const WebTouchEvent& event) {
followup_touch_event_.reset(new WebTouchEvent(event));
followup_touch_event_ = std::make_unique<WebTouchEvent>(event);
}
void SetSyncAckResult(blink::mojom::InputEventResultState sync_ack_result) {
sync_ack_result_.reset(
new blink::mojom::InputEventResultState(sync_ack_result));
sync_ack_result_ =
std::make_unique<blink::mojom::InputEventResultState>(sync_ack_result);
}
void PressTouchPoint(float x, float y) {
@ -326,7 +326,7 @@ class PassthroughTouchEventQueueTest : public testing::Test,
}
void ResetQueueWithConfig(const PassthroughTouchEventQueue::Config& config) {
queue_.reset(new PassthroughTouchEventQueue(this, config));
queue_ = std::make_unique<PassthroughTouchEventQueue>(this, config);
queue_->OnHasTouchEventHandlers(true);
}

@ -129,7 +129,7 @@ class RenderWidgetHostLatencyTrackerTest
ui::LatencyTracker* viz_tracker() { return &viz_tracker_; }
void ResetHistograms() {
histogram_tester_.reset(new base::HistogramTester());
histogram_tester_ = std::make_unique<base::HistogramTester>();
}
const base::HistogramTester& histogram_tester() {

@ -28,7 +28,7 @@ class StylusTextSelectorTest : public testing::Test,
// Test implementation.
void SetUp() override {
selector_.reset(new StylusTextSelector(this));
selector_ = std::make_unique<StylusTextSelector>(this);
event_log_.clear();
}

@ -1819,7 +1819,7 @@ TEST_F(SyntheticGestureControllerTest, PointerTouchAction) {
param_list.push_back(param0);
param_list.push_back(param1);
params.PushPointerActionParamsList(param_list);
gesture.reset(new SyntheticPointerAction(params));
gesture = std::make_unique<SyntheticPointerAction>(params);
QueueSyntheticGesture(std::move(gesture));
pointer_touch_target->reset_num_dispatched_pointer_actions();
FlushInputUntilComplete();
@ -1837,7 +1837,7 @@ TEST_F(SyntheticGestureControllerTest, PointerTouchAction) {
param_list.clear();
param_list.push_back(param1);
params.PushPointerActionParamsList(param_list);
gesture.reset(new SyntheticPointerAction(params));
gesture = std::make_unique<SyntheticPointerAction>(params);
QueueSyntheticGesture(std::move(gesture));
pointer_touch_target->reset_num_dispatched_pointer_actions();
FlushInputUntilComplete();
@ -1879,7 +1879,7 @@ TEST_F(SyntheticGestureControllerTest, PointerMouseAction) {
SyntheticPointerActionParams::PointerActionType::PRESS);
param.set_position(gfx::PointF(183, 239));
params.PushPointerActionParams(param);
gesture.reset(new SyntheticPointerAction(params));
gesture = std::make_unique<SyntheticPointerAction>(params);
QueueSyntheticGesture(std::move(gesture));
pointer_mouse_target->reset_num_dispatched_pointer_actions();
FlushInputUntilComplete();
@ -1895,7 +1895,7 @@ TEST_F(SyntheticGestureControllerTest, PointerMouseAction) {
SyntheticPointerActionParams::PointerActionType::MOVE);
param.set_position(gfx::PointF(254, 279));
params.PushPointerActionParams(param);
gesture.reset(new SyntheticPointerAction(params));
gesture = std::make_unique<SyntheticPointerAction>(params);
QueueSyntheticGesture(std::move(gesture));
pointer_mouse_target->reset_num_dispatched_pointer_actions();
FlushInputUntilComplete();
@ -1910,7 +1910,7 @@ TEST_F(SyntheticGestureControllerTest, PointerMouseAction) {
param.set_pointer_action_type(
SyntheticPointerActionParams::PointerActionType::RELEASE);
params.PushPointerActionParams(param);
gesture.reset(new SyntheticPointerAction(params));
gesture = std::make_unique<SyntheticPointerAction>(params);
QueueSyntheticGesture(std::move(gesture));
pointer_mouse_target->reset_num_dispatched_pointer_actions();
FlushInputUntilComplete();
@ -1952,7 +1952,7 @@ TEST_F(SyntheticGestureControllerTest, PointerPenAction) {
SyntheticPointerActionParams::PointerActionType::PRESS);
param.set_position(gfx::PointF(183, 239));
params.PushPointerActionParams(param);
gesture.reset(new SyntheticPointerAction(params));
gesture = std::make_unique<SyntheticPointerAction>(params);
QueueSyntheticGesture(std::move(gesture));
pointer_pen_target->reset_num_dispatched_pointer_actions();
FlushInputUntilComplete();
@ -1968,7 +1968,7 @@ TEST_F(SyntheticGestureControllerTest, PointerPenAction) {
SyntheticPointerActionParams::PointerActionType::MOVE);
param.set_position(gfx::PointF(254, 279));
params.PushPointerActionParams(param);
gesture.reset(new SyntheticPointerAction(params));
gesture = std::make_unique<SyntheticPointerAction>(params);
QueueSyntheticGesture(std::move(gesture));
pointer_pen_target->reset_num_dispatched_pointer_actions();
FlushInputUntilComplete();
@ -1983,7 +1983,7 @@ TEST_F(SyntheticGestureControllerTest, PointerPenAction) {
param.set_pointer_action_type(
SyntheticPointerActionParams::PointerActionType::RELEASE);
params.PushPointerActionParams(param);
gesture.reset(new SyntheticPointerAction(params));
gesture = std::make_unique<SyntheticPointerAction>(params);
QueueSyntheticGesture(std::move(gesture));
pointer_pen_target->reset_num_dispatched_pointer_actions();
FlushInputUntilComplete();
@ -1998,7 +1998,7 @@ TEST_F(SyntheticGestureControllerTest, PointerPenAction) {
param.set_pointer_action_type(
SyntheticPointerActionParams::PointerActionType::LEAVE);
params.PushPointerActionParams(param);
gesture.reset(new SyntheticPointerAction(params));
gesture = std::make_unique<SyntheticPointerAction>(params);
QueueSyntheticGesture(std::move(gesture));
pointer_pen_target->reset_num_dispatched_pointer_actions();
FlushInputUntilComplete();

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include "base/bind.h"
#include "base/callback.h"
#include "base/run_loop.h"
@ -144,7 +146,7 @@ IN_PROC_BROWSER_TEST_F(SyntheticInputTest, SmoothScrollWheel) {
// Use PrecisePixel to avoid animating.
params.granularity = ui::ScrollGranularity::kScrollByPrecisePixel;
runner_.reset(new base::RunLoop());
runner_ = std::make_unique<base::RunLoop>();
std::unique_ptr<SyntheticSmoothScrollGesture> gesture(
new SyntheticSmoothScrollGesture(params));

@ -4,6 +4,8 @@
#include "content/browser/renderer_host/input/synthetic_pinch_gesture.h"
#include <memory>
#include "content/browser/renderer_host/input/synthetic_touchpad_pinch_gesture.h"
#include "content/browser/renderer_host/input/synthetic_touchscreen_pinch_gesture.h"
@ -25,10 +27,11 @@ SyntheticGesture::Result SyntheticPinchGesture::ForwardInputEvents(
DCHECK_NE(content::mojom::GestureSourceType::kDefaultInput, source_type);
if (source_type == content::mojom::GestureSourceType::kTouchInput) {
lazy_gesture_.reset(new SyntheticTouchscreenPinchGesture(params_));
lazy_gesture_ =
std::make_unique<SyntheticTouchscreenPinchGesture>(params_);
} else {
DCHECK_EQ(content::mojom::GestureSourceType::kMouseInput, source_type);
lazy_gesture_.reset(new SyntheticTouchpadPinchGesture(params_));
lazy_gesture_ = std::make_unique<SyntheticTouchpadPinchGesture>(params_);
}
}

@ -4,6 +4,8 @@
#include "content/browser/renderer_host/input/synthetic_smooth_drag_gesture.h"
#include <memory>
namespace content {
SyntheticSmoothDragGesture::SyntheticSmoothDragGesture(
@ -55,7 +57,7 @@ bool SyntheticSmoothDragGesture::InitializeMoveGesture(
move_params.prevent_fling = true;
move_params.input_type = GetInputSourceType(gesture_type);
move_params.add_slop = false;
move_gesture_.reset(new SyntheticSmoothMoveGesture(move_params));
move_gesture_ = std::make_unique<SyntheticSmoothMoveGesture>(move_params);
return true;
}
return false;

@ -88,8 +88,8 @@ class TapSuppressionControllerTest : public testing::Test {
protected:
// testing::Test
void SetUp() override {
tap_suppression_controller_.reset(
new MockTapSuppressionController(GetConfig()));
tap_suppression_controller_ =
std::make_unique<MockTapSuppressionController>(GetConfig());
}
void TearDown() override { tap_suppression_controller_.reset(); }
@ -201,8 +201,8 @@ TEST_F(TapSuppressionControllerTest, GFCAckBeforeTapSufficientlyLateTapDown) {
TEST_F(TapSuppressionControllerTest, NoSuppressionIfDisabled) {
TapSuppressionController::Config disabled_config;
disabled_config.enabled = false;
tap_suppression_controller_.reset(
new MockTapSuppressionController(disabled_config));
tap_suppression_controller_ =
std::make_unique<MockTapSuppressionController>(disabled_config);
// Send GestureFlingCancel Ack.
tap_suppression_controller_->NotifyGestureFlingCancelStoppedFling();

@ -4,6 +4,8 @@
#include "content/browser/renderer_host/input/touch_emulator.h"
#include <memory>
#include "base/containers/queue.h"
#include "base/time/time.h"
#include "build/build_config.h"
@ -107,8 +109,8 @@ void TouchEmulator::Enable(Mode mode,
mode_ != mode) {
mode_ = mode;
gesture_provider_config_type_ = config_type;
gesture_provider_.reset(new ui::FilteredGestureProvider(
GetEmulatorGestureProviderConfig(config_type, mode), this));
gesture_provider_ = std::make_unique<ui::FilteredGestureProvider>(
GetEmulatorGestureProviderConfig(config_type, mode), this);
gesture_provider_->SetDoubleTapSupportForPageEnabled(double_tap_enabled_);
// TODO(dgozman): Use synthetic secondary touch to support multi-touch.
gesture_provider_->SetMultiTouchZoomSupportEnabled(

@ -47,7 +47,7 @@ class TouchEmulatorTest : public testing::Test,
// testing::Test
void SetUp() override {
emulator_.reset(new TouchEmulator(this, 1.0f));
emulator_ = std::make_unique<TouchEmulator>(this, 1.0f);
emulator_->SetDoubleTapSupportForPageEnabled(false);
emulator_->Enable(TouchEmulator::Mode::kEmulatingTouchFromMouse,
ui::GestureProviderConfigType::GENERIC_MOBILE);

@ -312,14 +312,14 @@ class MediaDevicesManagerTest : public ::testing::Test {
base::ThreadTaskRunnerHandle::Get(), kIgnoreLogMessageCB);
video_capture_manager_ = new VideoCaptureManager(
std::move(video_capture_provider), kIgnoreLogMessageCB);
media_devices_manager_.reset(new MediaDevicesManager(
media_devices_manager_ = std::make_unique<MediaDevicesManager>(
audio_system_.get(), video_capture_manager_,
base::BindRepeating(
&MockMediaDevicesManagerClient::StopRemovedInputDevice,
base::Unretained(&media_devices_manager_client_)),
base::BindRepeating(
&MockMediaDevicesManagerClient::InputDevicesChangedUI,
base::Unretained(&media_devices_manager_client_))));
base::Unretained(&media_devices_manager_client_)));
media_devices_manager_->set_salt_and_origin_callback_for_testing(
base::BindRepeating(&GetSaltAndOrigin));
media_devices_manager_->SetPermissionChecker(

@ -10,6 +10,7 @@
#include <algorithm>
#include <cctype>
#include <list>
#include <memory>
#include <vector>
#include "base/bind.h"
@ -530,12 +531,12 @@ class MediaStreamManager::DeviceRequest {
requested_video_device_id.c_str()));
target_process_id_ = requesting_process_id;
target_frame_id_ = requesting_frame_id;
ui_request_.reset(new MediaStreamRequest(
ui_request_ = std::make_unique<MediaStreamRequest>(
requesting_process_id, requesting_frame_id, page_request_id,
salt_and_origin.origin.GetURL(), user_gesture, request_type_,
requested_audio_device_id, requested_video_device_id, audio_type_,
video_type_, controls.disable_local_echo,
controls.request_pan_tilt_zoom_permission));
controls.request_pan_tilt_zoom_permission);
}
// Creates a tab capture specific MediaStreamRequest object that is used by
@ -545,11 +546,11 @@ class MediaStreamManager::DeviceRequest {
DCHECK(!ui_request_);
target_process_id_ = target_render_process_id;
target_frame_id_ = target_render_frame_id;
ui_request_.reset(new MediaStreamRequest(
ui_request_ = std::make_unique<MediaStreamRequest>(
target_render_process_id, target_render_frame_id, page_request_id,
salt_and_origin.origin.GetURL(), user_gesture, request_type_, "", "",
audio_type_, video_type_, controls.disable_local_echo,
/*request_pan_tilt_zoom_permission=*/false));
/*request_pan_tilt_zoom_permission=*/false);
}
bool HasUIRequest() const { return ui_request_.get() != nullptr; }
@ -2006,12 +2007,12 @@ void MediaStreamManager::InitializeMaybeAsync(
// Using base::Unretained(this) is safe because |this| owns and therefore
// outlives |media_devices_manager_|.
media_devices_manager_.reset(new MediaDevicesManager(
media_devices_manager_ = std::make_unique<MediaDevicesManager>(
audio_system_, video_capture_manager_,
base::BindRepeating(&MediaStreamManager::StopRemovedDevice,
base::Unretained(this)),
base::BindRepeating(&MediaStreamManager::NotifyDevicesChanged,
base::Unretained(this))));
base::Unretained(this)));
}
void MediaStreamManager::Opened(

@ -104,8 +104,7 @@ class VideoCaptureBufferPoolTest
std::unique_ptr<media::VideoCaptureBufferHandle> buffer_handle =
pool_->GetHandleForInProcessAccess(buffer_id);
return std::unique_ptr<Buffer>(
new Buffer(pool_, std::move(buffer_handle), buffer_id));
return std::make_unique<Buffer>(pool_, std::move(buffer_handle), buffer_id);
}
base::test::SingleThreadTaskEnvironment task_environment_;

@ -192,10 +192,10 @@ class VideoCaptureControllerTest
std::make_unique<MockLaunchedVideoCaptureDevice>();
mock_launched_device_ = mock_launched_device.get();
controller_->OnDeviceLaunched(std::move(mock_launched_device));
client_a_.reset(
new MockVideoCaptureControllerEventHandler(controller_.get()));
client_b_.reset(
new MockVideoCaptureControllerEventHandler(controller_.get()));
client_a_ = std::make_unique<MockVideoCaptureControllerEventHandler>(
controller_.get());
client_b_ = std::make_unique<MockVideoCaptureControllerEventHandler>(
controller_.get());
}
void TearDown() override { base::RunLoop().RunUntilIdle(); }
@ -210,11 +210,11 @@ class VideoCaptureControllerTest
controller_->GetWeakPtrForIOThread(), GetIOThreadTaskRunner({})),
buffer_pool_, media::VideoCaptureJpegDecoderFactoryCB()));
#else
device_client_.reset(new media::VideoCaptureDeviceClient(
device_client_ = std::make_unique<media::VideoCaptureDeviceClient>(
media::VideoCaptureBufferType::kSharedMemory,
std::make_unique<media::VideoFrameReceiverOnTaskRunner>(
controller_->GetWeakPtrForIOThread(), GetIOThreadTaskRunner({})),
buffer_pool_));
buffer_pool_);
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
}

@ -248,7 +248,7 @@ class VideoCaptureManagerTest : public testing::Test {
protected:
void SetUp() override {
listener_.reset(new MockMediaStreamProviderListener());
listener_ = std::make_unique<MockMediaStreamProviderListener>();
auto video_capture_device_factory =
std::make_unique<WrappedDeviceFactory>();
video_capture_device_factory_ = video_capture_device_factory.get();
@ -268,7 +268,7 @@ class VideoCaptureManagerTest : public testing::Test {
video_capture_device_factory_->SetToDefaultDevicesConfig(
kNumberOfFakeDevices);
vcm_->RegisterListener(listener_.get());
frame_observer_.reset(new MockFrameObserver());
frame_observer_ = std::make_unique<MockFrameObserver>();
base::RunLoop run_loop;
vcm_->EnumerateDevices(

@ -113,8 +113,8 @@ class VideoCaptureTest : public testing::Test,
&VideoCaptureTest::CreateFakeUI, base::Unretained(this)));
// Create a Host and connect it to a simulated IPC channel.
host_.reset(new VideoCaptureHost(0 /* render_process_id */,
media_stream_manager_.get()));
host_ = std::make_unique<VideoCaptureHost>(0 /* render_process_id */,
media_stream_manager_.get());
OpenSession();
}

@ -4,6 +4,8 @@
#include "content/browser/renderer_host/mock_render_widget_host.h"
#include <memory>
#include "components/viz/test/mock_compositor_frame_sink_client.h"
#include "content/browser/renderer_host/frame_token_message_queue.h"
#include "content/test/test_render_widget_host.h"
@ -22,8 +24,8 @@ void MockRenderWidgetHost::OnTouchEventAck(
}
void MockRenderWidgetHost::DisableGestureDebounce() {
input_router_.reset(new InputRouterImpl(this, this, fling_scheduler_.get(),
InputRouter::Config()));
input_router_ = std::make_unique<InputRouterImpl>(
this, this, fling_scheduler_.get(), InputRouter::Config());
}
void MockRenderWidgetHost::ExpectForceEnableZoom(bool enable) {
@ -35,7 +37,7 @@ void MockRenderWidgetHost::ExpectForceEnableZoom(bool enable) {
}
void MockRenderWidgetHost::SetupForInputRouterTest() {
input_router_.reset(new MockInputRouter(this));
input_router_ = std::make_unique<MockInputRouter>(this);
}
// static

@ -4,6 +4,7 @@
#include "content/browser/renderer_host/navigation_entry_impl.h"
#include <memory>
#include <string>
#include <utility>
@ -65,17 +66,17 @@ class NavigationEntryTest : public testing::Test {
NavigationEntryTest() : instance_(nullptr) {}
void SetUp() override {
entry1_.reset(new NavigationEntryImpl);
entry1_ = std::make_unique<NavigationEntryImpl>();
const url::Origin kInitiatorOrigin =
url::Origin::Create(GURL("https://initiator.example.com"));
instance_ = SiteInstanceImpl::Create(&browser_context_);
entry2_.reset(new NavigationEntryImpl(
entry2_ = std::make_unique<NavigationEntryImpl>(
instance_, GURL("test:url"),
Referrer(GURL("from"), network::mojom::ReferrerPolicy::kDefault),
kInitiatorOrigin, u"title", ui::PAGE_TRANSITION_TYPED, false,
nullptr /* blob_url_loader_factory */));
nullptr /* blob_url_loader_factory */);
}
void TearDown() override {}

@ -4,19 +4,17 @@
#include "content/browser/renderer_host/pepper/browser_ppapi_host_test.h"
#include <memory>
#include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h"
namespace content {
BrowserPpapiHostTest::BrowserPpapiHostTest() : sink_() {
ppapi_host_.reset(
new BrowserPpapiHostImpl(&sink_,
ppapi::PpapiPermissions::AllPermissions(),
std::string(),
base::FilePath(),
base::FilePath(),
false /* in_process */,
false /* external_plugin */));
ppapi_host_ = std::make_unique<BrowserPpapiHostImpl>(
&sink_, ppapi::PpapiPermissions::AllPermissions(), std::string(),
base::FilePath(), base::FilePath(), false /* in_process */,
false /* external_plugin */);
ppapi_host_->set_plugin_process(base::Process::Current());
}

@ -4,6 +4,7 @@
#include "content/browser/renderer_host/pepper/pepper_file_ref_host.h"
#include <memory>
#include <string>
#include "content/browser/renderer_host/pepper/pepper_external_file_ref_backend.h"
@ -74,10 +75,9 @@ PepperFileRefHost::PepperFileRefHost(BrowserPpapiHost* host,
return;
}
backend_.reset(new PepperInternalFileRefBackend(host->GetPpapiHost(),
render_process_id,
file_system_host->AsWeakPtr(),
path));
backend_ = std::make_unique<PepperInternalFileRefBackend>(
host->GetPpapiHost(), render_process_id, file_system_host->AsWeakPtr(),
path);
}
PepperFileRefHost::PepperFileRefHost(BrowserPpapiHost* host,
@ -97,8 +97,8 @@ PepperFileRefHost::PepperFileRefHost(BrowserPpapiHost* host,
return;
}
backend_.reset(new PepperExternalFileRefBackend(
host->GetPpapiHost(), render_process_id, external_path));
backend_ = std::make_unique<PepperExternalFileRefBackend>(
host->GetPpapiHost(), render_process_id, external_path);
}
PepperFileRefHost::~PepperFileRefHost() {}

@ -24,10 +24,9 @@ class PepperFileSystemBrowserHostTest : public testing::Test,
void SetUp() override {
PP_Instance pp_instance = 12345;
PP_Resource pp_resource = 67890;
host_.reset(new PepperFileSystemBrowserHost(GetBrowserPpapiHost(),
pp_instance,
pp_resource,
PP_FILESYSTEMTYPE_ISOLATED));
host_ = std::make_unique<PepperFileSystemBrowserHost>(
GetBrowserPpapiHost(), pp_instance, pp_resource,
PP_FILESYSTEMTYPE_ISOLATED);
}
void TearDown() override { host_.reset(); }

@ -35,7 +35,8 @@ class PepperGamepadHostTest : public testing::Test,
~PepperGamepadHostTest() override {}
void ConstructService(const device::Gamepads& test_data) {
service_.reset(new device::GamepadServiceTestConstructor(test_data));
service_ =
std::make_unique<device::GamepadServiceTestConstructor>(test_data);
}
device::GamepadService* gamepad_service() {

@ -6,6 +6,7 @@
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <utility>
#include "base/bind.h"
@ -141,13 +142,9 @@ PepperRendererConnection::PepperRendererConnection(
plugin_service_(plugin_service),
profile_data_directory_(storage_partition->GetPath()) {
// Only give the renderer permission for stable APIs.
in_process_host_.reset(new BrowserPpapiHostImpl(this,
ppapi::PpapiPermissions(),
"",
base::FilePath(),
base::FilePath(),
true /* in_process */,
false /* external_plugin */));
in_process_host_ = std::make_unique<BrowserPpapiHostImpl>(
this, ppapi::PpapiPermissions(), "", base::FilePath(), base::FilePath(),
true /* in_process */, false /* external_plugin */);
}
PepperRendererConnection::~PepperRendererConnection() {}
@ -221,8 +218,8 @@ void PepperRendererConnection::OnMsgCreateResourceHostsFromHost(
base::FilePath external_path;
if (ppapi::UnpackMessage<PpapiHostMsg_FileRef_CreateForRawFS>(
nested_msg, &external_path)) {
resource_host.reset(new PepperFileRefHost(
host, instance, params.pp_resource(), external_path));
resource_host = std::make_unique<PepperFileRefHost>(
host, instance, params.pp_resource(), external_path);
}
} else if (nested_msg.type() ==
PpapiHostMsg_FileSystem_CreateFromRenderer::ID) {

@ -4,6 +4,7 @@
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include <memory>
#include <set>
#include <string>
#include <utility>
@ -737,7 +738,7 @@ class RenderFrameHostImplBeforeUnloadBrowserTest
protected:
void SetUpOnMainThread() override {
RenderFrameHostImplBrowserTest::SetUpOnMainThread();
dialog_manager_.reset(new TestJavaScriptDialogManager);
dialog_manager_ = std::make_unique<TestJavaScriptDialogManager>();
web_contents()->SetDelegate(dialog_manager_.get());
}

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include <vector>
#include "base/bind.h"
@ -514,7 +515,7 @@ class DocumentLoadObserver : WebContentsObserver {
void Wait() {
if (loaded_)
return;
run_loop_.reset(new base::RunLoop());
run_loop_ = std::make_unique<base::RunLoop>();
run_loop_->Run();
}

@ -6,6 +6,7 @@
#include <algorithm>
#include <deque>
#include <memory>
#include <vector>
#include "base/debug/crash_logging.h"
@ -1885,8 +1886,10 @@ void RenderWidgetHostInputEventRouter::DispatchEventToTarget(
}
TouchEmulator* RenderWidgetHostInputEventRouter::GetTouchEmulator() {
if (!touch_emulator_)
touch_emulator_.reset(new TouchEmulator(this, last_device_scale_factor_));
if (!touch_emulator_) {
touch_emulator_ =
std::make_unique<TouchEmulator>(this, last_device_scale_factor_);
}
return touch_emulator_.get();
}

@ -6,6 +6,7 @@
#include <stdint.h>
#include <memory>
#include <tuple>
#include <utility>
@ -110,7 +111,7 @@ class RenderWidgetHostViewChildFrameTest : public testing::Test {
}
void SetUpEnvironment(bool use_zoom_for_device_scale_factor) {
browser_context_.reset(new TestBrowserContext);
browser_context_ = std::make_unique<TestBrowserContext>();
// ImageTransportFactory doesn't exist on Android.
#if !defined(OS_ANDROID)

@ -7,6 +7,7 @@
#import <Carbon/Carbon.h>
#include <limits>
#include <memory>
#include <utility>
#include "base/bind.h"
@ -190,8 +191,8 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget)
viz::FrameSinkId frame_sink_id = host()->GetFrameSinkId();
browser_compositor_.reset(new BrowserCompositorMac(
this, this, host()->is_hidden(), display_, frame_sink_id));
browser_compositor_ = std::make_unique<BrowserCompositorMac>(
this, this, host()->is_hidden(), display_, frame_sink_id);
DCHECK(![GetInProcessNSView() window]);
host()->SetView(this);
@ -212,7 +213,7 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget)
ignore_result(owner_delegate->GetWebkitPreferencesForWidget());
}
cursor_manager_.reset(new CursorManager(this));
cursor_manager_ = std::make_unique<CursorManager>(this);
if (GetTextInputManager())
GetTextInputManager()->AddObserver(this);
@ -1402,10 +1403,12 @@ RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() {
void RenderWidgetHostViewMac::SetTextInputActive(bool active) {
const bool should_enable_password_input =
active && GetTextInputType() == ui::TEXT_INPUT_TYPE_PASSWORD;
if (should_enable_password_input)
password_input_enabler_.reset(new ui::ScopedPasswordInputEnabler());
else
if (should_enable_password_input) {
password_input_enabler_ =
std::make_unique<ui::ScopedPasswordInputEnabler>();
} else {
password_input_enabler_.reset();
}
}
MouseWheelPhaseHandler* RenderWidgetHostViewMac::GetMouseWheelPhaseHandler() {

@ -4,6 +4,8 @@
#include "content/browser/renderer_host/render_widget_targeter.h"
#include <memory>
#include "base/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
@ -312,13 +314,13 @@ void RenderWidgetTargeter::QueryClient(
async_depth_++;
TracingUmaTracker tracker("Event.AsyncTargeting.ResponseTime");
async_hit_test_timeout_.reset(new OneShotTimeoutMonitor(
async_hit_test_timeout_ = std::make_unique<OneShotTimeoutMonitor>(
base::BindOnce(
&RenderWidgetTargeter::AsyncHitTestTimedOut,
weak_ptr_factory_.GetWeakPtr(), target->GetWeakPtr(), target_location,
last_request_target ? last_request_target->GetWeakPtr() : nullptr,
last_target_location),
async_hit_test_timeout_delay_));
async_hit_test_timeout_delay_);
target_client.set_disconnect_handler(base::BindOnce(
&RenderWidgetTargeter::OnInputTargetDisconnect,

@ -112,7 +112,7 @@ class ServiceWorkerContainerHostTest : public testing::Test {
mojo::SetDefaultProcessErrorHandler(base::BindRepeating(
&ServiceWorkerContainerHostTest::OnMojoError, base::Unretained(this)));
helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath()));
helper_ = std::make_unique<EmbeddedWorkerTestHelper>(base::FilePath());
context_ = helper_->context();
script_url_ = GURL("https://www.example.com/service_worker.js");

@ -28,7 +28,7 @@ class ServiceWorkerContextCoreTest : public testing::Test,
: task_environment_(BrowserTaskEnvironment::IO_MAINLOOP) {}
void SetUp() override {
helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath()));
helper_ = std::make_unique<EmbeddedWorkerTestHelper>(base::FilePath());
}
void TearDown() override {

@ -6,6 +6,8 @@
#include <stdint.h>
#include <memory>
#include "base/bind.h"
#include "base/files/scoped_temp_dir.h"
#include "base/run_loop.h"
@ -162,7 +164,7 @@ class ServiceWorkerContextTest : public ServiceWorkerContextCoreObserver,
: task_environment_(BrowserTaskEnvironment::IO_MAINLOOP) {}
void SetUp() override {
helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath()));
helper_ = std::make_unique<EmbeddedWorkerTestHelper>(base::FilePath());
helper_->context_wrapper()->AddObserver(this);
}
@ -1129,7 +1131,7 @@ TEST_P(ServiceWorkerContextRecoveryTest, DeleteAndStartOver) {
// Reinitialize the helper to test on-disk storage.
base::FilePath user_data_directory;
ASSERT_NO_FATAL_FAILURE(GetTemporaryDirectory(&user_data_directory));
helper_.reset(new EmbeddedWorkerTestHelper(user_data_directory));
helper_ = std::make_unique<EmbeddedWorkerTestHelper>(user_data_directory);
helper_->context_wrapper()->AddObserver(this);
}

@ -4,6 +4,8 @@
#include "content/browser/service_worker/service_worker_context_watcher.h"
#include <memory>
#include "base/bind.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
@ -126,7 +128,7 @@ class ServiceWorkerContextWatcherTest : public testing::Test {
: task_environment_(BrowserTaskEnvironment::IO_MAINLOOP) {}
void SetUp() override {
helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath()));
helper_ = std::make_unique<EmbeddedWorkerTestHelper>(base::FilePath());
base::RunLoop().RunUntilIdle();
}

@ -4,6 +4,7 @@
#include "content/browser/service_worker/service_worker_controllee_request_handler.h"
#include <memory>
#include <utility>
#include <vector>
@ -89,7 +90,7 @@ class ServiceWorkerControlleeRequestHandlerTest : public testing::Test {
void SetUp() override { SetUpWithHelper(/*is_parent_frame_secure=*/true); }
void SetUpWithHelper(bool is_parent_frame_secure) {
helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath()));
helper_ = std::make_unique<EmbeddedWorkerTestHelper>(base::FilePath());
// A new unstored registration/version.
scope_ = GURL("https://host/scope/");

@ -3,6 +3,8 @@
// found in the LICENSE file.
#include <stdint.h>
#include <memory>
#include <tuple>
#include "base/barrier_closure.h"
@ -169,7 +171,7 @@ class ServiceWorkerJobTest : public testing::Test {
BrowserTaskEnvironment::IO_MAINLOOP) {}
void SetUp() override {
helper_.reset(new EmbeddedWorkerTestHelper(base::FilePath()));
helper_ = std::make_unique<EmbeddedWorkerTestHelper>(base::FilePath());
}
void TearDown() override { helper_.reset(); }

@ -4,6 +4,7 @@
#include "content/browser/service_worker/service_worker_process_manager.h"
#include <memory>
#include <string>
#include "base/macros.h"
@ -62,12 +63,12 @@ class ServiceWorkerProcessManagerTest : public testing::Test {
ServiceWorkerProcessManagerTest() {}
void SetUp() override {
browser_context_.reset(new TestBrowserContext);
process_manager_.reset(
new ServiceWorkerProcessManager(browser_context_.get()));
browser_context_ = std::make_unique<TestBrowserContext>();
process_manager_ =
std::make_unique<ServiceWorkerProcessManager>(browser_context_.get());
script_url_ = GURL("http://www.example.com/sw.js");
render_process_host_factory_.reset(
new SiteInstanceRenderProcessHostFactory());
render_process_host_factory_ =
std::make_unique<SiteInstanceRenderProcessHostFactory>();
RenderProcessHostImpl::set_render_process_host_factory_for_testing(
render_process_host_factory_.get());
}

@ -6530,9 +6530,9 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, CSSVisibilityChanged) {
std::vector<std::unique_ptr<RenderWidgetHostVisibilityObserver>>
hide_widget_host_observers(child_widget_hosts.size());
for (size_t index = 0U; index < child_widget_hosts.size(); ++index) {
hide_widget_host_observers[index].reset(
new RenderWidgetHostVisibilityObserver(child_widget_hosts[index],
false));
hide_widget_host_observers[index] =
std::make_unique<RenderWidgetHostVisibilityObserver>(
child_widget_hosts[index], false);
}
EXPECT_TRUE(ExecuteScript(shell(), hide_script));
@ -6546,9 +6546,9 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, CSSVisibilityChanged) {
std::vector<std::unique_ptr<RenderWidgetHostVisibilityObserver>>
show_widget_host_observers(child_widget_hosts.size());
for (size_t index = 0U; index < child_widget_hosts.size(); ++index) {
show_widget_host_observers[index].reset(
new RenderWidgetHostVisibilityObserver(child_widget_hosts[index],
true));
show_widget_host_observers[index] =
std::make_unique<RenderWidgetHostVisibilityObserver>(
child_widget_hosts[index], true);
}
EXPECT_TRUE(ExecuteScript(shell(), show_script));
@ -13722,7 +13722,7 @@ class ClosePageBeforeCommitHelper : public DidCommitNavigationInterceptor {
: DidCommitNavigationInterceptor(web_contents) {}
void Wait() {
run_loop_.reset(new base::RunLoop());
run_loop_ = std::make_unique<base::RunLoop>();
run_loop_->Run();
run_loop_.reset();
}
@ -14214,8 +14214,8 @@ IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTouchActionTest,
WaitForHitTestData(child->current_frame_host());
// Navigation destroys the previous RenderWidgetHost, so we need to begin
// observing the new renderer main thread associated with the child frame.
child_thread_observer.reset(new MainThreadFrameObserver(
child->current_frame_host()->GetRenderWidgetHost()));
child_thread_observer = std::make_unique<MainThreadFrameObserver>(
child->current_frame_host()->GetRenderWidgetHost());
rwhv_child = static_cast<RenderWidgetHostViewBase*>(
child->current_frame_host()->GetRenderWidgetHost()->GetView());

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include <tuple>
#include "base/bind.h"
@ -703,7 +704,7 @@ class SetMouseCaptureInterceptor
msg_received_ = false;
return;
}
run_loop_.reset(new base::RunLoop());
run_loop_ = std::make_unique<base::RunLoop>();
run_loop_->Run();
run_loop_.reset();
msg_received_ = false;
@ -3293,7 +3294,7 @@ class TooltipMonitor : public CursorManager::TooltipObserver {
~TooltipMonitor() override {}
void Reset() {
run_loop_.reset(new base::RunLoop);
run_loop_ = std::make_unique<base::RunLoop>();
tooltips_received_.clear();
}

Some files were not shown because too many files have changed in this diff Show More