Apply modernize-make-unique to target_os="win"
This is a large-scale change: go/chromium-modernize-make-unique Bug: 1194272 Change-Id: I5d3a7db1b5e9097bb184e200e10c1cf9661a8f46 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2861443 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@{#878154}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
0c98a3c2b2
commit
560859df8d
cc/trees
chrome
browser
importer
media_galleries
process_singleton_win_unittest.ccprofiles
safe_browsing
incident_reporting
spellchecker
taskbar
themes
ui
views
win
chrome_cleaner
engines
controllers
executables
ipc
logging
cleaner_logging_service_unittest.ccpending_logs_service_unittest.ccreporter_logging_service_unittest.cc
os
test
chrome_elf
third_party_dlls
common
credential_provider
extension
gaiacp
associated_user_validator_unittests.ccevent_logs_upload_manager.ccgaia_credential_base.ccgaia_credential_base_unittests.ccgaia_credential_provider_unittests.ccgem_device_details_manager.cc
test
installer
setup
util
test
cloud_print/virtual_driver/win/port_monitor
components
policy
core
common
storage_monitor
content/browser
accessibility
accessibility_win_browsertest.ccbrowser_accessibility_com_win.ccbrowser_accessibility_state_impl_win.ccbrowser_accessibility_win_unittest.cc
browser_main_loop.ccbrowser_main_runner_impl.ccrenderer_host
screenlock_monitor
device
base
bluetooth
gamepad
media
audio
capture
video
device_monitors
gpu
midi
net
dns
http
proxy_resolution
win
socket
remoting
base
host
sandbox/win/src
services
device
serial
preferences
viz
public
ui
@ -118,13 +118,11 @@ TEST_P(LayerTreeHostFiltersPixelTest, BackdropFilterBlurRect) {
|
||||
float average_error_allowed_in_bad_pixels = 1.f;
|
||||
int large_error_allowed = 1;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_.reset(new FuzzyPixelComparator(
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error,
|
||||
percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels,
|
||||
large_error_allowed,
|
||||
small_error_allowed));
|
||||
percentage_pixels_large_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed);
|
||||
#endif
|
||||
|
||||
RunPixelTest(background,
|
||||
@ -184,11 +182,11 @@ TEST_P(LayerTreeHostFiltersPixelTest, BackdropFilterBlurRadius) {
|
||||
// Windows using Dawn D3D12 has 4044 pixels off by max of 2.
|
||||
if (use_d3d12())
|
||||
percentage_pixels_large_error = 2.5275f; // 4044px / (400*400)
|
||||
pixel_comparator_.reset(new FuzzyPixelComparator(
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed));
|
||||
small_error_allowed);
|
||||
#endif
|
||||
RunPixelTest(
|
||||
background,
|
||||
@ -274,13 +272,11 @@ TEST_P(LayerTreeHostFiltersPixelTest, BackdropFilterBlurOutsets) {
|
||||
float average_error_allowed_in_bad_pixels = 2.f;
|
||||
int large_error_allowed = 2;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_.reset(new FuzzyPixelComparator(
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error,
|
||||
percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels,
|
||||
large_error_allowed,
|
||||
small_error_allowed));
|
||||
percentage_pixels_large_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed);
|
||||
#else
|
||||
if (use_skia_vulkan())
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>(true);
|
||||
@ -389,13 +385,11 @@ TEST_P(LayerTreeHostBlurFiltersPixelTestGPULayerList,
|
||||
float percentage_pixels_small_error = 0.0f;
|
||||
float average_error_allowed_in_bad_pixels = 1.f;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_.reset(new FuzzyPixelComparator(
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error,
|
||||
percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels,
|
||||
large_error_allowed,
|
||||
small_error_allowed));
|
||||
percentage_pixels_large_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed);
|
||||
#else
|
||||
if (use_skia_vulkan() || renderer_type_ == viz::RendererType::kSkiaDawn)
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelOffByOneComparator>(true);
|
||||
@ -806,11 +800,11 @@ TEST_P(LayerTreeHostFiltersPixelTest, ZoomFilter) {
|
||||
float average_error_allowed_in_bad_pixels = 1.f;
|
||||
int large_error_allowed = 1;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_.reset(new FuzzyPixelComparator(
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed));
|
||||
small_error_allowed);
|
||||
#endif
|
||||
|
||||
RunPixelTest(std::move(root),
|
||||
@ -1098,11 +1092,11 @@ TEST_P(LayerTreeHostFiltersPixelTest, BlurFilterWithClip) {
|
||||
float average_error_allowed_in_bad_pixels = 1.f;
|
||||
int large_error_allowed = 2;
|
||||
int small_error_allowed = 0;
|
||||
pixel_comparator_.reset(new FuzzyPixelComparator(
|
||||
pixel_comparator_ = std::make_unique<FuzzyPixelComparator>(
|
||||
true, // discard_alpha
|
||||
percentage_pixels_large_error, percentage_pixels_small_error,
|
||||
average_error_allowed_in_bad_pixels, large_error_allowed,
|
||||
small_error_allowed));
|
||||
small_error_allowed);
|
||||
#endif
|
||||
|
||||
RunPixelTest(filter_layer,
|
||||
|
@ -92,12 +92,12 @@ TEST_F(FirefoxProfileLockTest, ProfileLockContention) {
|
||||
|
||||
std::unique_ptr<FirefoxProfileLock> lock1;
|
||||
EXPECT_EQ(static_cast<FirefoxProfileLock*>(NULL), lock1.get());
|
||||
lock1.reset(new FirefoxProfileLock(test_path));
|
||||
lock1 = std::make_unique<FirefoxProfileLock>(test_path);
|
||||
EXPECT_TRUE(lock1->HasAcquired());
|
||||
|
||||
std::unique_ptr<FirefoxProfileLock> lock2;
|
||||
EXPECT_EQ(static_cast<FirefoxProfileLock*>(NULL), lock2.get());
|
||||
lock2.reset(new FirefoxProfileLock(test_path));
|
||||
lock2 = std::make_unique<FirefoxProfileLock>(test_path);
|
||||
EXPECT_FALSE(lock2->HasAcquired());
|
||||
|
||||
lock1->Unlock();
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <portabledevice.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@ -127,8 +128,7 @@ CreateFileEnumeratorOnBlockingPoolThread(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return std::unique_ptr<MTPDeviceObjectEnumerator>(
|
||||
new MTPDeviceObjectEnumerator(entries));
|
||||
return std::make_unique<MTPDeviceObjectEnumerator>(entries);
|
||||
}
|
||||
|
||||
// Opens the device for communication on a blocking pool thread.
|
||||
|
@ -222,8 +222,8 @@ class ProcessSingletonTest : public base::MultiProcessTest {
|
||||
|
||||
// The ready event has been signalled - the process singleton is held by
|
||||
// the hung sub process.
|
||||
test_singleton_.reset(new ProcessSingleton(
|
||||
user_data_dir(), base::BindRepeating(&NotificationCallback)));
|
||||
test_singleton_ = std::make_unique<ProcessSingleton>(
|
||||
user_data_dir(), base::BindRepeating(&NotificationCallback));
|
||||
|
||||
test_singleton_->OverrideShouldKillRemoteProcessCallbackForTesting(
|
||||
base::BindRepeating(&ProcessSingletonTest::MockShouldKillRemoteProcess,
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "base/base_paths.h"
|
||||
@ -48,7 +49,7 @@ class ProfileShortcutManagerTest : public testing::Test {
|
||||
void SetUp() override {
|
||||
TestingBrowserProcess* browser_process =
|
||||
TestingBrowserProcess::GetGlobal();
|
||||
profile_manager_.reset(new TestingProfileManager(browser_process));
|
||||
profile_manager_ = std::make_unique<TestingProfileManager>(browser_process);
|
||||
ASSERT_TRUE(profile_manager_->SetUp());
|
||||
profile_attributes_storage_ =
|
||||
profile_manager_->profile_attributes_storage();
|
||||
|
@ -68,8 +68,8 @@ BinaryIntegrityAnalyzerWinTest::BinaryIntegrityAnalyzerWinTest() {
|
||||
if (!base::PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir_))
|
||||
NOTREACHED();
|
||||
|
||||
exe_dir_override_.reset(
|
||||
new base::ScopedPathOverride(base::DIR_EXE, temp_dir_.GetPath()));
|
||||
exe_dir_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_EXE, temp_dir_.GetPath());
|
||||
}
|
||||
|
||||
TEST_F(BinaryIntegrityAnalyzerWinTest, GetCriticalBinariesPath) {
|
||||
@ -124,7 +124,7 @@ TEST_F(BinaryIntegrityAnalyzerWinTest, VerifyBinaryIntegrity) {
|
||||
// Run check on an infected binary.
|
||||
ASSERT_TRUE(EraseFileContent(chrome_elf_path));
|
||||
|
||||
mock_receiver.reset(new StrictMock<MockIncidentReceiver>());
|
||||
mock_receiver = std::make_unique<StrictMock<MockIncidentReceiver>>();
|
||||
std::unique_ptr<Incident> incident;
|
||||
EXPECT_CALL(*mock_receiver, DoAddIncidentForProcess(_))
|
||||
.WillOnce(TakeIncident(&incident));
|
||||
|
@ -80,13 +80,13 @@ class SafeBrowsingModuleVerifierWinTest : public testing::Test {
|
||||
LoadModule();
|
||||
HMODULE mem_handle;
|
||||
GetMemModuleHandle(&mem_handle);
|
||||
mem_peimage_ptr_.reset(new base::win::PEImage(mem_handle));
|
||||
mem_peimage_ptr_ = std::make_unique<base::win::PEImage>(mem_handle);
|
||||
ASSERT_TRUE(mem_peimage_ptr_->VerifyMagic());
|
||||
|
||||
LoadDLLAsFile();
|
||||
HMODULE disk_handle;
|
||||
GetDiskModuleHandle(&disk_handle);
|
||||
disk_peimage_ptr_.reset(new base::win::PEImageAsData(disk_handle));
|
||||
disk_peimage_ptr_ = std::make_unique<base::win::PEImageAsData>(disk_handle);
|
||||
ASSERT_TRUE(disk_peimage_ptr_->VerifyMagic());
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
@ -39,7 +41,7 @@ class SpellCheckHostChromeImplWinBrowserTest : public InProcessBrowserTest {
|
||||
|
||||
void SetUpOnMainThread() override {
|
||||
content::BrowserContext* context = browser()->profile();
|
||||
renderer_.reset(new content::MockRenderProcessHost(context));
|
||||
renderer_ = std::make_unique<content::MockRenderProcessHost>(context);
|
||||
|
||||
SpellCheckHostChromeImpl::Create(
|
||||
renderer_->GetID(), spell_check_host_.BindNewPipeAndPassReceiver());
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include <objbase.h>
|
||||
#include <shobjidl.h>
|
||||
#include <wrl/client.h>
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/bind.h"
|
||||
@ -180,8 +182,8 @@ void DrawTaskbarDecoration(gfx::NativeWindow window, const gfx::Image* image) {
|
||||
if (image) {
|
||||
// If `image` is an old avatar, then it's guaranteed to by 2x by code in
|
||||
// ProfileAttributesEntry::GetAvatarIcon().
|
||||
bitmap.reset(new SkBitmap(
|
||||
profiles::GetWin2xAvatarIconAsSquare(*image->ToSkBitmap())));
|
||||
bitmap = std::make_unique<SkBitmap>(
|
||||
profiles::GetWin2xAvatarIconAsSquare(*image->ToSkBitmap()));
|
||||
}
|
||||
|
||||
PostSetOverlayIcon(hwnd, std::move(bitmap), "");
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "chrome/browser/themes/theme_helper_win.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/callback.h"
|
||||
#include "base/win/windows_version.h"
|
||||
@ -32,8 +34,8 @@ ThemeHelperWin::ThemeHelperWin() {
|
||||
// use, so that it will be correct if at any time the user switches to the
|
||||
// native frame.
|
||||
if (base::win::GetVersion() >= base::win::Version::WIN8) {
|
||||
dwm_key_.reset(new base::win::RegKey(
|
||||
HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\DWM", KEY_READ));
|
||||
dwm_key_ = std::make_unique<base::win::RegKey>(
|
||||
HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\DWM", KEY_READ);
|
||||
if (dwm_key_->Valid())
|
||||
OnDwmKeyUpdated();
|
||||
else
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <dwmapi.h>
|
||||
#include <uxtheme.h>
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/bind.h"
|
||||
@ -233,9 +234,8 @@ BrowserDesktopWindowTreeHostWin::~BrowserDesktopWindowTreeHostWin() {}
|
||||
views::NativeMenuWin* BrowserDesktopWindowTreeHostWin::GetSystemMenu() {
|
||||
if (!system_menu_.get()) {
|
||||
SystemMenuInsertionDelegateWin insertion_delegate;
|
||||
system_menu_.reset(
|
||||
new views::NativeMenuWin(browser_frame_->GetSystemMenuModel(),
|
||||
GetHWND()));
|
||||
system_menu_ = std::make_unique<views::NativeMenuWin>(
|
||||
browser_frame_->GetSystemMenuModel(), GetHWND());
|
||||
system_menu_->Rebuild(&insertion_delegate);
|
||||
}
|
||||
return system_menu_.get();
|
||||
|
@ -32,12 +32,12 @@ class ChromeBlacklistTrialTest : public testing::Test {
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
override_manager_.OverrideRegistry(HKEY_CURRENT_USER));
|
||||
|
||||
blacklist_registry_key_.reset(
|
||||
new base::win::RegKey(HKEY_CURRENT_USER,
|
||||
install_static::GetRegistryPath()
|
||||
.append(blacklist::kRegistryBeaconKeyName)
|
||||
.c_str(),
|
||||
KEY_QUERY_VALUE | KEY_SET_VALUE));
|
||||
blacklist_registry_key_ = std::make_unique<base::win::RegKey>(
|
||||
HKEY_CURRENT_USER,
|
||||
install_static::GetRegistryPath()
|
||||
.append(blacklist::kRegistryBeaconKeyName)
|
||||
.c_str(),
|
||||
KEY_QUERY_VALUE | KEY_SET_VALUE);
|
||||
}
|
||||
|
||||
DWORD GetBlacklistState() {
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "chrome/browser/win/jumplist.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/base_paths.h"
|
||||
@ -269,7 +270,7 @@ JumpList::JumpList(Profile* profile)
|
||||
tab_restore_service->AddObserver(this);
|
||||
|
||||
// kIncognitoModeAvailability is monitored for changes on Incognito mode.
|
||||
pref_change_registrar_.reset(new PrefChangeRegistrar);
|
||||
pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>();
|
||||
pref_change_registrar_->Init(profile_->GetPrefs());
|
||||
// base::Unretained is safe since |this| is guaranteed to outlive
|
||||
// pref_change_registrar_.
|
||||
|
@ -139,9 +139,10 @@ MainController::MainController(RebooterAPI* rebooter,
|
||||
// main controller object no longer exists.
|
||||
chrome_prompt_ipc->Initialize(new ChromePromptConnectionErrorHandler(
|
||||
weak_factory_.GetWeakPtr(), base::ThreadTaskRunnerHandle::Get()));
|
||||
main_dialog_.reset(new ChromeProxyMainDialog(this, chrome_prompt_ipc));
|
||||
main_dialog_ =
|
||||
std::make_unique<ChromeProxyMainDialog>(this, chrome_prompt_ipc);
|
||||
} else if (execution_mode == ExecutionMode::kCleanup) {
|
||||
main_dialog_.reset(new SilentMainDialog(this));
|
||||
main_dialog_ = std::make_unique<SilentMainDialog>(this);
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
@ -586,7 +586,8 @@ int APIENTRY wWinMain(HINSTANCE, HINSTANCE, wchar_t*, int) {
|
||||
executable_path, ®istry_logger, nullptr);
|
||||
}
|
||||
|
||||
rebooter.reset(new chrome_cleaner::Rebooter(PRODUCT_SHORTNAME_STRING));
|
||||
rebooter =
|
||||
std::make_unique<chrome_cleaner::Rebooter>(PRODUCT_SHORTNAME_STRING);
|
||||
|
||||
shutdown_sequence.mojo_task_runner = chrome_cleaner::MojoTaskRunner::Create();
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "chrome/chrome_cleaner/ipc/mojo_chrome_prompt_ipc.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/bind.h"
|
||||
@ -101,7 +102,8 @@ void MojoChromePromptIPC::InitializeChromePromptPtr() {
|
||||
mojo::ScopedMessagePipeHandle message_pipe_handle =
|
||||
incoming_invitation.ExtractMessagePipe(chrome_mojo_pipe_token_);
|
||||
|
||||
chrome_prompt_service_.reset(new chrome_cleaner::mojom::ChromePromptPtr);
|
||||
chrome_prompt_service_ =
|
||||
std::make_unique<chrome_cleaner::mojom::ChromePromptPtr>();
|
||||
chrome_prompt_service_->Bind(chrome_cleaner::mojom::ChromePromptPtrInfo(
|
||||
std::move(message_pipe_handle), 0));
|
||||
// No need to retain this object, since it will live until the process
|
||||
|
@ -235,7 +235,8 @@ class CleanerLoggingServiceTest : public testing::TestWithParam<ExecutionMode> {
|
||||
|
||||
registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER);
|
||||
// The registry logger must be created after calling OverrideRegistry.
|
||||
registry_logger_.reset(new RegistryLogger(RegistryLogger::Mode::REMOVER));
|
||||
registry_logger_ =
|
||||
std::make_unique<RegistryLogger>(RegistryLogger::Mode::REMOVER);
|
||||
|
||||
// By default, tests use the NoOpLoggingService, so individual tests that
|
||||
// need logging need to enable it.
|
||||
|
@ -51,7 +51,8 @@ class PendingLogsServiceTest : public testing::Test {
|
||||
|
||||
registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER);
|
||||
// The registry logger must be created after calling OverrideRegistry.
|
||||
registry_logger_.reset(new RegistryLogger(RegistryLogger::Mode::REMOVER));
|
||||
registry_logger_ =
|
||||
std::make_unique<RegistryLogger>(RegistryLogger::Mode::REMOVER);
|
||||
|
||||
// Make sure to clear any previous tests content, e.g., log lines.
|
||||
// Individual tests will enable it appropriately.
|
||||
|
@ -60,7 +60,8 @@ class ReporterLoggingServiceTest : public testing::Test {
|
||||
}
|
||||
|
||||
void SetUp() override {
|
||||
registry_logger_.reset(new RegistryLogger(RegistryLogger::Mode::REPORTER));
|
||||
registry_logger_ =
|
||||
std::make_unique<RegistryLogger>(RegistryLogger::Mode::REPORTER);
|
||||
|
||||
reporter_logging_service_ = ReporterLoggingService::GetInstance();
|
||||
reporter_logging_service_->Initialize(registry_logger_.get());
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "chrome/chrome_cleaner/os/initializer.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/command_line.h"
|
||||
@ -35,8 +36,8 @@ std::unique_ptr<base::WaitableEvent> SignalInitializationDone() {
|
||||
|
||||
std::unique_ptr<base::WaitableEvent> notifier_event;
|
||||
if (init_done_notifier.IsValid()) {
|
||||
notifier_event.reset(
|
||||
new base::WaitableEvent(std::move(init_done_notifier)));
|
||||
notifier_event =
|
||||
std::make_unique<base::WaitableEvent>(std::move(init_done_notifier));
|
||||
|
||||
// Wake up the test that is waiting on this event.
|
||||
notifier_event->Signal();
|
||||
|
@ -76,8 +76,8 @@ class ChromeCleanerTestSuite : public base::TestSuite {
|
||||
protected:
|
||||
void Initialize() override {
|
||||
base::TestSuite::Initialize();
|
||||
scoped_logging.reset(new chrome_cleaner::ScopedLogging(
|
||||
IsSandboxedProcess() ? chrome_cleaner::kSandboxLogFileSuffix : L""));
|
||||
scoped_logging = std::make_unique<chrome_cleaner::ScopedLogging>(
|
||||
IsSandboxedProcess() ? chrome_cleaner::kSandboxLogFileSuffix : L"");
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -34,12 +34,12 @@ class BeaconTest : public testing::Test {
|
||||
override_manager_.OverrideRegistry(HKEY_CURRENT_USER, &temp));
|
||||
ASSERT_TRUE(nt::SetTestingOverride(nt::HKCU, temp));
|
||||
|
||||
beacon_registry_key_.reset(
|
||||
new base::win::RegKey(HKEY_CURRENT_USER,
|
||||
install_static::GetRegistryPath()
|
||||
.append(blacklist::kRegistryBeaconKeyName)
|
||||
.c_str(),
|
||||
KEY_QUERY_VALUE | KEY_SET_VALUE));
|
||||
beacon_registry_key_ = std::make_unique<base::win::RegKey>(
|
||||
HKEY_CURRENT_USER,
|
||||
install_static::GetRegistryPath()
|
||||
.append(blacklist::kRegistryBeaconKeyName)
|
||||
.c_str(),
|
||||
KEY_QUERY_VALUE | KEY_SET_VALUE);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
|
@ -163,9 +163,9 @@ TEST(ThirdParty, LogNotifications) {
|
||||
// Set up the required arguments for the test thread.
|
||||
NotificationHandlerArguments handler_data;
|
||||
handler_data.logs_expected = base::size(kTestLogs);
|
||||
handler_data.notification_event.reset(
|
||||
new base::WaitableEvent(base::WaitableEvent::ResetPolicy::AUTOMATIC,
|
||||
base::WaitableEvent::InitialState::NOT_SIGNALED));
|
||||
handler_data.notification_event = std::make_unique<base::WaitableEvent>(
|
||||
base::WaitableEvent::ResetPolicy::AUTOMATIC,
|
||||
base::WaitableEvent::InitialState::NOT_SIGNALED);
|
||||
|
||||
// Register the event.
|
||||
ASSERT_TRUE(
|
||||
|
@ -139,8 +139,8 @@ TEST_F(ServiceProcessStateTest, AutoRun) {
|
||||
EXPECT_TRUE(base::win::ReadCommandFromAutoRun(HKEY_CURRENT_USER,
|
||||
base::UTF8ToWide(value_name),
|
||||
&value));
|
||||
autorun_command_line.reset(
|
||||
new base::CommandLine(base::CommandLine::FromString(value)));
|
||||
autorun_command_line =
|
||||
std::make_unique<base::CommandLine>(base::CommandLine::FromString(value));
|
||||
#elif defined(OS_POSIX) && !defined(OS_MAC)
|
||||
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
||||
std::string base_desktop_name = "google-chrome-service.desktop";
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "chrome/credential_provider/extension/app_inventory_manager.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "chrome/credential_provider/common/gcp_strings.h"
|
||||
#include "chrome/credential_provider/gaiacp/gcp_utils.h"
|
||||
@ -170,7 +172,7 @@ HRESULT AppInventoryManager::UploadAppInventory(
|
||||
}
|
||||
}
|
||||
|
||||
request_dict_.reset(new base::Value(base::Value::Type::DICTIONARY));
|
||||
request_dict_ = std::make_unique<base::Value>(base::Value::Type::DICTIONARY);
|
||||
request_dict_->SetStringKey(kUploadAppInventoryRequestUserSidParameterName,
|
||||
base::WideToUTF8(context.user_sid));
|
||||
request_dict_->SetStringKey(kDmToken, base::WideToUTF8(dm_token_value));
|
||||
@ -230,7 +232,8 @@ base::Value AppInventoryManager::GetInstalledWin32Apps() {
|
||||
base::Value app_info_value_list(base::Value::Type::LIST);
|
||||
for (std::wstring regPath : app_path_list) {
|
||||
std::unique_ptr<base::Value> request_dict_;
|
||||
request_dict_.reset(new base::Value(base::Value::Type::DICTIONARY));
|
||||
request_dict_ =
|
||||
std::make_unique<base::Value>(base::Value::Type::DICTIONARY);
|
||||
|
||||
wchar_t display_name[256];
|
||||
ULONG display_length = base::size(display_name);
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/base_paths_win.h"
|
||||
#include "base/files/scoped_temp_dir.h"
|
||||
#include "base/json/json_reader.h"
|
||||
@ -203,7 +205,8 @@ TEST_P(AppInventoryManagerTest, uploadAppInventory) {
|
||||
|
||||
if (has_app_data) {
|
||||
std::unique_ptr<base::Value> request_dict_1;
|
||||
request_dict_1.reset(new base::Value(base::Value::Type::DICTIONARY));
|
||||
request_dict_1 =
|
||||
std::make_unique<base::Value>(base::Value::Type::DICTIONARY);
|
||||
request_dict_1->SetStringKey(kAppDisplayName,
|
||||
base::WideToUTF8(kAppDisplayName1));
|
||||
request_dict_1->SetStringKey(kAppDisplayVersion,
|
||||
@ -216,7 +219,8 @@ TEST_P(AppInventoryManagerTest, uploadAppInventory) {
|
||||
base::Value::FromUniquePtrValue(std::move(request_dict_1)));
|
||||
|
||||
std::unique_ptr<base::Value> request_dict_2;
|
||||
request_dict_2.reset(new base::Value(base::Value::Type::DICTIONARY));
|
||||
request_dict_2 =
|
||||
std::make_unique<base::Value>(base::Value::Type::DICTIONARY);
|
||||
request_dict_2->SetStringKey(kAppDisplayName,
|
||||
base::WideToUTF8(kAppDisplayName2));
|
||||
request_dict_2->SetStringKey(kAppDisplayVersion,
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "chrome/credential_provider/extension/extension_utils.h"
|
||||
@ -122,7 +124,8 @@ void TaskManager::ExecuteTask(
|
||||
task_execution_policies_.find(task_name)->second.get();
|
||||
|
||||
// Create backoff entry as this is the first failure after a success.
|
||||
task_execution_backoffs_[task_name].reset(new net::BackoffEntry(policy));
|
||||
task_execution_backoffs_[task_name] =
|
||||
std::make_unique<net::BackoffEntry>(policy);
|
||||
}
|
||||
|
||||
task_execution_backoffs_[task_name]->InformOfRequest(false);
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "chrome/credential_provider/gaiacp/stdafx.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "base/guid.h"
|
||||
@ -101,9 +102,9 @@ void AssociatedUserValidatorTest::SetUp() {
|
||||
void AssociatedUserValidatorTest::CreateDefaultCloudPoliciesForUser(
|
||||
const std::wstring& sid) {
|
||||
if (!fake_user_policies_manager_)
|
||||
fake_user_policies_manager_.reset(new FakeUserPoliciesManager());
|
||||
fake_user_policies_manager_ = std::make_unique<FakeUserPoliciesManager>();
|
||||
if (!fake_token_generator_)
|
||||
fake_token_generator_.reset(new FakeTokenGenerator());
|
||||
fake_token_generator_ = std::make_unique<FakeTokenGenerator>();
|
||||
|
||||
// Ensure user has policies and valid GCPW token.
|
||||
fake_user_policies_manager_->SetUserPolicyStaleOrMissing(sid, false);
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include <windows.h>
|
||||
#include <winevt.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/json/json_writer.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
@ -437,7 +439,8 @@ HRESULT EventLogsUploadManager::UploadEventViewerLogs(
|
||||
}
|
||||
|
||||
if (!log_entry_value_list) {
|
||||
log_entry_value_list.reset(new base::Value(base::Value::Type::LIST));
|
||||
log_entry_value_list =
|
||||
std::make_unique<base::Value>(base::Value::Type::LIST);
|
||||
}
|
||||
log_entry_value_list->Append(std::move(log_entry_value));
|
||||
|
||||
|
@ -1379,9 +1379,9 @@ void CGaiaCredentialBase::TellOmahaDidRun() {
|
||||
|
||||
void CGaiaCredentialBase::PreventDenyAccessUpdate() {
|
||||
if (!token_update_locker_) {
|
||||
token_update_locker_.reset(
|
||||
new AssociatedUserValidator::ScopedBlockDenyAccessUpdate(
|
||||
AssociatedUserValidator::Get()));
|
||||
token_update_locker_ =
|
||||
std::make_unique<AssociatedUserValidator::ScopedBlockDenyAccessUpdate>(
|
||||
AssociatedUserValidator::Get());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <sddl.h> // For ConvertSidToStringSid()
|
||||
#include <wrl/client.h>
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "base/base64.h"
|
||||
@ -2674,10 +2675,10 @@ TEST_P(GcpGaiaCredentialBasePasswordRecoveryTest, PasswordRecovery) {
|
||||
std::unique_ptr<base::WaitableEvent> generate_key_event;
|
||||
|
||||
if (generate_public_key_result == 2)
|
||||
get_key_event.reset(new base::WaitableEvent());
|
||||
get_key_event = std::make_unique<base::WaitableEvent>();
|
||||
|
||||
if (get_private_key_result == 2)
|
||||
generate_key_event.reset(new base::WaitableEvent());
|
||||
generate_key_event = std::make_unique<base::WaitableEvent>();
|
||||
|
||||
if (get_key_event || generate_key_event) {
|
||||
fake_password_recovery_manager()->SetRequestTimeoutForTesting(
|
||||
@ -2725,7 +2726,7 @@ TEST_P(GcpGaiaCredentialBasePasswordRecoveryTest, PasswordRecovery) {
|
||||
}
|
||||
|
||||
if (generate_public_key_again_result == 2)
|
||||
generate_key_event.reset(new base::WaitableEvent());
|
||||
generate_key_event = std::make_unique<base::WaitableEvent>();
|
||||
|
||||
if (generate_key_event) {
|
||||
fake_password_recovery_manager()->SetRequestTimeoutForTesting(
|
||||
@ -3186,7 +3187,7 @@ TEST_P(GcpGaiaCredentialBaseUploadDeviceDetailsTest, UploadDeviceDetails) {
|
||||
std::unique_ptr<base::WaitableEvent> upload_device_details_key_event;
|
||||
|
||||
if (fail_upload_device_details_timeout) {
|
||||
upload_device_details_key_event.reset(new base::WaitableEvent());
|
||||
upload_device_details_key_event = std::make_unique<base::WaitableEvent>();
|
||||
|
||||
fake_gem_device_details_manager()->SetRequestTimeoutForTesting(
|
||||
base::TimeDelta::FromMilliseconds(50));
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <credentialprovider.h>
|
||||
#include <wrl/client.h>
|
||||
|
||||
#include <memory>
|
||||
#include <tuple>
|
||||
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
@ -50,9 +51,9 @@ void GcpCredentialProviderTest::SetCloudPoliciesForUser(
|
||||
const std::wstring& sid,
|
||||
const UserPolicies policies) {
|
||||
if (!fake_user_policies_manager_)
|
||||
fake_user_policies_manager_.reset(new FakeUserPoliciesManager());
|
||||
fake_user_policies_manager_ = std::make_unique<FakeUserPoliciesManager>();
|
||||
if (!fake_token_generator_)
|
||||
fake_token_generator_.reset(new FakeTokenGenerator());
|
||||
fake_token_generator_ = std::make_unique<FakeTokenGenerator>();
|
||||
|
||||
// Ensure user has policies and valid GCPW token.
|
||||
fake_user_policies_manager_->SetUserPolicies(sid, policies);
|
||||
|
@ -13,6 +13,8 @@
|
||||
#define _NTDEF_ // Prevent redefition errors, must come after <winternl.h>
|
||||
#include <ntsecapi.h> // For POLICY_ALL_ACCESS types
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/containers/span.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
@ -247,7 +249,7 @@ HRESULT GemDeviceDetailsManager::UploadDeviceDetailsInternal(
|
||||
}
|
||||
}
|
||||
|
||||
request_dict_.reset(new base::Value(base::Value::Type::DICTIONARY));
|
||||
request_dict_ = std::make_unique<base::Value>(base::Value::Type::DICTIONARY);
|
||||
request_dict_->SetStringKey(
|
||||
kUploadDeviceDetailsRequestSerialNumberParameterName,
|
||||
base::WideToUTF8(serial_number));
|
||||
|
@ -343,16 +343,16 @@ void GcpSetupTest::SetUp() {
|
||||
ASSERT_NE(nullptr, env.get());
|
||||
|
||||
ASSERT_TRUE(scoped_temp_prog_dir_.CreateUniqueTempDir());
|
||||
program_files_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_PROGRAM_FILES, scoped_temp_prog_dir_.GetPath()));
|
||||
program_files_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_PROGRAM_FILES, scoped_temp_prog_dir_.GetPath());
|
||||
|
||||
ASSERT_TRUE(scoped_temp_start_menu_dir_.CreateUniqueTempDir());
|
||||
start_menu_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_COMMON_START_MENU, scoped_temp_start_menu_dir_.GetPath()));
|
||||
start_menu_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_COMMON_START_MENU, scoped_temp_start_menu_dir_.GetPath());
|
||||
|
||||
ASSERT_TRUE(scoped_temp_progdata_dir_.CreateUniqueTempDir());
|
||||
programdata_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_COMMON_APP_DATA, scoped_temp_progdata_dir_.GetPath()));
|
||||
programdata_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_COMMON_APP_DATA, scoped_temp_progdata_dir_.GetPath());
|
||||
|
||||
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
|
||||
|
||||
@ -360,9 +360,9 @@ void GcpSetupTest::SetUp() {
|
||||
// to base.dll because of the way CURRENT_MODULE works. Therefore overriding
|
||||
// to point to gaia1_0.dll's destination path (i.e. after it is installed).
|
||||
// The actual file name is not important, just the directory.
|
||||
dll_path_override_.reset(new base::ScopedPathOverride(
|
||||
dll_path_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::FILE_MODULE, installed_path().Append(FILE_PATH_LITERAL("foo.dll")),
|
||||
true /*=is_absolute*/, false /*=create*/));
|
||||
true /*=is_absolute*/, false /*=create*/);
|
||||
|
||||
base::FilePath startup_path =
|
||||
scoped_temp_start_menu_dir_.GetPath().Append(L"StartUp");
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "gls_runner_test_base.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/base_switches.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/json/json_writer.h"
|
||||
@ -152,18 +154,17 @@ void GlsRunnerTestBase::SetUp() {
|
||||
// Override location of "Program Files" system folder and its x86 version so
|
||||
// we don't modify local machine settings.
|
||||
ASSERT_TRUE(scoped_temp_program_files_dir_.CreateUniqueTempDir());
|
||||
program_files_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_PROGRAM_FILES, scoped_temp_program_files_dir_.GetPath()));
|
||||
program_files_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_PROGRAM_FILES, scoped_temp_program_files_dir_.GetPath());
|
||||
ASSERT_TRUE(scoped_temp_program_files_x86_dir_.CreateUniqueTempDir());
|
||||
program_files_x86_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_PROGRAM_FILESX86,
|
||||
scoped_temp_program_files_x86_dir_.GetPath()));
|
||||
program_files_x86_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_PROGRAM_FILESX86, scoped_temp_program_files_x86_dir_.GetPath());
|
||||
|
||||
// Also override location of "ProgramData" system folder as we store user
|
||||
// policies there.
|
||||
ASSERT_TRUE(scoped_temp_progdata_dir_.CreateUniqueTempDir());
|
||||
programdata_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_COMMON_APP_DATA, scoped_temp_progdata_dir_.GetPath()));
|
||||
programdata_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_COMMON_APP_DATA, scoped_temp_progdata_dir_.GetPath());
|
||||
}
|
||||
|
||||
void GlsRunnerTestBase::TearDown() {
|
||||
|
@ -230,16 +230,16 @@ class InstallShortcutTest : public testing::Test {
|
||||
ASSERT_TRUE(fake_user_quick_launch_.CreateUniqueTempDir());
|
||||
ASSERT_TRUE(fake_start_menu_.CreateUniqueTempDir());
|
||||
ASSERT_TRUE(fake_common_start_menu_.CreateUniqueTempDir());
|
||||
user_desktop_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_USER_DESKTOP, fake_user_desktop_.GetPath()));
|
||||
common_desktop_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_COMMON_DESKTOP, fake_common_desktop_.GetPath()));
|
||||
user_quick_launch_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_USER_QUICK_LAUNCH, fake_user_quick_launch_.GetPath()));
|
||||
start_menu_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_START_MENU, fake_start_menu_.GetPath()));
|
||||
common_start_menu_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_COMMON_START_MENU, fake_common_start_menu_.GetPath()));
|
||||
user_desktop_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_USER_DESKTOP, fake_user_desktop_.GetPath());
|
||||
common_desktop_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_COMMON_DESKTOP, fake_common_desktop_.GetPath());
|
||||
user_quick_launch_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_USER_QUICK_LAUNCH, fake_user_quick_launch_.GetPath());
|
||||
start_menu_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_START_MENU, fake_start_menu_.GetPath());
|
||||
common_start_menu_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_COMMON_START_MENU, fake_common_start_menu_.GetPath());
|
||||
|
||||
std::wstring shortcut_name(InstallUtil::GetShortcutName() +
|
||||
installer::kLnkExt);
|
||||
|
@ -244,8 +244,8 @@ MockInstallerState* BuildChromeInstallerState(
|
||||
class InstallWorkerTest : public testing::Test {
|
||||
public:
|
||||
void SetUp() override {
|
||||
current_version_.reset(new base::Version("1.0.0.0"));
|
||||
new_version_.reset(new base::Version("42.0.0.0"));
|
||||
current_version_ = std::make_unique<base::Version>("1.0.0.0");
|
||||
new_version_ = std::make_unique<base::Version>("42.0.0.0");
|
||||
|
||||
// Don't bother ensuring that these paths exist. Since we're just
|
||||
// building the work item lists and not running them, they shouldn't
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <stddef.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
|
||||
#include "base/base_paths.h"
|
||||
#include "base/command_line.h"
|
||||
@ -223,7 +224,7 @@ class InstallerStateCriticalVersionTest : public ::testing::Test {
|
||||
: base::CommandLine::FromString(
|
||||
L"setup.exe --critical-update-version=" +
|
||||
base::ASCIIToWide(version.GetString()));
|
||||
prefs_.reset(new InitialPreferences(cmd_line_));
|
||||
prefs_ = std::make_unique<InitialPreferences>(cmd_line_);
|
||||
machine_state_.Initialize();
|
||||
installer_state_.Initialize(cmd_line_, *prefs_, machine_state_);
|
||||
return installer_state_;
|
||||
|
@ -386,7 +386,7 @@ class FindArchiveToPatchTest : public testing::Test {
|
||||
|
||||
void set_version(const base::Version& version) {
|
||||
if (version.IsValid())
|
||||
version_.reset(new base::Version(version));
|
||||
version_ = std::make_unique<base::Version>(version);
|
||||
else
|
||||
version_.reset();
|
||||
}
|
||||
@ -408,13 +408,13 @@ class FindArchiveToPatchTest : public testing::Test {
|
||||
max_version_ = base::Version("47.0.1559.0");
|
||||
|
||||
// Install the product according to the version.
|
||||
original_state_.reset(new FakeInstallationState());
|
||||
original_state_ = std::make_unique<FakeInstallationState>();
|
||||
InstallProduct();
|
||||
|
||||
// Prepare to update the product in the temp dir.
|
||||
installer_state_.reset(new installer::InstallerState(
|
||||
installer_state_ = std::make_unique<installer::InstallerState>(
|
||||
kSystemInstall_ ? installer::InstallerState::SYSTEM_LEVEL
|
||||
: installer::InstallerState::USER_LEVEL));
|
||||
: installer::InstallerState::USER_LEVEL);
|
||||
installer_state_->set_target_path_for_testing(test_dir_.GetPath());
|
||||
|
||||
// Create archives in the two version dirs.
|
||||
|
@ -115,7 +115,7 @@ void InitialPreferences::InitializeFromCommandLine(
|
||||
cmd_line.GetSwitchValuePath(installer::switches::kInstallerData));
|
||||
InitializeFromFilePath(prefs_path);
|
||||
} else {
|
||||
initial_dictionary_.reset(new base::DictionaryValue());
|
||||
initial_dictionary_ = std::make_unique<base::DictionaryValue>();
|
||||
}
|
||||
|
||||
DCHECK(initial_dictionary_.get());
|
||||
|
@ -109,8 +109,8 @@ class InstallUtilTest : public testing::Test {
|
||||
void SetUp() override { ASSERT_NO_FATAL_FAILURE(ResetRegistryOverrides()); }
|
||||
|
||||
void ResetRegistryOverrides() {
|
||||
registry_override_manager_.reset(
|
||||
new registry_util::RegistryOverrideManager);
|
||||
registry_override_manager_ =
|
||||
std::make_unique<registry_util::RegistryOverrideManager>();
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
registry_override_manager_->OverrideRegistry(HKEY_CURRENT_USER));
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "chrome/installer/util/installation_state.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/check.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
@ -61,7 +63,8 @@ bool ProductState::Initialize(bool system_install) {
|
||||
std::wstring version_str;
|
||||
if (key.ReadValue(google_update::kRegVersionField, &version_str) ==
|
||||
ERROR_SUCCESS) {
|
||||
version_.reset(new base::Version(base::WideToASCII(version_str)));
|
||||
version_ =
|
||||
std::make_unique<base::Version>(base::WideToASCII(version_str));
|
||||
if (!version_->IsValid())
|
||||
version_.reset();
|
||||
}
|
||||
@ -71,7 +74,8 @@ bool ProductState::Initialize(bool system_install) {
|
||||
// only be accessible via InstallationState::GetNonVersionedProductState.
|
||||
if (key.ReadValue(google_update::kRegOldVersionField, &version_str) ==
|
||||
ERROR_SUCCESS) {
|
||||
old_version_.reset(new base::Version(base::WideToASCII(version_str)));
|
||||
old_version_ =
|
||||
std::make_unique<base::Version>(base::WideToASCII(version_str));
|
||||
if (!old_version_->IsValid())
|
||||
old_version_.reset();
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@ -286,7 +287,7 @@ bool RegistryKeyBackup::Initialize(HKEY root,
|
||||
// Does the key exist?
|
||||
LONG result = key.Open(root, key_path, kKeyReadNoNotify | wow64_access);
|
||||
if (result == ERROR_SUCCESS) {
|
||||
key_data.reset(new KeyData());
|
||||
key_data = std::make_unique<KeyData>();
|
||||
if (!key_data->Initialize(key)) {
|
||||
LOG(ERROR) << "Failed to backup key at " << key_path;
|
||||
return false;
|
||||
|
@ -78,20 +78,20 @@ class ShellUtilShortcutTest : public testing::Test {
|
||||
ASSERT_TRUE(fake_common_start_menu_.CreateUniqueTempDir());
|
||||
ASSERT_TRUE(fake_user_startup_.CreateUniqueTempDir());
|
||||
ASSERT_TRUE(fake_common_startup_.CreateUniqueTempDir());
|
||||
user_desktop_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_USER_DESKTOP, fake_user_desktop_.GetPath()));
|
||||
common_desktop_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_COMMON_DESKTOP, fake_common_desktop_.GetPath()));
|
||||
user_quick_launch_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_USER_QUICK_LAUNCH, fake_user_quick_launch_.GetPath()));
|
||||
start_menu_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_START_MENU, fake_start_menu_.GetPath()));
|
||||
common_start_menu_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_COMMON_START_MENU, fake_common_start_menu_.GetPath()));
|
||||
common_startup_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_COMMON_STARTUP, fake_common_startup_.GetPath()));
|
||||
user_startup_override_.reset(new base::ScopedPathOverride(
|
||||
base::DIR_USER_STARTUP, fake_user_startup_.GetPath()));
|
||||
user_desktop_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_USER_DESKTOP, fake_user_desktop_.GetPath());
|
||||
common_desktop_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_COMMON_DESKTOP, fake_common_desktop_.GetPath());
|
||||
user_quick_launch_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_USER_QUICK_LAUNCH, fake_user_quick_launch_.GetPath());
|
||||
start_menu_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_START_MENU, fake_start_menu_.GetPath());
|
||||
common_start_menu_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_COMMON_START_MENU, fake_common_start_menu_.GetPath());
|
||||
common_startup_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_COMMON_STARTUP, fake_common_startup_.GetPath());
|
||||
user_startup_override_ = std::make_unique<base::ScopedPathOverride>(
|
||||
base::DIR_USER_STARTUP, fake_user_startup_.GetPath());
|
||||
|
||||
base::FilePath icon_path;
|
||||
base::CreateTemporaryFileInDir(temp_dir_.GetPath(), &icon_path);
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "chrome/test/base/chrome_test_launcher.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/test/launcher/test_launcher.h"
|
||||
#include "build/build_config.h"
|
||||
@ -52,7 +54,7 @@ class InteractiveUITestSuite : public ChromeTestSuite {
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
ui_controls::InstallUIControlsAura(ash::test::CreateAshUIControls());
|
||||
#elif defined(OS_WIN)
|
||||
com_initializer_.reset(new base::win::ScopedCOMInitializer());
|
||||
com_initializer_ = std::make_unique<base::win::ScopedCOMInitializer>();
|
||||
ui_controls::InstallUIControlsAura(
|
||||
aura::test::CreateUIControlsAura(nullptr));
|
||||
#elif defined(OS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
|
@ -208,7 +208,7 @@ void TestLogCollector::SetUp() {
|
||||
if (!log_temp_dir_.CreateUniqueTempDir()) {
|
||||
LOG(ERROR) << "Failed to create temporary directory to hold log files.";
|
||||
} else {
|
||||
file_logger_.reset(new FileLogger());
|
||||
file_logger_ = std::make_unique<FileLogger>();
|
||||
file_logger_->Initialize();
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <userenv.h>
|
||||
#include <winspool.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "base/at_exit.h"
|
||||
@ -669,7 +670,7 @@ MONITOR2* WINAPI InitializePrintMonitor2(MONITORINIT*, HANDLE* handle) {
|
||||
*handle = monitor_data;
|
||||
if (!cloud_print::kIsUnittest) {
|
||||
// Unit tests set up their own AtExitManager
|
||||
monitor_data->at_exit_manager.reset(new base::AtExitManager());
|
||||
monitor_data->at_exit_manager = std::make_unique<base::AtExitManager>();
|
||||
// Single spooler.exe handles verbose users.
|
||||
base::PathService::DisableCache();
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "components/policy/core/common/registry_dict.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/json/json_reader.h"
|
||||
@ -250,8 +251,8 @@ void RegistryDict::ReadRegistry(HKEY hive, const std::wstring& root) {
|
||||
switch (it.Type()) {
|
||||
case REG_SZ:
|
||||
case REG_EXPAND_SZ:
|
||||
SetValue(name, std::unique_ptr<base::Value>(
|
||||
new base::Value(base::WideToUTF8(it.Value()))));
|
||||
SetValue(name,
|
||||
std::make_unique<base::Value>(base::WideToUTF8(it.Value())));
|
||||
continue;
|
||||
case REG_DWORD_LITTLE_ENDIAN:
|
||||
case REG_DWORD_BIG_ENDIAN:
|
||||
@ -261,8 +262,8 @@ void RegistryDict::ReadRegistry(HKEY hive, const std::wstring& root) {
|
||||
dword_value = base::NetToHost32(dword_value);
|
||||
else
|
||||
dword_value = base::ByteSwapToLE32(dword_value);
|
||||
SetValue(name, std::unique_ptr<base::Value>(
|
||||
new base::Value(static_cast<int>(dword_value))));
|
||||
SetValue(name, std::make_unique<base::Value>(
|
||||
static_cast<int>(dword_value)));
|
||||
continue;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
|
@ -85,8 +85,8 @@ StorageMonitorWinTest::~StorageMonitorWinTest() {
|
||||
|
||||
void StorageMonitorWinTest::SetUp() {
|
||||
volume_mount_watcher_ = new TestVolumeMountWatcherWin;
|
||||
monitor_.reset(new TestStorageMonitorWin(volume_mount_watcher_,
|
||||
new TestPortableDeviceWatcherWin));
|
||||
monitor_ = std::make_unique<TestStorageMonitorWin>(
|
||||
volume_mount_watcher_, new TestPortableDeviceWatcherWin);
|
||||
|
||||
monitor_->Init();
|
||||
content::RunAllTasksUntilIdle();
|
||||
@ -118,8 +118,8 @@ void StorageMonitorWinTest::PreAttachDevices() {
|
||||
expect_attach_calls++;
|
||||
}
|
||||
|
||||
monitor_.reset(new TestStorageMonitorWin(volume_mount_watcher_,
|
||||
new TestPortableDeviceWatcherWin));
|
||||
monitor_ = std::make_unique<TestStorageMonitorWin>(
|
||||
volume_mount_watcher_, new TestPortableDeviceWatcherWin);
|
||||
|
||||
monitor_->AddObserver(&observer_);
|
||||
monitor_->Init();
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#include "components/storage_monitor/test_volume_mount_watcher_win.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/files/scoped_temp_dir.h"
|
||||
@ -116,9 +118,9 @@ void TestVolumeMountWatcherWin::DeviceCheckComplete(
|
||||
}
|
||||
|
||||
void TestVolumeMountWatcherWin::BlockDeviceCheckForTesting() {
|
||||
device_check_complete_event_.reset(
|
||||
new base::WaitableEvent(base::WaitableEvent::ResetPolicy::AUTOMATIC,
|
||||
base::WaitableEvent::InitialState::NOT_SIGNALED));
|
||||
device_check_complete_event_ = std::make_unique<base::WaitableEvent>(
|
||||
base::WaitableEvent::ResetPolicy::AUTOMATIC,
|
||||
base::WaitableEvent::InitialState::NOT_SIGNALED);
|
||||
devices_checked_.clear();
|
||||
}
|
||||
|
||||
|
@ -988,8 +988,8 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest,
|
||||
document_checker.CheckAccessible(GetRendererAccessible());
|
||||
|
||||
// Set the active descendant of the radio group
|
||||
waiter.reset(new AccessibilityNotificationWaiter(
|
||||
shell()->web_contents(), ui::kAXModeComplete, ax::mojom::Event::kFocus));
|
||||
waiter = std::make_unique<AccessibilityNotificationWaiter>(
|
||||
shell()->web_contents(), ui::kAXModeComplete, ax::mojom::Event::kFocus);
|
||||
ExecuteScript(
|
||||
u"document.body.children[0].setAttribute('aria-activedescendant', 'li')");
|
||||
waiter->WaitForNotification();
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@ -1452,7 +1453,7 @@ void BrowserAccessibilityComWin::UpdateStep1ComputeWinAttributes() {
|
||||
old_hypertext_ = hypertext_;
|
||||
hypertext_ = ui::AXHypertext();
|
||||
|
||||
win_attributes_.reset(new WinAttributes());
|
||||
win_attributes_ = std::make_unique<WinAttributes>();
|
||||
|
||||
win_attributes_->ia_role = MSAARole();
|
||||
win_attributes_->ia_state = MSAAState();
|
||||
|
@ -130,8 +130,8 @@ BrowserAccessibilityStateImplWin::BrowserAccessibilityStateImplWin() {
|
||||
ui::GetWinAccessibilityAPIUsageObserverList().AddObserver(
|
||||
new WindowsAccessibilityEnabler());
|
||||
|
||||
singleton_hwnd_observer_.reset(
|
||||
new gfx::SingletonHwndObserver(base::BindRepeating(&OnWndProc)));
|
||||
singleton_hwnd_observer_ = std::make_unique<gfx::SingletonHwndObserver>(
|
||||
base::BindRepeating(&OnWndProc));
|
||||
}
|
||||
|
||||
void BrowserAccessibilityStateImplWin::UpdateHistogramsOnOtherThread() {
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "content/browser/accessibility/browser_accessibility_win.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -3026,9 +3027,9 @@ TEST_F(BrowserAccessibilityWinTest, UniqueIdWinInvalidAfterDeletingTree) {
|
||||
int32_t child_unique_id = GetUniqueId(child);
|
||||
|
||||
// Now destroy that original tree and create a new tree.
|
||||
manager.reset(new BrowserAccessibilityManagerWin(
|
||||
manager = std::make_unique<BrowserAccessibilityManagerWin>(
|
||||
MakeAXTreeUpdate(root_node, child_node),
|
||||
test_browser_accessibility_delegate_.get()));
|
||||
test_browser_accessibility_delegate_.get());
|
||||
root = manager->GetRoot();
|
||||
int32_t root_unique_id_2 = GetUniqueId(root);
|
||||
child = root->PlatformGetChild(0);
|
||||
|
@ -1261,7 +1261,7 @@ void BrowserMainLoop::PostCreateThreadsImpl() {
|
||||
}
|
||||
|
||||
#if defined(OS_WIN)
|
||||
system_message_window_.reset(new media::SystemMessageWindowWin);
|
||||
system_message_window_ = std::make_unique<media::SystemMessageWindowWin>();
|
||||
#elif (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(USE_UDEV)
|
||||
device_monitor_linux_ = std::make_unique<media::DeviceMonitorLinux>();
|
||||
#elif defined(OS_MAC)
|
||||
|
@ -91,7 +91,7 @@ int BrowserMainRunnerImpl::Initialize(const MainFunctionParams& parameters) {
|
||||
// Ole must be initialized before starting message pump, so that TSF
|
||||
// (Text Services Framework) module can interact with the message pump
|
||||
// on Windows 8 Metro mode.
|
||||
ole_initializer_.reset(new ui::ScopedOleInitializer);
|
||||
ole_initializer_ = std::make_unique<ui::ScopedOleInitializer>();
|
||||
#endif // OS_WIN
|
||||
|
||||
gfx::InitializeFonts();
|
||||
|
@ -2469,8 +2469,9 @@ void RenderWidgetHostViewAura::OnUpdateTextInputStateCalled(
|
||||
#elif defined(OS_WIN)
|
||||
if (GetInputMethod()) {
|
||||
if (!virtual_keyboard_controller_win_) {
|
||||
virtual_keyboard_controller_win_.reset(
|
||||
new VirtualKeyboardControllerWin(this, GetInputMethod()));
|
||||
virtual_keyboard_controller_win_ =
|
||||
std::make_unique<VirtualKeyboardControllerWin>(this,
|
||||
GetInputMethod());
|
||||
}
|
||||
virtual_keyboard_controller_win_->UpdateTextInputState(state);
|
||||
}
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "content/browser/screenlock_monitor/screenlock_monitor_device_source.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/callback_helpers.h"
|
||||
#include "base/logging.h"
|
||||
@ -58,7 +60,7 @@ void ScreenlockMonitorDeviceSource::SessionMessageWindow::
|
||||
|
||||
ScreenlockMonitorDeviceSource::SessionMessageWindow::SessionMessageWindow() {
|
||||
// Create a window for receiving session change notifications.
|
||||
window_.reset(new base::win::MessageWindow());
|
||||
window_ = std::make_unique<base::win::MessageWindow>();
|
||||
if (!window_->Create(base::BindRepeating(&SessionMessageWindow::OnWndProc,
|
||||
base::Unretained(this)))) {
|
||||
DLOG(ERROR) << "Failed to create the screenlock monitor window.";
|
||||
|
@ -83,7 +83,7 @@ class DeviceMonitorMessageWindow {
|
||||
}
|
||||
|
||||
bool Init() {
|
||||
window_.reset(new base::win::MessageWindow());
|
||||
window_ = std::make_unique<base::win::MessageWindow>();
|
||||
if (!window_->CreateNamed(
|
||||
base::BindRepeating(&DeviceMonitorMessageWindow::HandleMessage,
|
||||
base::Unretained(this)),
|
||||
|
@ -50,7 +50,7 @@ class BluetoothDeviceWinTest : public testing::Test {
|
||||
BluetoothSocketThread::Get());
|
||||
|
||||
// Add device with audio/video services.
|
||||
device_state_.reset(new BluetoothTaskManagerWin::DeviceState());
|
||||
device_state_ = std::make_unique<BluetoothTaskManagerWin::DeviceState>();
|
||||
device_state_->name = std::string(kDeviceName);
|
||||
device_state_->address = kDeviceAddress;
|
||||
|
||||
@ -66,15 +66,16 @@ class BluetoothDeviceWinTest : public testing::Test {
|
||||
base::HexStringToBytes(kTestVideoSdpBytes, &video_state->sdp_bytes);
|
||||
device_state_->service_record_states.push_back(std::move(video_state));
|
||||
|
||||
device_.reset(new BluetoothDeviceWin(nullptr, *device_state_,
|
||||
ui_task_runner, socket_thread));
|
||||
device_ = std::make_unique<BluetoothDeviceWin>(
|
||||
nullptr, *device_state_, ui_task_runner, socket_thread);
|
||||
|
||||
// Add empty device.
|
||||
empty_device_state_.reset(new BluetoothTaskManagerWin::DeviceState());
|
||||
empty_device_state_ =
|
||||
std::make_unique<BluetoothTaskManagerWin::DeviceState>();
|
||||
empty_device_state_->name = std::string(kDeviceName);
|
||||
empty_device_state_->address = kDeviceAddress;
|
||||
empty_device_.reset(new BluetoothDeviceWin(nullptr, *empty_device_state_,
|
||||
ui_task_runner, socket_thread));
|
||||
empty_device_ = std::make_unique<BluetoothDeviceWin>(
|
||||
nullptr, *empty_device_state_, ui_task_runner, socket_thread);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/stl_util.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
@ -68,7 +70,7 @@ void RawInputDataFetcher::StartMonitor() {
|
||||
return;
|
||||
|
||||
if (!window_) {
|
||||
window_.reset(new base::win::MessageWindow());
|
||||
window_ = std::make_unique<base::win::MessageWindow>();
|
||||
if (!window_->Create(base::BindRepeating(
|
||||
&RawInputDataFetcher::HandleMessage, base::Unretained(this)))) {
|
||||
PLOG(ERROR) << "Failed to create the raw input window";
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/bind.h"
|
||||
@ -43,7 +44,8 @@ class AudioManagerHelper {
|
||||
// This should be called before creating an AudioManager in tests to ensure
|
||||
// that the creating thread is COM initialized.
|
||||
void InitializeCOMForTesting() {
|
||||
com_initializer_for_testing_.reset(new base::win::ScopedCOMInitializer());
|
||||
com_initializer_for_testing_ =
|
||||
std::make_unique<base::win::ScopedCOMInitializer>();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -516,9 +516,9 @@ void WASAPIAudioInputStream::Start(AudioInputCallback* callback) {
|
||||
// Create and start the thread that will drive the capturing by waiting for
|
||||
// capture events.
|
||||
DCHECK(!capture_thread_.get());
|
||||
capture_thread_.reset(new base::DelegateSimpleThread(
|
||||
capture_thread_ = std::make_unique<base::DelegateSimpleThread>(
|
||||
this, "wasapi_capture_thread",
|
||||
base::SimpleThread::Options(base::ThreadPriority::REALTIME_AUDIO)));
|
||||
base::SimpleThread::Options(base::ThreadPriority::REALTIME_AUDIO));
|
||||
capture_thread_->Start();
|
||||
|
||||
// Start streaming data between the endpoint buffer and the audio engine.
|
||||
@ -787,8 +787,8 @@ void WASAPIAudioInputStream::Run() {
|
||||
++buffers_required;
|
||||
|
||||
DCHECK(!fifo_);
|
||||
fifo_.reset(new AudioBlockFifo(input_format_.Format.nChannels,
|
||||
packet_size_frames_, buffers_required));
|
||||
fifo_ = std::make_unique<AudioBlockFifo>(
|
||||
input_format_.Format.nChannels, packet_size_frames_, buffers_required);
|
||||
DVLOG(1) << "AudioBlockFifo buffer count: " << buffers_required;
|
||||
|
||||
bool recording = true;
|
||||
@ -1439,7 +1439,7 @@ void WASAPIAudioInputStream::SetupConverterAndStoreFormatInfo() {
|
||||
output_layout, output_format_.nSamplesPerSec,
|
||||
packet_size_frames_);
|
||||
|
||||
converter_.reset(new AudioConverter(input, output, false));
|
||||
converter_ = std::make_unique<AudioConverter>(input, output, false);
|
||||
converter_->AddInput(this);
|
||||
converter_->PrimeWithSilence();
|
||||
convert_bus_ = AudioBus::Create(output);
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <objbase.h>
|
||||
|
||||
#include <climits>
|
||||
#include <memory>
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/command_line.h"
|
||||
@ -350,9 +351,9 @@ void WASAPIAudioOutputStream::Start(AudioSourceCallback* callback) {
|
||||
|
||||
// Create and start the thread that will drive the rendering by waiting for
|
||||
// render events.
|
||||
render_thread_.reset(new base::DelegateSimpleThread(
|
||||
render_thread_ = std::make_unique<base::DelegateSimpleThread>(
|
||||
this, "wasapi_render_thread",
|
||||
base::SimpleThread::Options(base::ThreadPriority::REALTIME_AUDIO)));
|
||||
base::SimpleThread::Options(base::ThreadPriority::REALTIME_AUDIO));
|
||||
render_thread_->Start();
|
||||
if (!render_thread_->HasBeenStarted()) {
|
||||
SendLogMessage("%s => (ERROR: Failed to start \"wasapi_render_thread\")",
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <stddef.h>
|
||||
#include <wincodec.h>
|
||||
|
||||
#include <memory>
|
||||
#include <thread>
|
||||
#include <utility>
|
||||
|
||||
@ -947,8 +948,8 @@ void VideoCaptureDeviceMFWin::AllocateAndStart(
|
||||
}
|
||||
|
||||
if (!photo_capabilities_.empty()) {
|
||||
selected_photo_capability_.reset(
|
||||
new CapabilityWin(photo_capabilities_.front()));
|
||||
selected_photo_capability_ =
|
||||
std::make_unique<CapabilityWin>(photo_capabilities_.front());
|
||||
}
|
||||
|
||||
CapabilityList video_capabilities;
|
||||
@ -1065,8 +1066,8 @@ void VideoCaptureDeviceMFWin::AllocateAndStart(
|
||||
return;
|
||||
}
|
||||
|
||||
selected_video_capability_.reset(
|
||||
new CapabilityWin(best_match_video_capability));
|
||||
selected_video_capability_ =
|
||||
std::make_unique<CapabilityWin>(best_match_video_capability);
|
||||
|
||||
is_started_ = true;
|
||||
}
|
||||
@ -1309,7 +1310,7 @@ void VideoCaptureDeviceMFWin::SetPhotoOptions(
|
||||
|
||||
const CapabilityWin best_match = GetBestMatchedPhotoCapability(
|
||||
current_source_media_type, requested_size, photo_capabilities_);
|
||||
selected_photo_capability_.reset(new CapabilityWin(best_match));
|
||||
selected_photo_capability_ = std::make_unique<CapabilityWin>(best_match);
|
||||
}
|
||||
|
||||
if (camera_control_ && video_control_) {
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include <dbt.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/stl_util.h"
|
||||
@ -98,7 +100,7 @@ SystemMessageWindowWin::SystemMessageWindowWin() {
|
||||
window_ =
|
||||
CreateWindow(kWindowClassName, 0, 0, 0, 0, 0, 0, 0, 0, instance_, 0);
|
||||
SetWindowLongPtr(window_, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
|
||||
device_notifications_.reset(new DeviceNotifications(window_));
|
||||
device_notifications_ = std::make_unique<DeviceNotifications>(window_);
|
||||
}
|
||||
|
||||
SystemMessageWindowWin::~SystemMessageWindowWin() {
|
||||
|
@ -364,7 +364,7 @@ bool H264ConfigChangeDetector::DetectConfig(const uint8_t* stream,
|
||||
bool idr_seen = false;
|
||||
|
||||
if (!parser_.get())
|
||||
parser_.reset(new H264Parser);
|
||||
parser_ = std::make_unique<H264Parser>();
|
||||
|
||||
parser_->SetStream(stream, size);
|
||||
config_changed_ = false;
|
||||
@ -807,11 +807,11 @@ bool DXVAVideoDecodeAccelerator::Initialize(const Config& config,
|
||||
"Send MFT_MESSAGE_NOTIFY_START_OF_STREAM notification failed", false);
|
||||
|
||||
if (codec_ == kCodecH264)
|
||||
config_change_detector_.reset(new H264ConfigChangeDetector());
|
||||
config_change_detector_ = std::make_unique<H264ConfigChangeDetector>();
|
||||
if (codec_ == kCodecVP8)
|
||||
config_change_detector_.reset(new VP8ConfigChangeDetector());
|
||||
config_change_detector_ = std::make_unique<VP8ConfigChangeDetector>();
|
||||
if (codec_ == kCodecVP9)
|
||||
config_change_detector_.reset(new VP9ConfigChangeDetector());
|
||||
config_change_detector_ = std::make_unique<VP9ConfigChangeDetector>();
|
||||
|
||||
processing_config_changed_ = false;
|
||||
SetState(kNormal);
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <objbase.h>
|
||||
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@ -245,7 +246,8 @@ bool MediaFoundationVideoEncodeAccelerator::Initialize(const Config& config,
|
||||
}
|
||||
}
|
||||
|
||||
main_client_weak_factory_.reset(new base::WeakPtrFactory<Client>(client));
|
||||
main_client_weak_factory_ =
|
||||
std::make_unique<base::WeakPtrFactory<Client>>(client);
|
||||
main_client_ = main_client_weak_factory_->GetWeakPtr();
|
||||
input_visible_size_ = config.input_visible_size;
|
||||
if (config.initial_framerate.has_value())
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@ -633,7 +634,7 @@ MidiManagerWin::PortManager::HandleMidiInCallback(HMIDIIN hmi,
|
||||
if (IsRunningInsideMidiInGetNumDevs())
|
||||
GetTaskLock()->AssertAcquired();
|
||||
else
|
||||
task_lock.reset(new base::AutoLock(*GetTaskLock()));
|
||||
task_lock = std::make_unique<base::AutoLock>(*GetTaskLock());
|
||||
{
|
||||
base::AutoLock lock(*GetInstanceIdLock());
|
||||
if (instance_id != g_active_instance_id)
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <wrl/event.h>
|
||||
|
||||
#include <iomanip>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
@ -828,8 +829,8 @@ void MidiManagerWinrt::InitializeOnComRunner() {
|
||||
return;
|
||||
}
|
||||
|
||||
port_manager_in_.reset(new MidiInPortManager(this));
|
||||
port_manager_out_.reset(new MidiOutPortManager(this));
|
||||
port_manager_in_ = std::make_unique<MidiInPortManager>(this);
|
||||
port_manager_out_ = std::make_unique<MidiOutPortManager>(this);
|
||||
|
||||
if (!(port_manager_in_->StartWatcher() &&
|
||||
port_manager_out_->StartWatcher())) {
|
||||
|
@ -771,7 +771,7 @@ bool DnsConfigServiceWin::StartWatching() {
|
||||
if (!hosts_reader_)
|
||||
hosts_reader_ = base::MakeRefCounted<HostsReader>(*this);
|
||||
// TODO(szym): re-start watcher if that makes sense. http://crbug.com/116139
|
||||
watcher_.reset(new Watcher(*this));
|
||||
watcher_ = std::make_unique<Watcher>(*this);
|
||||
return watcher_->Watch();
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ class HttpAuthHandlerNegotiateTest : public PlatformTest,
|
||||
|
||||
void SetupMocks(MockAuthLibrary* mock_library) {
|
||||
#if defined(OS_WIN)
|
||||
security_package_.reset(new SecPkgInfoW);
|
||||
security_package_ = std::make_unique<SecPkgInfoW>();
|
||||
memset(security_package_.get(), 0x0, sizeof(SecPkgInfoW));
|
||||
security_package_->cbMaxToken = 1337;
|
||||
mock_library->ExpectQuerySecurityPackageInfo(SEC_E_OK,
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "net/proxy_resolution/win/dhcp_pac_file_adapter_fetcher_win.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
@ -310,11 +312,11 @@ TEST(DhcpPacFileAdapterFetcher, MockDhcpRealFetch) {
|
||||
|
||||
FetcherClient client;
|
||||
TestURLRequestContext url_request_context;
|
||||
client.fetcher_.reset(new MockDhcpRealFetchPacFileAdapterFetcher(
|
||||
client.fetcher_ = std::make_unique<MockDhcpRealFetchPacFileAdapterFetcher>(
|
||||
&url_request_context,
|
||||
base::ThreadPool::CreateTaskRunner(
|
||||
{base::MayBlock(),
|
||||
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN})));
|
||||
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}));
|
||||
client.fetcher_->configured_url_ = configured_url.spec();
|
||||
client.RunTest();
|
||||
client.WaitForResult(OK);
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "net/proxy_resolution/win/dhcp_pac_file_fetcher_win.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "base/bind.h"
|
||||
@ -200,8 +201,8 @@ TEST(DhcpPacFileFetcherWin, RealFetchWithDeferredCancel) {
|
||||
// introduces a guaranteed 20 ms delay on the worker threads so that
|
||||
// the cancel is called before they complete.
|
||||
RealFetchTester fetcher;
|
||||
fetcher.fetcher_.reset(
|
||||
new DelayingDhcpPacFileFetcherWin(fetcher.context_.get()));
|
||||
fetcher.fetcher_ =
|
||||
std::make_unique<DelayingDhcpPacFileFetcherWin>(fetcher.context_.get());
|
||||
fetcher.on_completion_is_error_ = true;
|
||||
fetcher.RunTestWithDeferredCancel();
|
||||
fetcher.WaitUntilDone();
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include <windows.h>
|
||||
#include <winhttp.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
@ -223,7 +225,7 @@ int ProxyResolverFactoryWinHttp::CreateProxyResolver(
|
||||
std::unique_ptr<ProxyResolver>* resolver,
|
||||
CompletionOnceCallback callback,
|
||||
std::unique_ptr<Request>* request) {
|
||||
resolver->reset(new ProxyResolverWinHttp(pac_script));
|
||||
*resolver = std::make_unique<ProxyResolverWinHttp>(pac_script);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <errno.h>
|
||||
#include <mstcpip.h>
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/bind.h"
|
||||
@ -315,7 +316,7 @@ int TCPSocketWin::AdoptConnectedSocket(SocketDescriptor socket,
|
||||
}
|
||||
|
||||
core_ = new Core(this);
|
||||
peer_address_.reset(new IPEndPoint(peer_address));
|
||||
peer_address_ = std::make_unique<IPEndPoint>(peer_address);
|
||||
|
||||
return OK;
|
||||
}
|
||||
@ -425,7 +426,7 @@ int TCPSocketWin::Connect(const IPEndPoint& address,
|
||||
if (!logging_multiple_connect_attempts_)
|
||||
LogConnectBegin(AddressList(address));
|
||||
|
||||
peer_address_.reset(new IPEndPoint(address));
|
||||
peer_address_ = std::make_unique<IPEndPoint>(address);
|
||||
|
||||
int rv = DoConnect();
|
||||
if (rv == ERR_IO_PENDING) {
|
||||
|
@ -7,6 +7,8 @@
|
||||
#include <mstcpip.h>
|
||||
#include <winsock2.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/callback.h"
|
||||
#include "base/check_op.h"
|
||||
@ -438,7 +440,7 @@ int UDPSocketWin::SendToOrWrite(IOBuffer* buf,
|
||||
return nwrite;
|
||||
|
||||
if (address)
|
||||
send_to_address_.reset(new IPEndPoint(*address));
|
||||
send_to_address_ = std::make_unique<IPEndPoint>(*address);
|
||||
write_callback_ = std::move(callback);
|
||||
return ERR_IO_PENDING;
|
||||
}
|
||||
@ -480,7 +482,7 @@ int UDPSocketWin::InternalConnect(const IPEndPoint& address) {
|
||||
if (rv < 0)
|
||||
return MapSystemError(WSAGetLastError());
|
||||
|
||||
remote_address_.reset(new IPEndPoint(address));
|
||||
remote_address_ = std::make_unique<IPEndPoint>(address);
|
||||
|
||||
if (dscp_manager_)
|
||||
dscp_manager_->PrepareForSend(*remote_address_.get());
|
||||
|
@ -36,10 +36,10 @@ std::unique_ptr<base::win::ScopedCOMInitializer> CreateComInitializer(
|
||||
AutoThread::ComInitType type) {
|
||||
std::unique_ptr<base::win::ScopedCOMInitializer> initializer;
|
||||
if (type == AutoThread::COM_INIT_MTA) {
|
||||
initializer.reset(new base::win::ScopedCOMInitializer(
|
||||
base::win::ScopedCOMInitializer::kMTA));
|
||||
initializer = std::make_unique<base::win::ScopedCOMInitializer>(
|
||||
base::win::ScopedCOMInitializer::kMTA);
|
||||
} else if (type == AutoThread::COM_INIT_STA) {
|
||||
initializer.reset(new base::win::ScopedCOMInitializer());
|
||||
initializer = std::make_unique<base::win::ScopedCOMInitializer>();
|
||||
}
|
||||
return initializer;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <windows.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/logging.h"
|
||||
@ -66,7 +67,7 @@ bool AudioCapturerWin::Start(const PacketCapturedCallback& callback) {
|
||||
// be reset or restarted in ResetAndInitialize() function. Which means we
|
||||
// expect the audio_device_period_ is a system wide configuration, it would
|
||||
// not be changed with the default audio device.
|
||||
capture_timer_.reset(new base::RepeatingTimer());
|
||||
capture_timer_ = std::make_unique<base::RepeatingTimer>();
|
||||
capture_timer_->Start(FROM_HERE, audio_device_period_, this,
|
||||
&AudioCapturerWin::DoCapture);
|
||||
return true;
|
||||
@ -109,8 +110,8 @@ bool AudioCapturerWin::Initialize() {
|
||||
return false;
|
||||
}
|
||||
|
||||
default_device_detector_.reset(
|
||||
new DefaultAudioDeviceChangeDetector(mm_device_enumerator));
|
||||
default_device_detector_ =
|
||||
std::make_unique<DefaultAudioDeviceChangeDetector>(mm_device_enumerator);
|
||||
|
||||
// Get the audio endpoint.
|
||||
hr = mm_device_enumerator->GetDefaultAudioEndpoint(eRender, eConsole,
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "base/bind.h"
|
||||
@ -141,7 +142,7 @@ void ClipboardWin::Start(
|
||||
|
||||
client_clipboard_.swap(client_clipboard);
|
||||
|
||||
window_.reset(new base::win::MessageWindow());
|
||||
window_ = std::make_unique<base::win::MessageWindow>();
|
||||
if (!window_->Create(base::BindRepeating(&ClipboardWin::HandleMessage,
|
||||
base::Unretained(this)))) {
|
||||
LOG(ERROR) << "Couldn't create clipboard window.";
|
||||
|
@ -243,7 +243,8 @@ void DaemonProcessWin::LaunchNetworkProcess() {
|
||||
|
||||
std::unique_ptr<UnprivilegedProcessDelegate> delegate(
|
||||
new UnprivilegedProcessDelegate(io_task_runner(), std::move(target)));
|
||||
network_launcher_.reset(new WorkerProcessLauncher(std::move(delegate), this));
|
||||
network_launcher_ =
|
||||
std::make_unique<WorkerProcessLauncher>(std::move(delegate), this);
|
||||
}
|
||||
|
||||
std::unique_ptr<DaemonProcess> DaemonProcess::Create(
|
||||
|
@ -83,9 +83,10 @@ int DesktopProcessMain() {
|
||||
auto lock_workstation_closure = base::BindRepeating(
|
||||
&DesktopProcess::LockWorkstation, base::Unretained(&desktop_process));
|
||||
|
||||
desktop_environment_factory.reset(new SessionDesktopEnvironmentFactory(
|
||||
ui_task_runner, video_capture_task_runner, input_task_runner,
|
||||
ui_task_runner, inject_sas_closure, lock_workstation_closure));
|
||||
desktop_environment_factory =
|
||||
std::make_unique<SessionDesktopEnvironmentFactory>(
|
||||
ui_task_runner, video_capture_task_runner, input_task_runner,
|
||||
ui_task_runner, inject_sas_closure, lock_workstation_closure);
|
||||
#else // !defined(OS_WIN)
|
||||
desktop_environment_factory.reset(new Me2MeDesktopEnvironmentFactory(
|
||||
ui_task_runner, video_capture_task_runner, input_task_runner,
|
||||
|
@ -652,7 +652,8 @@ void DesktopSessionWin::OnSessionAttached(uint32_t session_id) {
|
||||
}
|
||||
|
||||
// Create a launcher for the desktop process, using the per-session delegate.
|
||||
launcher_.reset(new WorkerProcessLauncher(std::move(delegate), this));
|
||||
launcher_ =
|
||||
std::make_unique<WorkerProcessLauncher>(std::move(delegate), this);
|
||||
session_id_ = session_id;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "remoting/host/input_monitor/local_input_monitor_win.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/bind.h"
|
||||
@ -120,7 +121,7 @@ LocalInputMonitorWinImpl::Core::~Core() {
|
||||
void LocalInputMonitorWinImpl::Core::StartOnUiThread() {
|
||||
DCHECK(ui_task_runner_->BelongsToCurrentThread());
|
||||
|
||||
window_.reset(new base::win::MessageWindow());
|
||||
window_ = std::make_unique<base::win::MessageWindow>();
|
||||
if (!window_->Create(
|
||||
base::BindRepeating(&Core::HandleMessage, base::Unretained(this)))) {
|
||||
PLOG(ERROR) << "Failed to create the raw input window";
|
||||
|
@ -660,11 +660,11 @@ bool It2MeNativeMessagingHost::DelegateToElevatedHost(
|
||||
// The new process runs at an elevated level due to being granted uiAccess.
|
||||
// |parent_window_handle| can be used to position dialog windows but is not
|
||||
// currently used.
|
||||
elevated_host_.reset(new ElevatedNativeMessagingHost(
|
||||
elevated_host_ = std::make_unique<ElevatedNativeMessagingHost>(
|
||||
binary_path.DirName().Append(kElevatedHostBinaryName),
|
||||
/*parent_window_handle=*/0,
|
||||
/*elevate_process=*/false,
|
||||
/*host_timeout=*/base::TimeDelta(), client_));
|
||||
/*host_timeout=*/base::TimeDelta(), client_);
|
||||
}
|
||||
|
||||
if (elevated_host_->EnsureElevatedHostCreated() ==
|
||||
|
@ -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 "remoting/host/pairing_registry_delegate_win.h"
|
||||
|
||||
#include "base/guid.h"
|
||||
@ -110,7 +112,7 @@ TEST_F(PairingRegistryDelegateWinTest, Unprivileged) {
|
||||
|
||||
// Strip the delegate from write access and validate that it still can be used
|
||||
// to read the pairings.
|
||||
delegate.reset(new PairingRegistryDelegateWin());
|
||||
delegate = std::make_unique<PairingRegistryDelegateWin>();
|
||||
delegate->SetRootKeys(nullptr, unprivileged_.Handle());
|
||||
|
||||
PairingRegistry::Pairing unprivileged_pairing =
|
||||
|
@ -412,8 +412,8 @@ std::unique_ptr<PolicyWatcher> PolicyWatcher::CreateWithTaskRunner(
|
||||
// Chromium.
|
||||
std::unique_ptr<policy::AsyncPolicyLoader> policy_loader;
|
||||
#if defined(OS_WIN)
|
||||
policy_loader.reset(new policy::PolicyLoaderWin(
|
||||
file_task_runner, L"SOFTWARE\\Policies\\Google\\Chrome"));
|
||||
policy_loader = std::make_unique<policy::PolicyLoaderWin>(
|
||||
file_task_runner, L"SOFTWARE\\Policies\\Google\\Chrome");
|
||||
#elif defined(OS_APPLE)
|
||||
CFStringRef bundle_id = CFSTR("com.google.Chrome");
|
||||
policy_loader = std::make_unique<policy::PolicyLoaderMac>(
|
||||
|
@ -1612,8 +1612,8 @@ void HostProcess::StartHost() {
|
||||
|
||||
// Set up reporting the host status notifications.
|
||||
#if defined(REMOTING_MULTI_PROCESS)
|
||||
host_event_logger_.reset(
|
||||
new IpcHostEventLogger(host_->status_monitor(), daemon_channel_.get()));
|
||||
host_event_logger_ = std::make_unique<IpcHostEventLogger>(
|
||||
host_->status_monitor(), daemon_channel_.get());
|
||||
#else // !defined(REMOTING_MULTI_PROCESS)
|
||||
host_event_logger_ =
|
||||
HostEventLogger::Create(host_->status_monitor(), kApplicationName);
|
||||
|
@ -130,7 +130,7 @@ void SecurityKeyAuthHandlerWinTest::OperationComplete() {
|
||||
|
||||
void SecurityKeyAuthHandlerWinTest::WaitForOperationComplete() {
|
||||
run_loop_->Run();
|
||||
run_loop_.reset(new base::RunLoop());
|
||||
run_loop_ = std::make_unique<base::RunLoop>();
|
||||
}
|
||||
|
||||
void SecurityKeyAuthHandlerWinTest::SendMessageToClient(
|
||||
|
@ -592,12 +592,11 @@ Me2MeNativeMessagingHost::DelegateToElevatedHost(
|
||||
DCHECK(needs_elevation_);
|
||||
|
||||
if (!elevated_host_) {
|
||||
elevated_host_.reset(new ElevatedNativeMessagingHost(
|
||||
elevated_host_ = std::make_unique<ElevatedNativeMessagingHost>(
|
||||
base::CommandLine::ForCurrentProcess()->GetProgram(),
|
||||
parent_window_handle_,
|
||||
/*elevate_process=*/true,
|
||||
base::TimeDelta::FromSeconds(kElevatedHostTimeoutSeconds),
|
||||
client_));
|
||||
base::TimeDelta::FromSeconds(kElevatedHostTimeoutSeconds), client_);
|
||||
}
|
||||
|
||||
ProcessLaunchResult result = elevated_host_->EnsureElevatedHostCreated();
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <windows.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/callback_helpers.h"
|
||||
@ -147,8 +148,8 @@ void RdpClient::Core::Connect(const ScreenResolution& resolution,
|
||||
base::checked_cast<uint16_t>(port_number));
|
||||
|
||||
// Create the ActiveX control window.
|
||||
rdp_client_window_.reset(new RdpClientWindow(server_endpoint, terminal_id,
|
||||
this));
|
||||
rdp_client_window_ =
|
||||
std::make_unique<RdpClientWindow>(server_endpoint, terminal_id, this);
|
||||
if (!rdp_client_window_->Connect(resolution)) {
|
||||
rdp_client_window_.reset();
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "remoting/host/win/rdp_client.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "base/bind.h"
|
||||
@ -123,7 +124,7 @@ void RdpClientTest::SetUp() {
|
||||
task_runner_ = new AutoThreadTaskRunner(
|
||||
task_environment_.GetMainThreadTaskRunner(), run_loop_.QuitClosure());
|
||||
|
||||
module_.reset(new RdpClientModule());
|
||||
module_ = std::make_unique<RdpClientModule>();
|
||||
}
|
||||
|
||||
void RdpClientTest::TearDown() {
|
||||
@ -164,11 +165,11 @@ TEST_F(RdpClientTest, Basic) {
|
||||
.Times(AtMost(1))
|
||||
.WillOnce(InvokeWithoutArgs(this, &RdpClientTest::CloseRdpClient));
|
||||
|
||||
rdp_client_.reset(new RdpClient(
|
||||
rdp_client_ = std::make_unique<RdpClient>(
|
||||
task_runner_, task_runner_,
|
||||
ScreenResolution(webrtc::DesktopSize(kDefaultWidth, kDefaultHeight),
|
||||
webrtc::DesktopVector(kDefaultDpi, kDefaultDpi)),
|
||||
terminal_id_, kDefaultRdpPort, &event_handler_));
|
||||
terminal_id_, kDefaultRdpPort, &event_handler_);
|
||||
task_runner_ = nullptr;
|
||||
|
||||
run_loop_.Run();
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "remoting/host/win/rdp_desktop_session.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "remoting/base/auto_thread_task_runner.h"
|
||||
#include "remoting/host/screen_resolution.h"
|
||||
@ -32,11 +34,11 @@ STDMETHODIMP RdpDesktopSession::Connect(
|
||||
ChromotingModule::task_runner();
|
||||
DCHECK(task_runner->BelongsToCurrentThread());
|
||||
|
||||
client_.reset(
|
||||
new RdpClient(task_runner, task_runner,
|
||||
ScreenResolution(webrtc::DesktopSize(width, height),
|
||||
webrtc::DesktopVector(dpi_x, dpi_y)),
|
||||
base::WideToUTF8(terminal_id), port_number, this));
|
||||
client_ = std::make_unique<RdpClient>(
|
||||
task_runner, task_runner,
|
||||
ScreenResolution(webrtc::DesktopSize(width, height),
|
||||
webrtc::DesktopVector(dpi_x, dpi_y)),
|
||||
base::WideToUTF8(terminal_id), port_number, this);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/bind.h"
|
||||
@ -197,7 +198,7 @@ void WorkerProcessLauncherTest::SetUp() {
|
||||
base::Unretained(this)));
|
||||
|
||||
// Set up process launcher delegate
|
||||
launcher_delegate_.reset(new MockProcessLauncherDelegate());
|
||||
launcher_delegate_ = std::make_unique<MockProcessLauncherDelegate>();
|
||||
EXPECT_CALL(*launcher_delegate_, Send(_))
|
||||
.Times(AnyNumber())
|
||||
.WillRepeatedly(Invoke(this, &WorkerProcessLauncherTest::SendToProcess));
|
||||
@ -321,8 +322,8 @@ void WorkerProcessLauncherTest::CrashWorker() {
|
||||
}
|
||||
|
||||
void WorkerProcessLauncherTest::StartWorker() {
|
||||
launcher_.reset(new WorkerProcessLauncher(std::move(launcher_delegate_),
|
||||
&server_listener_));
|
||||
launcher_ = std::make_unique<WorkerProcessLauncher>(
|
||||
std::move(launcher_delegate_), &server_listener_);
|
||||
|
||||
launcher_->SetKillProcessTimeoutForTest(
|
||||
base::TimeDelta::FromMilliseconds(100));
|
||||
|
@ -432,7 +432,7 @@ ResultCode InterceptionManager::PatchClientFunctions(
|
||||
|
||||
std::unique_ptr<ServiceResolverThunk> thunk;
|
||||
#if defined(_WIN64)
|
||||
thunk.reset(new ServiceResolverThunk(child_.Process(), relaxed_));
|
||||
thunk = std::make_unique<ServiceResolverThunk>(child_.Process(), relaxed_);
|
||||
#else
|
||||
base::win::OSInfo* os_info = base::win::OSInfo::GetInstance();
|
||||
base::win::Version real_os_version = os_info->Kernel32Version();
|
||||
|
@ -82,11 +82,11 @@ bool ProcessPolicy::GenerateRules(const wchar_t* name,
|
||||
std::unique_ptr<PolicyRule> process;
|
||||
switch (semantics) {
|
||||
case TargetPolicy::PROCESS_MIN_EXEC: {
|
||||
process.reset(new PolicyRule(GIVE_READONLY));
|
||||
process = std::make_unique<PolicyRule>(GIVE_READONLY);
|
||||
break;
|
||||
};
|
||||
case TargetPolicy::PROCESS_ALL_EXEC: {
|
||||
process.reset(new PolicyRule(GIVE_ALLACCESS));
|
||||
process = std::make_unique<PolicyRule>(GIVE_ALLACCESS);
|
||||
break;
|
||||
};
|
||||
default: { return false; };
|
||||
|
@ -8,6 +8,8 @@
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/macros.h"
|
||||
@ -111,7 +113,7 @@ PolicyBase::PolicyBase()
|
||||
add_restricting_random_sid_(false),
|
||||
effective_token_(nullptr) {
|
||||
::InitializeCriticalSection(&lock_);
|
||||
dispatcher_.reset(new TopLevelDispatcher(this));
|
||||
dispatcher_ = std::make_unique<TopLevelDispatcher>(this);
|
||||
}
|
||||
|
||||
PolicyBase::~PolicyBase() {
|
||||
|
@ -67,7 +67,7 @@ bool GetTokenAppContainerSid(HANDLE token_handle,
|
||||
app_container_info.data());
|
||||
if (!info->TokenAppContainer)
|
||||
return false;
|
||||
*app_container_sid = std::unique_ptr<Sid>(new Sid(info->TokenAppContainer));
|
||||
*app_container_sid = std::make_unique<Sid>(info->TokenAppContainer);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -299,9 +299,9 @@ ResultCode TargetProcess::Init(Dispatcher* ipc_dispatcher,
|
||||
return ret;
|
||||
}
|
||||
|
||||
ipc_server_.reset(new SharedMemIPCServer(
|
||||
ipc_server_ = std::make_unique<SharedMemIPCServer>(
|
||||
sandbox_process_info_.process_handle(),
|
||||
sandbox_process_info_.process_id(), thread_pool_, ipc_dispatcher));
|
||||
sandbox_process_info_.process_id(), thread_pool_, ipc_dispatcher);
|
||||
|
||||
if (!ipc_server_->Init(shared_memory, shared_IPC_size, kIPCChannelSize))
|
||||
return SBOX_ERROR_NO_SPACE;
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/bind.h"
|
||||
@ -154,8 +155,8 @@ bool SerialIoHandlerWin::PostOpen() {
|
||||
base::CurrentIOThread::Get()->RegisterIOHandler(file().GetPlatformFile(),
|
||||
this);
|
||||
|
||||
read_context_.reset(new base::MessagePumpForIO::IOContext());
|
||||
write_context_.reset(new base::MessagePumpForIO::IOContext());
|
||||
read_context_ = std::make_unique<base::MessagePumpForIO::IOContext>();
|
||||
write_context_ = std::make_unique<base::MessagePumpForIO::IOContext>();
|
||||
|
||||
// Based on the MSDN documentation setting both ReadIntervalTimeout and
|
||||
// ReadTotalTimeoutMultiplier to MAXDWORD should cause ReadFile() to return
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "services/preferences/tracked/registry_hash_store_contents_win.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "base/bind.h"
|
||||
@ -37,8 +38,8 @@ class RegistryHashStoreContentsWinTest : public testing::Test {
|
||||
ASSERT_NO_FATAL_FAILURE(
|
||||
registry_override_manager_.OverrideRegistry(HKEY_CURRENT_USER));
|
||||
|
||||
contents.reset(
|
||||
new RegistryHashStoreContentsWin(kRegistryPath, kStoreKey, nullptr));
|
||||
contents = std::make_unique<RegistryHashStoreContentsWin>(
|
||||
kRegistryPath, kStoreKey, nullptr);
|
||||
}
|
||||
|
||||
std::unique_ptr<HashStoreContents> contents;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user