0

Apply modernize-make-unique for ChromeOS

This picks up make_unique changes for target_os = "chromeos" which were
not hit on my previous Mac build.

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

Bug: 1194272
Change-Id: Ia5c355daecbcb0c81d69db746c97c9f321b22bae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2826514
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@{#872701}
This commit is contained in:
Peter Boström
2021-04-15 03:53:08 +00:00
committed by Chromium LUCI CQ
parent 4687337441
commit 6b70182c21
533 changed files with 2208 additions and 1687 deletions
ash
accelerators
accessibility
app_list
components
debug.cc
display
drag_drop
events
focus_cycler_unittest.cc
keyboard
metrics
multi_user
public
root_window_controller.cc
rotator
shelf
shell.cc
system
tooltips
touch
wallpaper
wm
base
chrome
browser
ash
accessibility
app_mode
arc
attestation
login
notifications
ownership
profiles
scanning
settings
system
browser_process_platform_part_chromeos.cc
chromeos
chrome_browser_main_chromeos.cc
customization
extensions
file_manager
file_system_provider
fileapi
first_run
full_restore
input_method
launcher_search_provider
net
network_change_manager_client_browsertest.ccnote_taking_helper_unittest.cc
policy
power
preferences.ccpreferences_unittest.ccproxy_config_service_impl_unittest.ccsession_length_limiter_unittest.ccshutdown_policy_browsertest.cc
usb
download
extensions
media
media_galleries
metrics
net
notifications
platform_util_unittest.cc
policy
profiles
renderer_context_menu
resource_coordinator
speech
spellchecker
supervised_user
ui
test
chromeos
components
cryptohome
dbus
disks
geolocation
login
network
process_proxy
services
settings
timezone
tpm
ui
components
content
dbus
device
extensions
gpu/command_buffer/service
headless/lib/browser
ipc
media
mojo/core
net
remoting/host
services
third_party/blink
common
renderer
controller
core
modules
platform
tools/json_schema_compiler/test
ui

@ -4,6 +4,8 @@
#include "ash/accelerators/magnifier_key_scroller.h"
#include <memory>
#include "ash/accessibility/magnifier/magnification_controller.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
@ -23,8 +25,8 @@ class KeyEventDelegate : public aura::test::TestWindowDelegate {
// ui::EventHandler overrides:
void OnKeyEvent(ui::KeyEvent* event) override {
key_event.reset(
new ui::KeyEvent(event->type(), event->key_code(), event->flags()));
key_event = std::make_unique<ui::KeyEvent>(event->type(), event->key_code(),
event->flags());
}
const ui::KeyEvent* event() const { return key_event.get(); }

@ -4,6 +4,8 @@
#include "ash/accessibility/chromevox/touch_accessibility_enabler.h"
#include <memory>
#include "ash/accessibility/chromevox/mock_touch_exploration_controller_delegate.h"
#include "ash/accessibility/chromevox/touch_exploration_controller.h"
#include "base/macros.h"
@ -61,13 +63,14 @@ class TouchAccessibilityEnablerTest : public aura::test::AuraTestBase {
void SetUp() override {
aura::test::AuraTestBase::SetUp();
generator_.reset(new ui::test::EventGenerator(root_window()));
generator_ = std::make_unique<ui::test::EventGenerator>(root_window());
// Tests fail if time is ever 0.
simulated_clock_.Advance(base::TimeDelta::FromMilliseconds(10));
ui::SetEventTickClockForTesting(&simulated_clock_);
enabler_.reset(new TouchAccessibilityEnabler(root_window(), &delegate_));
enabler_ =
std::make_unique<TouchAccessibilityEnabler>(root_window(), &delegate_);
}
void TearDown() override {

@ -5,6 +5,7 @@
#include "ash/accessibility/chromevox/touch_exploration_controller.h"
#include <algorithm>
#include <memory>
#include <string>
#include <utility>
@ -377,7 +378,7 @@ TouchExplorationController::InSingleTapOrTouchExploreReleased(
most_recent_press_timestamp_ = event.time_stamp();
// This will update as the finger moves before a possible passthrough, and
// will determine the offset.
last_unused_finger_event_.reset(new ui::TouchEvent(event));
last_unused_finger_event_ = std::make_unique<ui::TouchEvent>(event);
last_unused_finger_continuation_ = continuation;
return DiscardEvent(continuation);
}
@ -628,17 +629,17 @@ void TouchExplorationController::SendSimulatedClick() {
void TouchExplorationController::SendSimulatedTap(
const Continuation continuation) {
std::unique_ptr<ui::TouchEvent> touch_press;
touch_press.reset(new ui::TouchEvent(ui::ET_TOUCH_PRESSED, gfx::Point(),
Now(),
initial_press_->pointer_details()));
touch_press = std::make_unique<ui::TouchEvent>(
ui::ET_TOUCH_PRESSED, gfx::Point(), Now(),
initial_press_->pointer_details());
touch_press->set_location_f(anchor_point_dip_);
touch_press->set_root_location_f(anchor_point_dip_);
DispatchEvent(touch_press.get(), continuation);
std::unique_ptr<ui::TouchEvent> touch_release;
touch_release.reset(new ui::TouchEvent(ui::ET_TOUCH_RELEASED, gfx::Point(),
Now(),
initial_press_->pointer_details()));
touch_release = std::make_unique<ui::TouchEvent>(
ui::ET_TOUCH_RELEASED, gfx::Point(), Now(),
initial_press_->pointer_details());
touch_release->set_location_f(anchor_point_dip_);
touch_release->set_root_location_f(anchor_point_dip_);
DispatchEvent(touch_release.get(), continuation);

@ -168,9 +168,10 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
if (gl::GetGLImplementation() == gl::kGLImplementationNone)
gl::GLSurfaceTestSupport::InitializeOneOff();
aura::test::AuraTestBase::SetUp();
cursor_client_.reset(new aura::test::TestCursorClient(root_window()));
cursor_client_ =
std::make_unique<aura::test::TestCursorClient>(root_window());
root_window()->AddPreTargetHandler(&event_capturer_);
generator_.reset(new ui::test::EventGenerator(root_window()));
generator_ = std::make_unique<ui::test::EventGenerator>(root_window());
// Tests fail if time is ever 0.
simulated_clock_.Advance(base::TimeDelta::FromMilliseconds(10));
@ -262,8 +263,10 @@ class TouchExplorationTest : public aura::test::AuraTestBase {
if (!on && touch_exploration_controller_.get()) {
touch_exploration_controller_.reset();
} else if (on && !touch_exploration_controller_.get()) {
touch_exploration_controller_.reset(new TouchExplorationControllerTestApi(
new TouchExplorationController(root_window(), &delegate_, nullptr)));
touch_exploration_controller_ =
std::make_unique<TouchExplorationControllerTestApi>(
new TouchExplorationController(root_window(), &delegate_,
nullptr));
cursor_client()->ShowCursor();
cursor_client()->DisableMouseEvents();
}

@ -219,8 +219,8 @@ void TouchExplorationManager::UpdateTouchExplorationState() {
if (!touch_accessibility_enabler_) {
// Always enable gesture to toggle spoken feedback.
touch_accessibility_enabler_.reset(new TouchAccessibilityEnabler(
root_window_controller_->GetRootWindow(), this));
touch_accessibility_enabler_ = std::make_unique<TouchAccessibilityEnabler>(
root_window_controller_->GetRootWindow(), this);
}
if (spoken_feedback_enabled) {

@ -4,6 +4,8 @@
#include "ash/accessibility/sticky_keys/sticky_keys_controller.h"
#include <memory>
#include "ash/accessibility/sticky_keys/sticky_keys_overlay.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tracker.h"
@ -64,14 +66,18 @@ void StickyKeysController::Enable(bool enabled) {
// Reset key handlers when activating sticky keys to ensure all
// the handlers' states are reset.
if (enabled_) {
shift_sticky_key_.reset(new StickyKeysHandler(ui::EF_SHIFT_DOWN));
alt_sticky_key_.reset(new StickyKeysHandler(ui::EF_ALT_DOWN));
altgr_sticky_key_.reset(new StickyKeysHandler(ui::EF_ALTGR_DOWN));
ctrl_sticky_key_.reset(new StickyKeysHandler(ui::EF_CONTROL_DOWN));
mod3_sticky_key_.reset(new StickyKeysHandler(ui::EF_MOD3_DOWN));
search_sticky_key_.reset(new StickyKeysHandler(ui::EF_COMMAND_DOWN));
shift_sticky_key_ =
std::make_unique<StickyKeysHandler>(ui::EF_SHIFT_DOWN);
alt_sticky_key_ = std::make_unique<StickyKeysHandler>(ui::EF_ALT_DOWN);
altgr_sticky_key_ =
std::make_unique<StickyKeysHandler>(ui::EF_ALTGR_DOWN);
ctrl_sticky_key_ =
std::make_unique<StickyKeysHandler>(ui::EF_CONTROL_DOWN);
mod3_sticky_key_ = std::make_unique<StickyKeysHandler>(ui::EF_MOD3_DOWN);
search_sticky_key_ =
std::make_unique<StickyKeysHandler>(ui::EF_COMMAND_DOWN);
overlay_.reset(new StickyKeysOverlay());
overlay_ = std::make_unique<StickyKeysOverlay>();
overlay_->SetModifierVisible(ui::EF_ALTGR_DOWN, altgr_enabled_);
overlay_->SetModifierVisible(ui::EF_MOD3_DOWN, mod3_enabled_);
} else if (overlay_) {
@ -342,7 +348,7 @@ bool StickyKeysHandler::HandleDisabledState(const ui::KeyEvent& event) {
preparing_to_enable_ = false;
scroll_delta_ = 0;
current_state_ = STICKY_KEY_STATE_ENABLED;
modifier_up_event_.reset(new ui::KeyEvent(event));
modifier_up_event_ = std::make_unique<ui::KeyEvent>(event);
return true;
}
return false;

@ -210,7 +210,7 @@ StickyKeysOverlay::StickyKeysOverlay() {
params.bounds = CalculateOverlayBounds();
params.parent = Shell::GetContainer(Shell::GetRootWindowForNewWindows(),
kShellWindowId_OverlayContainer);
overlay_widget_.reset(new views::Widget);
overlay_widget_ = std::make_unique<views::Widget>();
overlay_widget_->Init(std::move(params));
overlay_widget_->SetVisibilityChangedAnimationsEnabled(false);
overlay_view_ = overlay_widget_->SetContentsView(std::move(overlay_view));

@ -3,6 +3,9 @@
// found in the LICENSE file.
#include "ash/accessibility/switch_access/point_scan_controller.h"
#include <memory>
#include "ash/accessibility/switch_access/point_scan_layer.h"
#include "ash/accessibility/switch_access/point_scan_layer_animation_info.h"
#include "ui/display/display.h"
@ -32,9 +35,9 @@ void PointScanController::Start() {
void PointScanController::StartHorizontalRangeScan() {
state_ = PointScanState::kHorizontalRangeScanning;
horizontal_range_layer_.reset(
new PointScanLayer(this, PointScanLayer::Orientation::HORIZONTAL,
PointScanLayer::Type::RANGE));
horizontal_range_layer_ = std::make_unique<PointScanLayer>(
this, PointScanLayer::Orientation::HORIZONTAL,
PointScanLayer::Type::RANGE);
gfx::Rect layer_bounds = horizontal_range_layer_->bounds();
horizontal_range_layer_info_.offset = layer_bounds.x();
horizontal_range_layer_info_.offset_start = layer_bounds.x();
@ -46,9 +49,9 @@ void PointScanController::StartHorizontalRangeScan() {
void PointScanController::StartHorizontalLineScan() {
state_ = PointScanState::kHorizontalScanning;
horizontal_range_layer_->Pause();
horizontal_line_layer_.reset(
new PointScanLayer(this, PointScanLayer::Orientation::HORIZONTAL,
PointScanLayer::Type::LINE));
horizontal_line_layer_ = std::make_unique<PointScanLayer>(
this, PointScanLayer::Orientation::HORIZONTAL,
PointScanLayer::Type::LINE);
horizontal_line_layer_info_.offset = horizontal_range_layer_info_.offset;
horizontal_line_layer_info_.offset_start =
horizontal_range_layer_info_.offset;
@ -61,9 +64,8 @@ void PointScanController::StartVerticalRangeScan() {
state_ = PointScanState::kVerticalRangeScanning;
horizontal_line_layer_->Pause();
horizontal_range_layer_->SetOpacity(0);
vertical_range_layer_.reset(
new PointScanLayer(this, PointScanLayer::Orientation::VERTICAL,
PointScanLayer::Type::RANGE));
vertical_range_layer_ = std::make_unique<PointScanLayer>(
this, PointScanLayer::Orientation::VERTICAL, PointScanLayer::Type::RANGE);
gfx::Rect layer_bounds = vertical_range_layer_->bounds();
vertical_range_layer_info_.offset = layer_bounds.y();
vertical_range_layer_info_.offset = layer_bounds.y();
@ -75,8 +77,8 @@ void PointScanController::StartVerticalRangeScan() {
void PointScanController::StartVerticalLineScan() {
state_ = PointScanState::kVerticalScanning;
vertical_range_layer_->Pause();
vertical_line_layer_.reset(new PointScanLayer(
this, PointScanLayer::Orientation::VERTICAL, PointScanLayer::Type::LINE));
vertical_line_layer_ = std::make_unique<PointScanLayer>(
this, PointScanLayer::Orientation::VERTICAL, PointScanLayer::Type::LINE);
vertical_line_layer_info_.offset = vertical_range_layer_info_.offset;
vertical_line_layer_info_.offset_start = vertical_range_layer_info_.offset;
vertical_line_layer_info_.offset_bound =

@ -110,9 +110,8 @@ void AccessibilityFocusRingControllerImpl::SetCursorRing(
const gfx::Point& location) {
cursor_location_ = location;
if (!cursor_layer_) {
cursor_layer_.reset(new AccessibilityCursorRingLayer(
this, kCursorRingColorRed, kCursorRingColorGreen,
kCursorRingColorBlue));
cursor_layer_ = std::make_unique<AccessibilityCursorRingLayer>(
this, kCursorRingColorRed, kCursorRingColorGreen, kCursorRingColorBlue);
}
cursor_layer_->Set(location);
OnLayerChange(&cursor_animation_info_);
@ -127,8 +126,8 @@ void AccessibilityFocusRingControllerImpl::SetCaretRing(
caret_location_ = location;
if (!caret_layer_) {
caret_layer_.reset(new AccessibilityCursorRingLayer(
this, kCaretRingColorRed, kCaretRingColorGreen, kCaretRingColorBlue));
caret_layer_ = std::make_unique<AccessibilityCursorRingLayer>(
this, kCaretRingColorRed, kCaretRingColorGreen, kCaretRingColorBlue);
}
caret_layer_->Set(location);

@ -4,6 +4,8 @@
#include "ash/accessibility/ui/focus_ring_controller.h"
#include <memory>
#include "ash/accessibility/ui/focus_ring_layer.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/shell.h"
@ -84,7 +86,7 @@ void FocusRingController::UpdateFocusRing() {
// Update the focus ring layer.
if (!focus_ring_layer_)
focus_ring_layer_.reset(new FocusRingLayer(this));
focus_ring_layer_ = std::make_unique<FocusRingLayer>(this);
aura::Window* container = Shell::GetContainer(
root_window, kShellWindowId_AccessibilityBubbleContainer);
focus_ring_layer_->Set(container, view_bounds, /*stack_at_top=*/true);

@ -190,7 +190,7 @@ class AppListViewTest : public views::ViewsTestBase,
delegate_->SetIsTabletModeEnabled(is_tablet_mode);
view_ = new AppListView(delegate_.get());
view_->InitView(GetContext());
test_api_.reset(new AppsGridViewTestApi(apps_grid_view()));
test_api_ = std::make_unique<AppsGridViewTestApi>(apps_grid_view());
EXPECT_FALSE(view_->GetWidget()->IsVisible());
}
@ -453,7 +453,7 @@ class AppListViewFocusTest : public views::ViewsTestBase,
view_ = new AppListView(delegate_.get());
view_->InitView(GetContext());
Show();
test_api_.reset(new AppsGridViewTestApi(apps_grid_view()));
test_api_ = std::make_unique<AppsGridViewTestApi>(apps_grid_view());
suggestions_container_ = contents_view()
->apps_container_view()
->suggestion_chip_container_view_for_test();

@ -6,6 +6,8 @@
#include <stdint.h>
#include <memory>
#include "ash/components/audio/audio_device.h"
#include "ash/components/audio/audio_devices_pref_handler.h"
#include "ash/constants/ash_pref_names.h"
@ -94,7 +96,7 @@ class AudioDevicesPrefHandlerTest : public testing::TestWithParam<bool> {
~AudioDevicesPrefHandlerTest() override = default;
void SetUp() override {
pref_service_.reset(new TestingPrefServiceSimple());
pref_service_ = std::make_unique<TestingPrefServiceSimple>();
AudioDevicesPrefHandlerImpl::RegisterPrefs(pref_service_->registry());
// Set the preset pref values directly, to ensure it doesn't depend on pref

@ -310,7 +310,7 @@ class CrasAudioHandlerTest : public testing::TestWithParam<int> {
void SetUp() override {
fake_manager_ = std::make_unique<FakeMediaControllerManager>();
system_monitor_.AddDevicesChangedObserver(&system_monitor_observer_);
video_capture_manager_.reset(new FakeVideoCaptureManager);
video_capture_manager_ = std::make_unique<FakeVideoCaptureManager>();
}
void TearDown() override {
@ -351,7 +351,7 @@ class CrasAudioHandlerTest : public testing::TestWithParam<int> {
CrasAudioHandler::Initialize(fake_manager_->MakeRemote(),
audio_pref_handler_);
cras_audio_handler_ = CrasAudioHandler::Get();
test_observer_.reset(new TestObserver);
test_observer_ = std::make_unique<TestObserver>();
cras_audio_handler_->AddAudioObserver(test_observer_.get());
video_capture_manager_->AddObserver(cras_audio_handler_);
base::RunLoop().RunUntilIdle();
@ -385,7 +385,7 @@ class CrasAudioHandlerTest : public testing::TestWithParam<int> {
audio_pref_handler_);
cras_audio_handler_ = CrasAudioHandler::Get();
test_observer_.reset(new TestObserver);
test_observer_ = std::make_unique<TestObserver>();
cras_audio_handler_->AddAudioObserver(test_observer_.get());
base::RunLoop().RunUntilIdle();
}
@ -400,7 +400,7 @@ class CrasAudioHandlerTest : public testing::TestWithParam<int> {
CrasAudioHandler::Initialize(fake_manager_->MakeRemote(),
audio_pref_handler_);
cras_audio_handler_ = CrasAudioHandler::Get();
test_observer_.reset(new TestObserver);
test_observer_ = std::make_unique<TestObserver>();
cras_audio_handler_->AddAudioObserver(test_observer_.get());
base::RunLoop().RunUntilIdle();
}

@ -119,7 +119,8 @@ void ToggleShowDebugBorders() {
ui::Compositor* compositor = window->GetHost()->compositor();
cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState();
if (!value.get())
value.reset(new cc::DebugBorderTypes(state.show_debug_borders.flip()));
value = std::make_unique<cc::DebugBorderTypes>(
state.show_debug_borders.flip());
state.show_debug_borders = *value.get();
compositor->SetLayerTreeDebugState(state);
}
@ -132,7 +133,7 @@ void ToggleShowFpsCounter() {
ui::Compositor* compositor = window->GetHost()->compositor();
cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState();
if (!value.get())
value.reset(new bool(!state.show_fps_counter));
value = std::make_unique<bool>(!state.show_fps_counter);
state.show_fps_counter = *value.get();
compositor->SetLayerTreeDebugState(state);
}
@ -145,7 +146,7 @@ void ToggleShowPaintRects() {
ui::Compositor* compositor = window->GetHost()->compositor();
cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState();
if (!value.get())
value.reset(new bool(!state.show_paint_rects));
value = std::make_unique<bool>(!state.show_paint_rects);
state.show_paint_rects = *value.get();
compositor->SetLayerTreeDebugState(state);
}

@ -139,7 +139,7 @@ void DisplayAnimator::StartFadeOutAnimation(base::OnceClosure callback) {
// In case that OnDisplayModeChanged() isn't called or its animator is
// canceled due to some unknown errors, we set a timer to clear these
// hiding layers.
timer_.reset(new base::OneShotTimer());
timer_ = std::make_unique<base::OneShotTimer>();
timer_->Start(FROM_HERE,
base::TimeDelta::FromSeconds(kFadingTimeoutDurationInSeconds),
this, &DisplayAnimator::ClearHidingLayers);

@ -105,7 +105,7 @@ class QuirksManagerDelegateTestImpl : public quirks::QuirksManager::Delegate {
class DisplayColorManagerTest : public testing::Test {
public:
void SetUp() override {
log_.reset(new display::test::ActionLogger());
log_ = std::make_unique<display::test::ActionLogger>();
native_display_delegate_ =
new display::test::TestNativeDisplayDelegate(log_.get());
@ -121,8 +121,8 @@ class DisplayColorManagerTest : public testing::Test {
color_path_ = color_path_.Append(FILE_PATH_LITERAL("ash"))
.Append(FILE_PATH_LITERAL("display"))
.Append(FILE_PATH_LITERAL("test_data"));
path_override_.reset(new base::ScopedPathOverride(
chromeos::DIR_DEVICE_DISPLAY_PROFILES, color_path_));
path_override_ = std::make_unique<base::ScopedPathOverride>(
chromeos::DIR_DEVICE_DISPLAY_PROFILES, color_path_);
quirks::QuirksManager::Initialize(
std::unique_ptr<quirks::QuirksManager::Delegate>(
@ -479,8 +479,8 @@ TEST_F(DisplayColorManagerTest, VpdCalibration) {
int64_t product_id = 0x0; // No matching product ID, so no Quirks ICC.
const base::FilePath& icc_path = color_path_.Append("06af5c10.icc");
std::unique_ptr<base::ScopedPathOverride> vpd_dir_override;
vpd_dir_override.reset(
new base::ScopedPathOverride(chromeos::DIR_DEVICE_DISPLAY_PROFILES_VPD));
vpd_dir_override = std::make_unique<base::ScopedPathOverride>(
chromeos::DIR_DEVICE_DISPLAY_PROFILES_VPD);
base::FilePath vpd_dir;
EXPECT_TRUE(base::PathService::Get(chromeos::DIR_DEVICE_DISPLAY_PROFILES_VPD,
&vpd_dir));
@ -517,8 +517,8 @@ TEST_F(DisplayColorManagerTest, VpdCalibrationWithQuirks) {
int64_t product_id = 0x06af5c10;
const base::FilePath& icc_path = color_path_.Append("4c834a42.icc");
std::unique_ptr<base::ScopedPathOverride> vpd_dir_override;
vpd_dir_override.reset(
new base::ScopedPathOverride(chromeos::DIR_DEVICE_DISPLAY_PROFILES_VPD));
vpd_dir_override = std::make_unique<base::ScopedPathOverride>(
chromeos::DIR_DEVICE_DISPLAY_PROFILES_VPD);
base::FilePath vpd_dir;
EXPECT_TRUE(base::PathService::Get(chromeos::DIR_DEVICE_DISPLAY_PROFILES_VPD,
&vpd_dir));

@ -4,6 +4,8 @@
#include "ash/display/display_configuration_controller.h"
#include <memory>
#include "ash/display/display_animator.h"
#include "ash/display/display_util.h"
#include "ash/display/window_tree_host_manager.h"
@ -87,9 +89,9 @@ DisplayConfigurationController::DisplayConfigurationController(
window_tree_host_manager_(window_tree_host_manager) {
window_tree_host_manager_->AddObserver(this);
if (chromeos::IsRunningAsSystemCompositor())
limiter_.reset(new DisplayChangeLimiter);
limiter_ = std::make_unique<DisplayChangeLimiter>();
if (!g_disable_animator_for_test)
display_animator_.reset(new DisplayAnimator());
display_animator_ = std::make_unique<DisplayAnimator>();
}
DisplayConfigurationController::~DisplayConfigurationController() {
@ -206,7 +208,7 @@ void DisplayConfigurationController::SetAnimatorForTest(bool enable) {
if (display_animator_ && !enable)
display_animator_.reset();
else if (!display_animator_ && enable)
display_animator_.reset(new DisplayAnimator());
display_animator_ = std::make_unique<DisplayAnimator>();
}
// Private

@ -169,8 +169,8 @@ void ExtendedMouseWarpController::AddWarpRegion(
std::unique_ptr<WarpRegion> warp_region,
bool has_drag_source) {
if (has_drag_source) {
warp_region->shared_display_edge_indicator_.reset(
new SharedDisplayEdgeIndicator);
warp_region->shared_display_edge_indicator_ =
std::make_unique<SharedDisplayEdgeIndicator>();
warp_region->shared_display_edge_indicator_->Show(
warp_region->a_indicator_bounds_, warp_region->b_indicator_bounds_);
}

@ -7,6 +7,7 @@
#include <stdint.h>
#include <limits>
#include <memory>
#include "ash/display/window_tree_host_manager.h"
#include "ash/public/cpp/shell_window_ids.h"
@ -195,7 +196,7 @@ void OverscanCalibrator::UpdateUILayer() {
aura::Window* root = Shell::GetRootWindowForDisplayId(display_.id());
ui::Layer* parent_layer =
Shell::GetContainer(root, kShellWindowId_OverlayContainer)->layer();
calibration_layer_.reset(new ui::Layer());
calibration_layer_ = std::make_unique<ui::Layer>();
calibration_layer_->SetOpacity(0.5f);
calibration_layer_->SetBounds(parent_layer->bounds());
calibration_layer_->set_delegate(this);

@ -4,6 +4,8 @@
#include "ash/display/touch_calibrator_view.h"
#include <memory>
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/shell.h"
@ -181,7 +183,7 @@ CircularThrobberView::CircularThrobberView(int width,
outer_circle_flags_.setAntiAlias(true);
outer_circle_flags_.setStyle(cc::PaintFlags::kFill_Style);
animation_.reset(new gfx::ThrobAnimation(this));
animation_ = std::make_unique<gfx::ThrobAnimation>(this);
animation_->SetThrobDuration(animation_duration);
animation_->StartThrobbing(-1);

@ -414,10 +414,10 @@ void DragDropController::OnGestureEvent(ui::GestureEvent* event) {
// drag drop is still in progress. The drag drop ends only when the nested
// message loop ends. Due to this stupidity, we have to defer forwarding
// the long tap.
pending_long_tap_.reset(new ui::GestureEvent(
pending_long_tap_ = std::make_unique<ui::GestureEvent>(
*event,
static_cast<aura::Window*>(drag_drop_tracker_->capture_window()),
static_cast<aura::Window*>(drag_source_window_)));
static_cast<aura::Window*>(drag_source_window_));
DoDragCancel(kTouchCancelAnimationDuration);
break;
default:

@ -4,6 +4,7 @@
#include "ash/events/select_to_speak_event_handler.h"
#include <memory>
#include <set>
#include "ash/accessibility/accessibility_controller_impl.h"
@ -42,13 +43,13 @@ class EventCapturer : public ui::EventHandler {
private:
void OnMouseEvent(ui::MouseEvent* event) override {
last_mouse_event_.reset(new ui::MouseEvent(*event));
last_mouse_event_ = std::make_unique<ui::MouseEvent>(*event);
}
void OnKeyEvent(ui::KeyEvent* event) override {
last_key_event_.reset(new ui::KeyEvent(*event));
last_key_event_ = std::make_unique<ui::KeyEvent>(*event);
}
void OnTouchEvent(ui::TouchEvent* event) override {
last_touch_event_.reset(new ui::TouchEvent(*event));
last_touch_event_ = std::make_unique<ui::TouchEvent>(*event);
}
std::unique_ptr<ui::KeyEvent> last_key_event_;

@ -63,7 +63,7 @@ class FocusCyclerTest : public AshTestBase {
void SetUp() override {
AshTestBase::SetUp();
focus_cycler_.reset(new FocusCycler());
focus_cycler_ = std::make_unique<FocusCycler>();
}
void TearDown() override {
@ -277,7 +277,8 @@ TEST_F(FocusCyclerTest, CycleFocusThroughWindowWithPanes) {
std::unique_ptr<PanedWidgetDelegate> test_widget_delegate;
std::unique_ptr<views::Widget> browser_widget(new views::Widget);
test_widget_delegate.reset(new PanedWidgetDelegate(browser_widget.get()));
test_widget_delegate =
std::make_unique<PanedWidgetDelegate>(browser_widget.get());
views::Widget::InitParams widget_params(
views::Widget::InitParams::TYPE_WINDOW);
widget_params.delegate = test_widget_delegate.get();

@ -4,6 +4,8 @@
#include "ash/keyboard/ui/container_floating_behavior.h"
#include <memory>
#include "ash/keyboard/ui/display_util.h"
#include "ash/keyboard/ui/drag_descriptor.h"
#include "base/optional.h"
@ -228,7 +230,7 @@ bool ContainerFloatingBehavior::HandlePointerEvent(
// Mouse events are limited to just the left mouse button.
drag_descriptor_.reset();
} else if (!drag_descriptor_) {
drag_descriptor_.reset(new DragDescriptor{
drag_descriptor_ = std::make_unique<DragDescriptor>(DragDescriptor{
keyboard_bounds_in_screen.origin(), kb_offset, pointer_id});
}
break;

@ -75,8 +75,8 @@ DesktopTaskSwitchMetricRecorderTest::~DesktopTaskSwitchMetricRecorderTest() =
void DesktopTaskSwitchMetricRecorderTest::SetUp() {
AshTestBase::SetUp();
metrics_recorder_.reset(new DesktopTaskSwitchMetricRecorder);
user_action_tester_.reset(new base::UserActionTester);
metrics_recorder_ = std::make_unique<DesktopTaskSwitchMetricRecorder>();
user_action_tester_ = std::make_unique<base::UserActionTester>();
}
void DesktopTaskSwitchMetricRecorderTest::TearDown() {
@ -287,7 +287,7 @@ DesktopTaskSwitchMetricRecorderWithShellIntegrationTest::
void DesktopTaskSwitchMetricRecorderWithShellIntegrationTest::SetUp() {
AshTestBase::SetUp();
user_action_tester_.reset(new base::UserActionTester);
user_action_tester_ = std::make_unique<base::UserActionTester>();
}
void DesktopTaskSwitchMetricRecorderWithShellIntegrationTest::TearDown() {

@ -44,7 +44,7 @@ class LoginMetricsRecorderTest : public LoginTestBase {
// LoginTestBase:
void SetUp() override {
LoginTestBase::SetUp();
histogram_tester_.reset(new base::HistogramTester());
histogram_tester_ = std::make_unique<base::HistogramTester>();
}
protected:

@ -4,6 +4,8 @@
#include "ash/metrics/pointer_metrics_recorder.h"
#include <memory>
#include "ash/display/screen_orientation_controller_test_api.h"
#include "ash/public/cpp/app_types.h"
#include "ash/public/cpp/shell_window_ids.h"
@ -57,8 +59,8 @@ PointerMetricsRecorderTest::~PointerMetricsRecorderTest() = default;
void PointerMetricsRecorderTest::SetUp() {
AshTestBase::SetUp();
pointer_metrics_recorder_.reset(new PointerMetricsRecorder());
histogram_tester_.reset(new base::HistogramTester());
pointer_metrics_recorder_ = std::make_unique<PointerMetricsRecorder>();
histogram_tester_ = std::make_unique<base::HistogramTester>();
widget_ = CreateTestWidget();
}

@ -4,6 +4,8 @@
#include "ash/metrics/task_switch_metrics_recorder.h"
#include <memory>
#include "base/test/metrics/histogram_tester.h"
#include "testing/gtest/include/gtest/gtest.h"
@ -46,8 +48,8 @@ void TaskSwitchMetricsRecorderTest::OnTaskSwitch(
void TaskSwitchMetricsRecorderTest::SetUp() {
testing::Test::SetUp();
histogram_tester_.reset(new base::HistogramTester());
task_switch_metrics_recorder_.reset(new TaskSwitchMetricsRecorder());
histogram_tester_ = std::make_unique<base::HistogramTester>();
task_switch_metrics_recorder_ = std::make_unique<TaskSwitchMetricsRecorder>();
}
void TaskSwitchMetricsRecorderTest::TearDown() {

@ -4,6 +4,7 @@
#include "ash/metrics/task_switch_time_tracker.h"
#include <memory>
#include <string>
#include "ash/metrics/task_switch_time_tracker_test_api.h"
@ -53,9 +54,9 @@ TaskSwitchTimeTrackerTest::~TaskSwitchTimeTrackerTest() = default;
void TaskSwitchTimeTrackerTest::SetUp() {
testing::Test::SetUp();
histogram_tester_.reset(new base::HistogramTester());
time_tracker_test_api_.reset(
new TaskSwitchTimeTrackerTestAPI(kHistogramName));
histogram_tester_ = std::make_unique<base::HistogramTester>();
time_tracker_test_api_ =
std::make_unique<TaskSwitchTimeTrackerTestAPI>(kHistogramName);
// The TaskSwitchTimeTracker interprets a value of base::TimeTicks() as if the
// |last_action_time_| has not been set.
time_tracker_test_api_->Advance(base::TimeDelta::FromMilliseconds(1));

@ -452,8 +452,8 @@ void UserMetricsRecorder::OnShellInitialized() {
// Lazy creation of the DesktopTaskSwitchMetricRecorder because it accesses
// Shell::Get() which is not available when |this| is instantiated.
if (!desktop_task_switch_metric_recorder_) {
desktop_task_switch_metric_recorder_.reset(
new DesktopTaskSwitchMetricRecorder());
desktop_task_switch_metric_recorder_ =
std::make_unique<DesktopTaskSwitchMetricRecorder>();
}
pointer_metrics_recorder_ = std::make_unique<PointerMetricsRecorder>();
}

@ -4,6 +4,8 @@
#include "ash/multi_user/user_switch_animator.h"
#include <memory>
#include "ash/multi_user/multi_user_window_manager_impl.h"
#include "ash/public/cpp/multi_user_window_manager_delegate.h"
#include "ash/shell.h"
@ -98,7 +100,7 @@ UserSwitchAnimator::UserSwitchAnimator(MultiUserWindowManagerImpl* owner,
if (animation_speed_.is_zero()) {
FinalizeAnimation();
} else {
user_changed_animation_timer_.reset(new base::RepeatingTimer());
user_changed_animation_timer_ = std::make_unique<base::RepeatingTimer>();
user_changed_animation_timer_->Start(
FROM_HERE, animation_speed_,
base::BindRepeating(&UserSwitchAnimator::AdvanceUserTransitionAnimation,

@ -4,6 +4,8 @@
#include "ash/public/cpp/external_arc/message_center/arc_notification_content_view.h"
#include <memory>
#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/external_arc/message_center/arc_notification_surface.h"
#include "ash/public/cpp/external_arc/message_center/arc_notification_view.h"
@ -394,7 +396,7 @@ void ArcNotificationContentView::MaybeCreateFloatingControlButtons() {
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.parent = surface_->GetWindow();
floating_control_buttons_widget_.reset(new views::Widget);
floating_control_buttons_widget_ = std::make_unique<views::Widget>();
floating_control_buttons_widget_->Init(std::move(params));
floating_control_buttons_widget_->SetContentsView(&control_buttons_view_);
floating_control_buttons_widget_->GetNativeWindow()->AddPreTargetHandler(
@ -497,7 +499,7 @@ void ArcNotificationContentView::AttachSurface() {
surface_->Attach(this);
// Creates slide helper after this view is added to its parent.
slide_helper_.reset(new SlideHelper(this));
slide_helper_ = std::make_unique<SlideHelper>(this);
// Invokes Update() in case surface is attached during a slide.
slide_helper_->Update(slide_in_progress_);

@ -4,6 +4,7 @@
#include "ash/public/cpp/shelf_model.h"
#include <memory>
#include <set>
#include <string>
@ -89,8 +90,8 @@ class ShelfModelTest : public testing::Test {
~ShelfModelTest() override = default;
void SetUp() override {
model_.reset(new ShelfModel);
observer_.reset(new TestShelfModelObserver);
model_ = std::make_unique<ShelfModel>();
observer_ = std::make_unique<TestShelfModelObserver>();
model_->AddObserver(observer_.get());
}

@ -875,10 +875,10 @@ RootWindowController::RootWindowController(AshWindowTreeHost* ash_host)
aura::Window* root_window = GetRootWindow();
GetRootWindowSettings(root_window)->controller = this;
stacking_controller_.reset(new StackingController);
stacking_controller_ = std::make_unique<StackingController>();
aura::client::SetWindowParentingClient(root_window,
stacking_controller_.get());
capture_client_.reset(new ::wm::ScopedCaptureClient(root_window));
capture_client_ = std::make_unique<::wm::ScopedCaptureClient>(root_window);
}
void RootWindowController::Init(RootWindowType root_window_type) {
@ -1255,8 +1255,8 @@ void RootWindowController::CreateSystemWallpaper(
chromeos::switches::kFirstExecAfterBoot);
if (is_boot_splash_screen)
color = kChromeOsBootColor;
system_wallpaper_.reset(
new SystemWallpaperController(GetRootWindow(), color));
system_wallpaper_ =
std::make_unique<SystemWallpaperController>(GetRootWindow(), color);
}
AccessibilityPanelLayoutManager*

@ -37,8 +37,8 @@ ScreenRotationAnimation::ScreenRotationAnimation(ui::Layer* layer,
// Use the target transform/bounds in case the layer is already animating.
gfx::Transform current_transform = layer->GetTargetTransform();
interpolated_transform_.reset(
new ui::InterpolatedConstantTransform(current_transform));
interpolated_transform_ =
std::make_unique<ui::InterpolatedConstantTransform>(current_transform);
interpolated_transform_->SetChild(std::move(rotation));
}

@ -36,8 +36,9 @@ class ScreenRotationAnimationTest : public AshTestBase {
void ScreenRotationAnimationTest::SetUp() {
AshTestBase::SetUp();
non_zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION));
non_zero_duration_mode_ =
std::make_unique<ui::ScopedAnimationDurationScaleMode>(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
}
TEST_F(ScreenRotationAnimationTest, LayerTransformGetsSetToTargetWhenAborted) {

@ -276,7 +276,7 @@ void ScreenRotationAnimatorSmoothAnimationTest::SetScreenRotationAnimator(
}
void ScreenRotationAnimatorSmoothAnimationTest::WaitForCopyCallback() {
run_loop_.reset(new base::RunLoop());
run_loop_ = std::make_unique<base::RunLoop>();
run_loop_->Run();
}

@ -44,8 +44,8 @@ WindowRotation::~WindowRotation() = default;
void WindowRotation::InitTransform(ui::Layer* layer) {
// No rotation required, use the identity transform.
if (degrees_ == 0) {
interpolated_transform_.reset(
new ui::InterpolatedConstantTransform(gfx::Transform()));
interpolated_transform_ =
std::make_unique<ui::InterpolatedConstantTransform>(gfx::Transform());
return;
}
@ -95,8 +95,8 @@ void WindowRotation::InitTransform(ui::Layer* layer) {
std::make_unique<ui::InterpolatedScale>(1.0f, 1.0f / scale_factor, 0.5f,
1.0f);
interpolated_transform_.reset(
new ui::InterpolatedConstantTransform(current_transform));
interpolated_transform_ =
std::make_unique<ui::InterpolatedConstantTransform>(current_transform);
scale_up->SetChild(std::move(scale_down));
translation->SetChild(std::move(scale_up));

@ -420,8 +420,8 @@ class KioskAppsButton : public views::MenuButton,
void DisplayMenu() {
const gfx::Point point = GetMenuPosition();
const gfx::Point origin(point.x() - width(), point.y() - height());
menu_runner_.reset(
new views::MenuRunner(this, views::MenuRunner::HAS_MNEMONICS));
menu_runner_ = std::make_unique<views::MenuRunner>(
this, views::MenuRunner::HAS_MNEMONICS);
menu_runner_->RunMenuAt(GetWidget()->GetTopLevelWidget(),
button_controller(), gfx::Rect(origin, gfx::Size()),
views::MenuAnchorPosition::kTopLeft,

@ -408,7 +408,7 @@ void Shelf::CreateShelfWidget(aura::Window* root) {
DCHECK(!shelf_widget_);
aura::Window* shelf_container =
root->GetChildById(kShellWindowId_ShelfContainer);
shelf_widget_.reset(new ShelfWidget(this));
shelf_widget_ = std::make_unique<ShelfWidget>(this);
DCHECK(!shelf_layout_manager_);
shelf_layout_manager_ = shelf_widget_->shelf_layout_manager();

@ -144,7 +144,7 @@ void ShelfBackgroundAnimatorTest::SetUp() {
GetPrimaryShelf()->shelf_widget()->background_animator_for_testing();
animator_->AddObserver(&observer_);
test_api_.reset(new ShelfBackgroundAnimatorTestApi(animator_));
test_api_ = std::make_unique<ShelfBackgroundAnimatorTestApi>(animator_);
}
void ShelfBackgroundAnimatorTest::PaintBackground(

@ -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 <utility>
#include "ash/public/cpp/shelf_model.h"
@ -34,7 +35,7 @@ class ShelfTest : public AshTestBase {
shelf_view_ = GetPrimaryShelf()->GetShelfViewForTesting();
shelf_model_ = shelf_view_->model();
test_.reset(new ShelfViewTestAPI(shelf_view_));
test_ = std::make_unique<ShelfViewTestAPI>(shelf_view_);
}
ShelfView* shelf_view() { return shelf_view_; }

@ -733,8 +733,8 @@ void ShelfView::ButtonPressed(views::Button* sender,
// Slow down activation animations if Control key is pressed.
std::unique_ptr<ui::ScopedAnimationDurationScaleMode> slowing_animations;
if (event.IsControlDown()) {
slowing_animations.reset(new ui::ScopedAnimationDurationScaleMode(
ui::ScopedAnimationDurationScaleMode::SLOW_DURATION));
slowing_animations = std::make_unique<ui::ScopedAnimationDurationScaleMode>(
ui::ScopedAnimationDurationScaleMode::SLOW_DURATION);
}
// Collect usage statistics before we decide what to do with the click.

@ -189,9 +189,9 @@ class ShelfObserverIconTest : public AshTestBase {
void SetUp() override {
AshTestBase::SetUp();
observer_.reset(new TestShelfObserver(GetPrimaryShelf()));
shelf_view_test_.reset(
new ShelfViewTestAPI(GetPrimaryShelf()->GetShelfViewForTesting()));
observer_ = std::make_unique<TestShelfObserver>(GetPrimaryShelf());
shelf_view_test_ = std::make_unique<ShelfViewTestAPI>(
GetPrimaryShelf()->GetShelfViewForTesting());
shelf_view_test_->SetAnimationDuration(
base::TimeDelta::FromMilliseconds(1));
}
@ -351,7 +351,7 @@ class ShelfViewTest : public AshTestBase {
.width(),
500);
test_api_.reset(new ShelfViewTestAPI(shelf_view_));
test_api_ = std::make_unique<ShelfViewTestAPI>(shelf_view_);
test_api_->SetAnimationDuration(base::TimeDelta::FromMilliseconds(1));
// Add a browser shortcut shelf item, as chrome does, for testing.

@ -4,6 +4,7 @@
#include "ash/shelf/shelf_widget.h"
#include <memory>
#include <utility>
#include "ash/animation/animation_change_type.h"
@ -641,7 +642,8 @@ int ShelfWidget::GetBackgroundAlphaValue(
void ShelfWidget::RegisterHotseatWidget(HotseatWidget* hotseat_widget) {
// Show a context menu for right clicks anywhere on the shelf widget.
delegate_view_->set_context_menu_controller(hotseat_widget->GetShelfView());
hotseat_transition_animator_.reset(new HotseatTransitionAnimator(this));
hotseat_transition_animator_ =
std::make_unique<HotseatTransitionAnimator>(this);
hotseat_transition_animator_->AddObserver(delegate_view_);
shelf_->hotseat_widget()->OnHotseatTransitionAnimatorCreated(
hotseat_transition_animator());

@ -965,7 +965,7 @@ void Shell::Init(
peripheral_battery_notifier_ = std::make_unique<PeripheralBatteryNotifier>(
peripheral_battery_listener_.get());
power_event_observer_.reset(new PowerEventObserver());
power_event_observer_ = std::make_unique<PowerEventObserver>();
window_cycle_controller_ = std::make_unique<WindowCycleController>();
if (features::IsCaptureModeEnabled()) {
@ -1079,9 +1079,9 @@ void Shell::Init(
// ui::UserActivityDetector passes events to observers, so let them get
// rewritten first.
user_activity_detector_.reset(new ui::UserActivityDetector);
user_activity_detector_ = std::make_unique<ui::UserActivityDetector>();
overlay_filter_.reset(new OverlayEventFilter);
overlay_filter_ = std::make_unique<OverlayEventFilter>();
AddPreTargetHandler(overlay_filter_.get());
control_v_histogram_recorder_ = std::make_unique<ControlVHistogramRecorder>();
@ -1091,7 +1091,8 @@ void Shell::Init(
std::make_unique<PreTargetAcceleratorHandler>());
AddPreTargetHandler(accelerator_filter_.get());
event_transformation_handler_.reset(new EventTransformationHandler);
event_transformation_handler_ =
std::make_unique<EventTransformationHandler>();
AddPreTargetHandler(event_transformation_handler_.get());
back_gesture_event_handler_ = std::make_unique<BackGestureEventHandler>();
@ -1103,7 +1104,7 @@ void Shell::Init(
system_gesture_filter_ = std::make_unique<SystemGestureEventFilter>();
AddPreTargetHandler(system_gesture_filter_.get());
sticky_keys_controller_.reset(new StickyKeysController);
sticky_keys_controller_ = std::make_unique<StickyKeysController>();
screen_pinning_controller_ = std::make_unique<ScreenPinningController>();
power_prefs_ = std::make_unique<PowerPrefs>(
@ -1138,11 +1139,12 @@ void Shell::Init(
// Create Controllers that may need root window.
// TODO(oshima): Move as many controllers before creating
// RootWindowController as possible.
visibility_controller_.reset(new AshVisibilityController);
visibility_controller_ = std::make_unique<AshVisibilityController>();
laser_pointer_controller_.reset(new LaserPointerController());
partial_magnification_controller_.reset(new PartialMagnificationController());
highlighter_controller_.reset(new HighlighterController());
laser_pointer_controller_ = std::make_unique<LaserPointerController>();
partial_magnification_controller_ =
std::make_unique<PartialMagnificationController>();
highlighter_controller_ = std::make_unique<HighlighterController>();
magnification_controller_ = std::make_unique<MagnificationController>();
mru_window_tracker_ = std::make_unique<MruWindowTracker>();
@ -1168,23 +1170,23 @@ void Shell::Init(
autoclick_controller_ = std::make_unique<AutoclickController>();
high_contrast_controller_.reset(new HighContrastController);
high_contrast_controller_ = std::make_unique<HighContrastController>();
docked_magnifier_controller_ =
std::make_unique<DockedMagnifierControllerImpl>();
video_detector_ = std::make_unique<VideoDetector>();
tooltip_controller_.reset(new views::corewm::TooltipController(
std::unique_ptr<views::corewm::Tooltip>(new views::corewm::TooltipAura)));
tooltip_controller_ = std::make_unique<views::corewm::TooltipController>(
std::make_unique<views::corewm::TooltipAura>());
AddPreTargetHandler(tooltip_controller_.get());
modality_filter_.reset(new SystemModalContainerEventFilter(this));
modality_filter_ = std::make_unique<SystemModalContainerEventFilter>(this);
AddPreTargetHandler(modality_filter_.get());
event_client_.reset(new EventClientImpl);
event_client_ = std::make_unique<EventClientImpl>();
resize_shadow_controller_.reset(new ResizeShadowController());
resize_shadow_controller_ = std::make_unique<ResizeShadowController>();
shadow_controller_ = std::make_unique<::wm::ShadowController>(
focus_controller_.get(), std::make_unique<WmShadowControllerDelegate>(),
env);
@ -1240,8 +1242,8 @@ void Shell::Init(
user_activity_notifier_ =
std::make_unique<ui::UserActivityPowerManagerNotifier>(
user_activity_detector_.get(), std::move(fingerprint));
video_activity_notifier_.reset(
new VideoActivityNotifier(video_detector_.get()));
video_activity_notifier_ =
std::make_unique<VideoActivityNotifier>(video_detector_.get());
bluetooth_notification_controller_ =
std::make_unique<BluetoothNotificationController>(
message_center::MessageCenter::Get());
@ -1250,8 +1252,8 @@ void Shell::Init(
cros_display_config_ = std::make_unique<CrosDisplayConfig>();
screen_layout_observer_.reset(new ScreenLayoutObserver());
sms_observer_.reset(new SmsObserver());
screen_layout_observer_ = std::make_unique<ScreenLayoutObserver>();
sms_observer_ = std::make_unique<SmsObserver>();
snap_controller_ = std::make_unique<SnapControllerImpl>();
key_accessibility_enabler_ = std::make_unique<KeyAccessibilityEnabler>();

@ -4,6 +4,7 @@
#include "ash/system/message_center/message_center_ui_controller.h"
#include <memory>
#include <utility>
#include "base/macros.h"
@ -69,9 +70,10 @@ class MessageCenterUiControllerTest : public testing::Test {
void SetUp() override {
message_center::MessageCenter::Initialize();
delegate_.reset(new MockDelegate);
delegate_ = std::make_unique<MockDelegate>();
message_center_ = message_center::MessageCenter::Get();
ui_controller_.reset(new MessageCenterUiController(delegate_.get()));
ui_controller_ =
std::make_unique<MessageCenterUiController>(delegate_.get());
}
void TearDown() override {

@ -33,8 +33,8 @@ class SessionStateNotificationBlockerTest
// tests::AshTestBase overrides:
void SetUp() override {
NoSessionAshTestBase::SetUp();
blocker_.reset(new SessionStateNotificationBlocker(
message_center::MessageCenter::Get()));
blocker_ = std::make_unique<SessionStateNotificationBlocker>(
message_center::MessageCenter::Get());
blocker_->AddObserver(this);
}

@ -4,6 +4,7 @@
#include "ash/system/power/dual_role_notification.h"
#include <memory>
#include <set>
#include "ash/public/cpp/notification_utils.h"
@ -63,13 +64,13 @@ void DualRoleNotification::Update() {
}
if (source.id == current_power_source_id) {
new_source.reset(new PowerStatus::PowerSource(source));
new_source = std::make_unique<PowerStatus::PowerSource>(source);
continue;
}
num_sinks_found++;
// The notification only shows the sink port if it is the only sink.
if (num_sinks_found == 1)
new_sink.reset(new PowerStatus::PowerSource(source));
new_sink = std::make_unique<PowerStatus::PowerSource>(source);
else
new_sink.reset();
}

@ -33,7 +33,7 @@ class PowerEventObserverTest : public AshTestBase {
// AshTestBase:
void SetUp() override {
AshTestBase::SetUp();
observer_.reset(new PowerEventObserver());
observer_ = std::make_unique<PowerEventObserver>();
}
void TearDown() override {

@ -4,6 +4,8 @@
#include "ash/system/power/power_notification_controller.h"
#include <memory>
#include "ash/public/cpp/ash_switches.h"
#include "ash/public/cpp/notification_utils.h"
#include "ash/resources/vector_icons/vector_icons.h"
@ -111,8 +113,8 @@ void PowerNotificationController::OnPowerStatusChanged() {
// one. Otherwise we might update a "low battery" notification to "critical"
// without it being shown again.
battery_notification_.reset();
battery_notification_.reset(
new BatteryNotification(message_center_, notification_state_));
battery_notification_ = std::make_unique<BatteryNotification>(
message_center_, notification_state_);
} else if (notification_state_ == NOTIFICATION_NONE) {
battery_notification_.reset();
} else if (battery_notification_.get()) {
@ -180,7 +182,8 @@ void PowerNotificationController::MaybeShowDualRoleNotification() {
}
if (!dual_role_notification_)
dual_role_notification_.reset(new DualRoleNotification(message_center_));
dual_role_notification_ =
std::make_unique<DualRoleNotification>(message_center_);
dual_role_notification_->Update();
}

@ -81,8 +81,9 @@ class PowerNotificationControllerTest : public AshTestBase {
// AshTestBase:
void SetUp() override {
AshTestBase::SetUp();
message_center_.reset(new MockMessageCenter());
controller_.reset(new PowerNotificationController(message_center_.get()));
message_center_ = std::make_unique<MockMessageCenter>();
controller_ =
std::make_unique<PowerNotificationController>(message_center_.get());
}
void TearDown() override {

@ -44,7 +44,7 @@ class PowerStatusTest : public AshTestBase {
void SetUp() override {
AshTestBase::SetUp();
power_status_ = PowerStatus::Get();
test_observer_.reset(new TestObserver);
test_observer_ = std::make_unique<TestObserver>();
power_status_->AddObserver(test_observer_.get());
}

@ -23,7 +23,7 @@ class VideoActivityNotifierTest : public AshTestBase {
power_client_ = static_cast<chromeos::FakePowerManagerClient*>(
chromeos::PowerManagerClient::Get());
detector_ = std::make_unique<VideoDetector>();
notifier_.reset(new VideoActivityNotifier(detector_.get()));
notifier_ = std::make_unique<VideoActivityNotifier>(detector_.get());
}
void TearDown() override {

@ -4,6 +4,8 @@
#include "ash/system/status_area_widget.h"
#include <memory>
#include "ash/focus_cycler.h"
#include "ash/keyboard/ui/keyboard_ui_controller.h"
#include "ash/keyboard/ui/keyboard_util.h"
@ -103,7 +105,7 @@ class StatusAreaWidgetFocusTest : public AshTestBase {
// AshTestBase:
void SetUp() override {
AshTestBase::SetUp();
test_observer_.reset(new SystemTrayFocusTestObserver);
test_observer_ = std::make_unique<SystemTrayFocusTestObserver>();
Shell::Get()->system_tray_notifier()->AddSystemTrayObserver(
test_observer_.get());
}

@ -4,6 +4,8 @@
#include "ash/system/time/time_view.h"
#include <memory>
#include "ash/shell.h"
#include "ash/system/model/system_tray_model.h"
#include "ash/test/ash_test_base.h"
@ -37,8 +39,8 @@ class TimeViewTest : public AshTestBase {
// Creates a time view with horizontal or vertical |clock_layout|.
void CreateTimeView(TimeView::ClockLayout clock_layout) {
time_view_.reset(
new TimeView(clock_layout, Shell::Get()->system_tray_model()->clock()));
time_view_ = std::make_unique<TimeView>(
clock_layout, Shell::Get()->system_tray_model()->clock());
}
private:

@ -84,7 +84,7 @@ class TooltipControllerTest : public AshTestBase {
void SetUp() override {
AshTestBase::SetUp();
helper_.reset(new TooltipControllerTestHelper(GetController()));
helper_ = std::make_unique<TooltipControllerTestHelper>(GetController());
}
protected:

@ -4,6 +4,8 @@
#include "ash/touch/touch_hud_renderer.h"
#include <memory>
#include "base/scoped_observation.h"
#include "base/time/time.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
@ -52,8 +54,8 @@ class TouchPointView : public views::View,
void FadeOut(std::unique_ptr<TouchPointView> self) {
DCHECK_EQ(this, self.get());
owned_self_reference_ = std::move(self);
fadeout_.reset(
new gfx::LinearAnimation(kFadeoutDuration, kFadeoutFrameRate, this));
fadeout_ = std::make_unique<gfx::LinearAnimation>(kFadeoutDuration,
kFadeoutFrameRate, this);
fadeout_->Start();
}

@ -6,6 +6,7 @@
#include <cmath>
#include <cstdlib>
#include <memory>
#include "ash/constants/ash_features.h"
#include "ash/constants/ash_switches.h"
@ -1010,7 +1011,7 @@ TEST_F(WallpaperControllerTest, SetOnlineWallpaper) {
// Verify that the attempt to set an online wallpaper without providing image
// data fails.
run_loop.reset(new base::RunLoop());
run_loop = std::make_unique<base::RunLoop>();
ClearWallpaperCount();
controller_->SetOnlineWallpaperIfExists(
account_id_1, kDummyUrl, layout, false /*preview_mode=*/,
@ -1053,7 +1054,7 @@ TEST_F(WallpaperControllerTest, SetOnlineWallpaper) {
// it succeeds this time because |SetOnlineWallpaperFromData| has saved the
// file.
ClearWallpaperCount();
run_loop.reset(new base::RunLoop());
run_loop = std::make_unique<base::RunLoop>();
controller_->SetOnlineWallpaperIfExists(
account_id_1, kDummyUrl, layout, false /*preview_mode=*/,
base::BindLambdaForTesting([&run_loop](bool file_exists) {
@ -1066,7 +1067,7 @@ TEST_F(WallpaperControllerTest, SetOnlineWallpaper) {
// Verify that the wallpaper with |url| is available offline, and the returned
// file name should not contain the small wallpaper suffix.
run_loop.reset(new base::RunLoop());
run_loop = std::make_unique<base::RunLoop>();
controller_->GetOfflineWallpaperList(base::BindLambdaForTesting(
[&run_loop](const std::vector<std::string>& url_list) {
EXPECT_EQ(1U, url_list.size());
@ -2354,7 +2355,7 @@ TEST_F(WallpaperControllerTest, ConfirmPreviewWallpaper) {
gfx::ImageSkia online_wallpaper =
CreateImage(640, 480, online_wallpaper_color);
EXPECT_NE(online_wallpaper_color, GetWallpaperColor());
run_loop.reset(new base::RunLoop());
run_loop = std::make_unique<base::RunLoop>();
SetOnlineWallpaperFromImage(
account_id_1, online_wallpaper, kDummyUrl, layout, false /*save_file=*/,
true /*preview_mode=*/,

@ -71,10 +71,10 @@ class WallpaperResizerTest : public testing::Test,
const gfx::Size& target_size,
WallpaperLayout layout) {
std::unique_ptr<WallpaperResizer> resizer;
resizer.reset(new WallpaperResizer(
resizer = std::make_unique<WallpaperResizer>(
image, target_size,
WallpaperInfo("", layout, DEFAULT, base::Time::Now().LocalMidnight()),
task_runner()));
task_runner());
resizer->AddObserver(this);
resizer->StartResize();
WaitForResize();

@ -60,7 +60,7 @@ class LockScreenSessionControllerClient : public TestSessionControllerClient {
private:
void CreateLockScreen() {
auto lock_view = std::make_unique<views::View>();
lock_screen_widget_.reset(new views::Widget);
lock_screen_widget_ = std::make_unique<views::Widget>();
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
gfx::Size ps = lock_view->GetPreferredSize();

@ -5,6 +5,7 @@
#include "ash/wm/lock_state_controller.h"
#include <algorithm>
#include <memory>
#include <string>
#include <utility>
@ -428,7 +429,7 @@ void LockStateController::PreLockAnimationFinished(bool request_lock) {
lock_fail_timer_.Start(FROM_HERE, kLockFailTimeout, this,
&LockStateController::OnLockFailTimeout);
lock_duration_timer_.reset(new base::ElapsedTimer());
lock_duration_timer_ = std::make_unique<base::ElapsedTimer>();
}
void LockStateController::PostLockAnimationFinished() {
@ -449,7 +450,7 @@ void LockStateController::UnlockAnimationAfterUIDestroyedFinished() {
void LockStateController::StoreUnlockedProperties() {
if (!unlocked_properties_) {
unlocked_properties_.reset(new UnlockedStateProperties());
unlocked_properties_ = std::make_unique<UnlockedStateProperties>();
unlocked_properties_->wallpaper_is_hidden = animator_->IsWallpaperHidden();
}
if (unlocked_properties_->wallpaper_is_hidden) {

@ -67,7 +67,7 @@ ResizeShadow::ResizeShadow(aura::Window* window)
// Use a NinePatchLayer to tile the shadow image (which is simply a
// roundrect).
layer_.reset(new ui::Layer(ui::LAYER_NINE_PATCH));
layer_ = std::make_unique<ui::Layer>(ui::LAYER_NINE_PATCH);
layer_->SetName("WindowResizeShadow");
layer_->SetFillsBoundsOpaquely(false);
layer_->SetOpacity(0.f);

@ -1279,8 +1279,8 @@ void SplitViewController::OnWindowDragEnded(
SnapPosition desired_snap_position,
const gfx::Point& last_location_in_screen) {
if (window_util::IsDraggingTabs(dragged_window)) {
dragged_window_observer_.reset(new TabDraggedWindowObserver(
this, dragged_window, desired_snap_position, last_location_in_screen));
dragged_window_observer_ = std::make_unique<TabDraggedWindowObserver>(
this, dragged_window, desired_snap_position, last_location_in_screen);
} else {
EndWindowDragImpl(dragged_window, /*is_being_destroyed=*/false,
desired_snap_position, last_location_in_screen);

@ -2230,7 +2230,8 @@ TEST_F(SplitViewControllerTest, OverviewExitAnimationTest) {
EXPECT_TRUE(Shell::Get()->overview_controller()->InOverviewSession());
// Reset the observer as we'll need the OverviewStatesObserver to be added to
// to ShellObserver list after SplitViewController.
overview_observer.reset(new OverviewStatesObserver(window1->GetRootWindow()));
overview_observer =
std::make_unique<OverviewStatesObserver>(window1->GetRootWindow());
// Test |overview_animate_when_exiting_| has been properly reset.
EXPECT_TRUE(overview_observer->overview_animate_when_exiting());
CheckOverviewEnterExitHistogram("EnterInSplitView", {2, 1}, {2, 0});
@ -3846,7 +3847,8 @@ TEST_F(SplitViewTabDraggingTest, OverviewExitAnimationTest) {
split_view_controller()->SnapWindow(window1.get(), SplitViewController::LEFT);
split_view_controller()->SnapWindow(window2.get(),
SplitViewController::RIGHT);
overview_observer.reset(new OverviewStatesObserver(window1->GetRootWindow()));
overview_observer =
std::make_unique<OverviewStatesObserver>(window1->GetRootWindow());
resizer = StartDrag(window1.get(), window1.get());
ASSERT_TRUE(resizer.get());
// Overview should have been opened behind the dragged window.

@ -81,8 +81,7 @@ class DividerView : public views::View, public views::ViewTargeterDelegate {
divider_handler_view_ =
AddChildView(std::make_unique<SplitViewDividerHandlerView>());
SetEventTargeter(
std::unique_ptr<views::ViewTargeter>(new views::ViewTargeter(this)));
SetEventTargeter(std::make_unique<views::ViewTargeter>(this));
}
~DividerView() override = default;

@ -60,7 +60,7 @@ class VideoDetectorTest : public AshTestBase {
void SetUp() override {
AshTestBase::SetUp();
observer_.reset(new TestObserver);
observer_ = std::make_unique<TestObserver>();
detector_ = Shell::Get()->video_detector();
detector_->AddObserver(observer_.get());
}

@ -151,8 +151,8 @@ class WindowCycleControllerTest : public AshTestBase {
WindowCycleList::DisableInitialDelayForTesting();
shelf_view_test_.reset(
new ShelfViewTestAPI(GetPrimaryShelf()->GetShelfViewForTesting()));
shelf_view_test_ = std::make_unique<ShelfViewTestAPI>(
GetPrimaryShelf()->GetShelfViewForTesting());
shelf_view_test_->SetAnimationDuration(
base::TimeDelta::FromMilliseconds(1));
}
@ -2930,8 +2930,8 @@ class MultiUserWindowCycleControllerTest
NoSessionAshTestBase::SetUp();
WindowCycleList::DisableInitialDelayForTesting();
shelf_view_test_.reset(
new ShelfViewTestAPI(GetPrimaryShelf()->GetShelfViewForTesting()));
shelf_view_test_ = std::make_unique<ShelfViewTestAPI>(
GetPrimaryShelf()->GetShelfViewForTesting());
shelf_view_test_->SetAnimationDuration(
base::TimeDelta::FromMilliseconds(1));

@ -4,6 +4,8 @@
#include "ash/wm/workspace/multi_window_resize_controller.h"
#include <memory>
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/root_window_controller.h"
#include "ash/shell.h"
@ -467,7 +469,7 @@ void MultiWindowResizeController::ShowNow() {
DCHECK(!resize_widget_.get());
DCHECK(windows_.is_valid());
show_timer_.Stop();
resize_widget_.reset(new views::Widget);
resize_widget_ = std::make_unique<views::Widget>();
views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
params.name = "MultiWindowResizeController";
params.opacity = views::Widget::InitParams::WindowOpacity::kTranslucent;

@ -7,6 +7,7 @@
#include <errno.h>
#include <unistd.h>
#include <memory>
#include <utility>
#include "base/auto_reset.h"
@ -144,7 +145,7 @@ bool MessagePumpLibevent::WatchFileDescriptor(int fd,
std::unique_ptr<event> evt(controller->ReleaseEvent());
if (!evt) {
// Ownership is transferred to the controller.
evt.reset(new event);
evt = std::make_unique<event>();
} else {
// Make sure we don't pick up any funky internal libevent masks.
int old_interest_mask = evt->ev_events & (EV_READ | EV_WRITE | EV_PERSIST);

@ -7,6 +7,7 @@
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <sstream>
#include <string>
#include <vector>
@ -603,7 +604,7 @@ TEST(ProcessMetricsTest, DISABLED_GetNumberOfThreads) {
{
std::unique_ptr<Thread> my_threads[kNumAdditionalThreads];
for (int i = 0; i < kNumAdditionalThreads; ++i) {
my_threads[i].reset(new Thread("GetNumberOfThreadsTest"));
my_threads[i] = std::make_unique<Thread>("GetNumberOfThreadsTest");
my_threads[i]->Start();
ASSERT_EQ(GetNumberOfThreads(current), initial_threads + 1 + i);
}

@ -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 "ash/shell.h"
#include "base/strings/pattern.h"
#include "chrome/browser/ash/accessibility/accessibility_manager.h"
@ -35,7 +37,7 @@ class AccessibilityLiveSiteTest : public InProcessBrowserTest {
extension_load_waiter.Wait();
aura::Window* root_window = Shell::Get()->GetPrimaryRootWindow();
generator_.reset(new ui::test::EventGenerator(root_window));
generator_ = std::make_unique<ui::test::EventGenerator>(root_window);
ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL));
}
@ -49,8 +51,8 @@ class AccessibilityLiveSiteTest : public InProcessBrowserTest {
new net::RuleBasedHostResolverProc(host_resolver());
resolver->AllowDirectLookup("*.google.com");
resolver->AllowDirectLookup("*.gstatic.com");
mock_host_resolver_override_.reset(
new net::ScopedDefaultHostResolverProc(resolver.get()));
mock_host_resolver_override_ =
std::make_unique<net::ScopedDefaultHostResolverProc>(resolver.get());
}
void TearDownInProcessBrowserTestFixture() override {

@ -1139,7 +1139,7 @@ void AccessibilityManager::SetProfile(Profile* profile) {
if (profile) {
// TODO(yoshiki): Move following code to PrefHandler.
pref_change_registrar_.reset(new PrefChangeRegistrar);
pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>();
pref_change_registrar_->Init(profile->GetPrefs());
pref_change_registrar_->Add(
prefs::kShouldAlwaysShowAccessibilityMenu,
@ -1205,7 +1205,8 @@ void AccessibilityManager::SetProfile(Profile* profile) {
base::Unretained(this)));
}
local_state_pref_change_registrar_.reset(new PrefChangeRegistrar);
local_state_pref_change_registrar_ =
std::make_unique<PrefChangeRegistrar>();
local_state_pref_change_registrar_->Init(g_browser_process->local_state());
local_state_pref_change_registrar_->Add(
language::prefs::kApplicationLocale,
@ -1474,10 +1475,11 @@ void AccessibilityManager::PostLoadChromeVox() {
if (!chromevox_panel_) {
chromevox_panel_ = new ChromeVoxPanel(profile_);
chromevox_panel_widget_observer_.reset(new AccessibilityPanelWidgetObserver(
chromevox_panel_->GetWidget(),
base::BindOnce(&AccessibilityManager::OnChromeVoxPanelDestroying,
base::Unretained(this))));
chromevox_panel_widget_observer_ =
std::make_unique<AccessibilityPanelWidgetObserver>(
chromevox_panel_->GetWidget(),
base::BindOnce(&AccessibilityManager::OnChromeVoxPanelDestroying,
base::Unretained(this)));
}
audio_focus_manager_->SetEnforcementMode(
@ -1519,10 +1521,11 @@ void AccessibilityManager::PostSwitchChromeVoxProfile() {
chromevox_panel_ = nullptr;
}
chromevox_panel_ = new ChromeVoxPanel(profile_);
chromevox_panel_widget_observer_.reset(new AccessibilityPanelWidgetObserver(
chromevox_panel_->GetWidget(),
base::BindOnce(&AccessibilityManager::OnChromeVoxPanelDestroying,
base::Unretained(this))));
chromevox_panel_widget_observer_ =
std::make_unique<AccessibilityPanelWidgetObserver>(
chromevox_panel_->GetWidget(),
base::BindOnce(&AccessibilityManager::OnChromeVoxPanelDestroying,
base::Unretained(this)));
}
void AccessibilityManager::OnChromeVoxPanelDestroying() {

@ -4,6 +4,8 @@
#include "chrome/browser/ash/accessibility/accessibility_panel.h"
#include <memory>
#include "ash/public/cpp/shell_window_ids.h"
#include "base/macros.h"
#include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
@ -48,8 +50,9 @@ AccessibilityPanel::AccessibilityPanel(content::BrowserContext* browser_context,
views::WebView* web_view = new views::WebView(browser_context);
web_contents_ = web_view->GetWebContents();
web_contents_observer_.reset(
new AccessibilityPanelWebContentsObserver(web_contents_, this));
web_contents_observer_ =
std::make_unique<AccessibilityPanelWebContentsObserver>(web_contents_,
this);
web_contents_->SetDelegate(this);
extensions::SetViewType(web_contents_,
extensions::mojom::ViewType::kComponent);

@ -4,6 +4,8 @@
#include "chrome/browser/ash/accessibility/chromevox_panel.h"
#include <memory>
#include "ash/public/cpp/accessibility_controller.h"
#include "ash/public/cpp/accessibility_controller_enums.h"
#include "chrome/browser/ash/accessibility/accessibility_manager.h"
@ -54,8 +56,8 @@ class ChromeVoxPanel::ChromeVoxPanelWebContentsObserver
ChromeVoxPanel::ChromeVoxPanel(content::BrowserContext* browser_context)
: AccessibilityPanel(browser_context, GetUrlForContent(), kWidgetName) {
web_contents_observer_.reset(
new ChromeVoxPanelWebContentsObserver(GetWebContents(), this));
web_contents_observer_ = std::make_unique<ChromeVoxPanelWebContentsObserver>(
GetWebContents(), this);
SetAccessibilityPanelFullscreen(false);
}

@ -4,6 +4,8 @@
#include "chrome/browser/ash/accessibility/dictation.h"
#include <memory>
#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/accessibility/soda_installer.h"
@ -43,7 +45,7 @@ class DictationTest : public InProcessBrowserTest,
DictationNetworkTestVariant>> {
protected:
DictationTest() {
input_context_handler_.reset(new ui::MockIMEInputContextHandler());
input_context_handler_ = std::make_unique<ui::MockIMEInputContextHandler>();
empty_composition_text_ =
ui::MockIMEInputContextHandler::UpdateCompositionTextArg()
.composition_text;
@ -58,8 +60,8 @@ class DictationTest : public InProcessBrowserTest,
// Use a fake speech recognition manager so that we don't end up with an
// error finding the audio input device when running on a headless
// environment.
fake_speech_recognition_manager_.reset(
new content::FakeSpeechRecognitionManager());
fake_speech_recognition_manager_ =
std::make_unique<content::FakeSpeechRecognitionManager>();
// Don't send a fake response from the fake manager. The fake manager can
// only send one final response before shutting off. We will do more
// granular testing of multiple not-final and final results by sending

@ -187,7 +187,7 @@ void MagnificationManager::SetProfile(Profile* profile) {
if (profile) {
// TODO(yoshiki): Move following code to PrefHandler.
pref_change_registrar_.reset(new PrefChangeRegistrar);
pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>();
pref_change_registrar_->Init(profile->GetPrefs());
pref_change_registrar_->Add(
prefs::kAccessibilityScreenMagnifierEnabled,

@ -73,7 +73,7 @@ class SelectToSpeakTest : public InProcessBrowserTest {
extension_load_waiter.Wait();
aura::Window* root_window = Shell::Get()->GetPrimaryRootWindow();
generator_.reset(new ui::test::EventGenerator(root_window));
generator_ = std::make_unique<ui::test::EventGenerator>(root_window);
ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL));
}

@ -4,6 +4,8 @@
#include "ash/accessibility/chromevox/touch_exploration_controller.h"
#include <memory>
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "base/macros.h"
@ -49,7 +51,7 @@ class TouchExplorationTest : public InProcessBrowserTest {
browser()->tab_strip_model()->GetActiveWebContents();
content::WaitForResizeComplete(web_contents);
root_window_ = Shell::Get()->GetPrimaryRootWindow();
event_handler_.reset(new ui::test::TestEventHandler());
event_handler_ = std::make_unique<ui::test::TestEventHandler>();
root_window_->AddPreTargetHandler(event_handler_.get());
}

@ -44,7 +44,7 @@ class NotificationWaiter : public KioskAppManagerObserver {
void Wait() {
if (notification_received_)
return;
run_loop_.reset(new base::RunLoop());
run_loop_ = std::make_unique<base::RunLoop>();
run_loop_->Run();
}

@ -4,6 +4,7 @@
#include "chrome/browser/ash/app_mode/kiosk_app_data.h"
#include <memory>
#include <vector>
#include "base/bind.h"
@ -468,8 +469,8 @@ void KioskAppData::StartFetch() {
return;
}
webstore_fetcher_.reset(
new extensions::WebstoreDataFetcher(this, GURL(), app_id()));
webstore_fetcher_ =
std::make_unique<extensions::WebstoreDataFetcher>(this, GURL(), app_id());
webstore_fetcher_->set_max_auto_retries(3);
webstore_fetcher_->Start(g_browser_process->system_network_context_manager()
->GetURLLoaderFactory());

@ -87,8 +87,8 @@ class KioskAppUpdateServiceTest
base::NumberToString(uptime.InSecondsF());
const base::FilePath uptime_file = temp_dir.Append("uptime");
ASSERT_TRUE(base::WriteFile(uptime_file, uptime_seconds));
uptime_file_override_.reset(
new base::ScopedPathOverride(chromeos::FILE_UPTIME, uptime_file));
uptime_file_override_ = std::make_unique<base::ScopedPathOverride>(
chromeos::FILE_UPTIME, uptime_file);
}
void SetUpOnMainThread() override {
@ -146,13 +146,13 @@ class KioskAppUpdateServiceTest
void FireUpdatedNeedReboot() {
update_engine::StatusResult status;
status.set_current_operation(update_engine::Operation::UPDATED_NEED_REBOOT);
run_loop_.reset(new base::RunLoop);
run_loop_ = std::make_unique<base::RunLoop>();
automatic_reboot_manager_->UpdateStatusChanged(status);
run_loop_->Run();
}
void RequestPeriodicReboot() {
run_loop_.reset(new base::RunLoop);
run_loop_ = std::make_unique<base::RunLoop>();
g_browser_process->local_state()->SetInteger(
prefs::kUptimeLimit, base::TimeDelta::FromHours(2).InSeconds());
run_loop_->Run();

@ -4,6 +4,8 @@
#include "chrome/browser/ash/app_mode/kiosk_mode_idle_app_name_notification.h"
#include <memory>
#include "base/bind.h"
#include "base/check.h"
#include "base/command_line.h"
@ -85,10 +87,10 @@ void KioskModeIdleAppNameNotification::OnUserActivity(const ui::Event* event) {
const std::string app_id =
command_line->GetSwitchValueASCII(::switches::kAppId);
Profile* profile = ProfileManager::GetActiveUserProfile();
notification_.reset(new IdleAppNameNotificationView(
notification_ = std::make_unique<IdleAppNameNotificationView>(
kMessageVisibilityTimeMs, kMessageAnimationTimeMs,
extensions::ExtensionRegistry::Get(profile)->GetInstalledExtension(
app_id)));
app_id));
}
show_notification_upon_next_user_activity_ = false;
}

@ -4,6 +4,8 @@
#include "chrome/browser/ash/app_mode/kiosk_profile_loader.h"
#include <memory>
#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
@ -149,12 +151,12 @@ KioskProfileLoader::~KioskProfileLoader() {}
void KioskProfileLoader::Start() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
login_performer_.reset();
cryptohomed_checker_.reset(new CryptohomedChecker(this));
cryptohomed_checker_ = std::make_unique<CryptohomedChecker>(this);
cryptohomed_checker_->StartCheck();
}
void KioskProfileLoader::LoginAsKioskAccount() {
login_performer_.reset(new ChromeLoginPerformer(this));
login_performer_ = std::make_unique<ChromeLoginPerformer>(this);
switch (app_type_) {
case KioskAppType::kArcApp:
// Arc kiosks do not support ephemeral mount.

@ -55,10 +55,10 @@ void WebKioskAppLauncher::Initialize() {
void WebKioskAppLauncher::ContinueWithNetworkReady() {
delegate_->OnAppInstalling();
DCHECK(!is_installed_);
install_task_.reset(new web_app::WebAppInstallTask(
install_task_ = std::make_unique<web_app::WebAppInstallTask>(
profile_, /*os_integration_manager=*/nullptr,
/*install_finalizer=*/nullptr, data_retriever_factory_.Run(),
/*registrar=*/nullptr));
/*registrar=*/nullptr);
install_task_->LoadAndRetrieveWebApplicationInfoWithIcons(
WebKioskAppManager::Get()->GetAppByAccountId(account_id_)->install_url(),
url_loader_.get(),

@ -113,7 +113,7 @@ class WebKioskAppLauncherTest : public ChromeRenderViewHostTestHarness {
launcher_->SetUrlLoaderForTesting(
std::unique_ptr<web_app::TestWebAppUrlLoader>(url_loader_));
closer_.reset(new AppWindowCloser());
closer_ = std::make_unique<AppWindowCloser>();
}
void TearDown() override {

@ -585,7 +585,7 @@ TEST_F(ArcAccessibilityHelperBridgeTest, ToggleTalkBack) {
ASSERT_TRUE(helper_bridge->last_event->event_args->GetList()[0].GetBool());
// Disable TalkBack.
window_tracker.reset(new aura::WindowTracker());
window_tracker = std::make_unique<aura::WindowTracker>();
window_tracker->Add(helper_bridge->window_.get());
helper_bridge->OnSetNativeChromeVoxArcSupportProcessed(
std::move(window_tracker), true, true);

@ -4,6 +4,7 @@
#include "chrome/browser/ash/arc/accessibility/ax_tree_source_arc.h"
#include <memory>
#include <stack>
#include <string>
#include <utility>
@ -541,7 +542,7 @@ void AXTreeSourceArc::Reset() {
tree_map_.clear();
parent_map_.clear();
computed_bounds_.clear();
current_tree_serializer_.reset(new AXTreeArcSerializer(this));
current_tree_serializer_ = std::make_unique<AXTreeArcSerializer>(this);
root_id_.reset();
window_id_.reset();
android_focused_id_.reset();

@ -371,7 +371,7 @@ class ArcAuthServiceTest : public InProcessBrowserTest {
void RequestGoogleAccountsInArc() {
arc_google_accounts_.clear();
arc_google_accounts_callback_called_ = false;
run_loop_.reset(new base::RunLoop());
run_loop_ = std::make_unique<base::RunLoop>();
ArcAuthService::GetGoogleAccountsInArcCallback callback = base::BindOnce(
[](std::vector<mojom::ArcAccountInfoPtr>* accounts,

@ -4,6 +4,7 @@
#include "chrome/browser/ash/attestation/enrollment_certificate_uploader_impl.h"
#include <memory>
#include <utility>
#include "base/bind.h"
@ -94,8 +95,8 @@ void EnrollmentCertificateUploaderImpl::Start() {
if (!attestation_flow_) {
std::unique_ptr<ServerProxy> attestation_ca_client(
new AttestationCAClient());
default_attestation_flow_.reset(
new AttestationFlow(std::move(attestation_ca_client)));
default_attestation_flow_ =
std::make_unique<AttestationFlow>(std::move(attestation_ca_client));
attestation_flow_ = default_attestation_flow_.get();
}

@ -4,6 +4,7 @@
#include "chrome/browser/ash/attestation/machine_certificate_uploader_impl.h"
#include <memory>
#include <string>
#include <utility>
@ -115,8 +116,8 @@ void MachineCertificateUploaderImpl::Start() {
if (!attestation_flow_) {
std::unique_ptr<ServerProxy> attestation_ca_client(
new AttestationCAClient());
default_attestation_flow_.reset(
new AttestationFlow(std::move(attestation_ca_client)));
default_attestation_flow_ =
std::make_unique<AttestationFlow>(std::move(attestation_ca_client));
attestation_flow_ = default_attestation_flow_.get();
}

@ -4,6 +4,7 @@
#include "chrome/browser/ash/attestation/platform_verification_flow.h"
#include <memory>
#include <utility>
#include "ash/constants/ash_switches.h"
@ -140,10 +141,10 @@ PlatformVerificationFlow::PlatformVerificationFlow()
timeout_delay_(base::TimeDelta::FromSeconds(kTimeoutInSeconds)) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
std::unique_ptr<ServerProxy> attestation_ca_client(new AttestationCAClient());
default_attestation_flow_.reset(
new AttestationFlow(std::move(attestation_ca_client)));
default_attestation_flow_ =
std::make_unique<AttestationFlow>(std::move(attestation_ca_client));
attestation_flow_ = default_attestation_flow_.get();
default_delegate_.reset(new DefaultDelegate());
default_delegate_ = std::make_unique<DefaultDelegate>();
delegate_ = default_delegate_.get();
}
@ -157,7 +158,7 @@ PlatformVerificationFlow::PlatformVerificationFlow(
timeout_delay_(base::TimeDelta::FromSeconds(kTimeoutInSeconds)) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!delegate_) {
default_delegate_.reset(new DefaultDelegate());
default_delegate_ = std::make_unique<DefaultDelegate>();
delegate_ = default_delegate_.get();
}
}

@ -4,6 +4,8 @@
#include "chrome/browser/ash/login/app_mode/kiosk_launch_controller.h"
#include <memory>
#include "base/callback_helpers.h"
#include "base/metrics/histogram_macros.h"
#include "base/syslog_logging.h"
@ -194,9 +196,9 @@ void KioskLaunchController::Start(const KioskAppId& kiosk_app_id,
base::BindOnce(&KioskLaunchController::OnTimerFire,
weak_ptr_factory_.GetWeakPtr()));
kiosk_profile_loader_.reset(
new KioskProfileLoader(*kiosk_app_id_.account_id, kiosk_app_id_.type,
/*use_guest_mount=*/false, /*delegate=*/this));
kiosk_profile_loader_ = std::make_unique<KioskProfileLoader>(
*kiosk_app_id_.account_id, kiosk_app_id_.type,
/*use_guest_mount=*/false, /*delegate=*/this);
kiosk_profile_loader_->Start();
}

@ -4,6 +4,8 @@
#include "chrome/browser/ash/login/auth/chrome_login_performer.h"
#include <memory>
#include "base/bind.h"
#include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/ash/login/easy_unlock/easy_unlock_user_login_flow.h"
@ -97,7 +99,7 @@ void ChromeLoginPerformer::RunOnlineAllowlistCheck(
g_browser_process->platform_part()->browser_policy_connector_chromeos();
if (connector->IsCloudManaged() && wildcard_match &&
!connector->IsNonEnterpriseUser(account_id.GetUserEmail())) {
wildcard_login_checker_.reset(new policy::WildcardLoginChecker());
wildcard_login_checker_ = std::make_unique<policy::WildcardLoginChecker>();
if (refresh_token.empty()) {
NOTREACHED() << "Refresh token must be present.";
OnlineWildcardLoginCheckCompleted(

@ -267,7 +267,7 @@ class CryptohomeAuthenticatorTest : public testing::Test {
// Testing profile must be initialized after user_manager_ +
// user_manager_enabler_, because it will create another UserManager
// instance if UserManager instance has not been registed before.
profile_.reset(new TestingProfile);
profile_ = std::make_unique<TestingProfile>();
OwnerSettingsServiceAshFactory::GetInstance()->SetOwnerKeyUtilForTesting(
owner_key_util_);
Key key("fakepass");
@ -298,7 +298,7 @@ class CryptohomeAuthenticatorTest : public testing::Test {
SystemSaltGetter::Initialize();
auth_ = new ChromeCryptohomeAuthenticator(&consumer_);
state_.reset(new TestAttemptState(user_context_));
state_ = std::make_unique<TestAttemptState>(user_context_);
}
// Tears down the test fixture.
@ -551,8 +551,8 @@ TEST_F(CryptohomeAuthenticatorTest, ResolveOwnerNeededFailedMount) {
crypto::ScopedTestNSSChromeOSUser user_slot(user_context_.GetUserIDHash());
owner_key_util_->SetPublicKey(GetOwnerPublicKey());
profile_manager_.reset(
new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
profile_manager_ = std::make_unique<TestingProfileManager>(
TestingBrowserProcess::GetGlobal());
ASSERT_TRUE(profile_manager_->SetUp());
FailOnLoginSuccess(); // Set failing on success as the default...
@ -579,7 +579,7 @@ TEST_F(CryptohomeAuthenticatorTest, ResolveOwnerNeededFailedMount) {
// verification.
content::RunAllTasksUntilIdle();
state_.reset(new TestAttemptState(user_context_));
state_ = std::make_unique<TestAttemptState>(user_context_);
state_->PresetCryptohomeStatus(cryptohome::MOUNT_ERROR_NONE);
// The owner key util should not have found the owner key, so login should
@ -603,8 +603,8 @@ TEST_F(CryptohomeAuthenticatorTest, ResolveOwnerNeededSuccess) {
crypto::GetPublicSlotForChromeOSUser(user_context_.GetUserIDHash()));
ASSERT_TRUE(CreateOwnerKeyInSlot(user_slot.get()));
profile_manager_.reset(
new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
profile_manager_ = std::make_unique<TestingProfileManager>(
TestingBrowserProcess::GetGlobal());
ASSERT_TRUE(profile_manager_->SetUp());
ExpectLoginSuccess(user_context_);
@ -629,7 +629,7 @@ TEST_F(CryptohomeAuthenticatorTest, ResolveOwnerNeededSuccess) {
// verification.
content::RunAllTasksUntilIdle();
state_.reset(new TestAttemptState(user_context_));
state_ = std::make_unique<TestAttemptState>(user_context_);
state_->PresetCryptohomeStatus(cryptohome::MOUNT_ERROR_NONE);
// The owner key util should find the owner key, so login should succeed.

@ -6,6 +6,8 @@
#include <stddef.h>
#include <memory>
#include "base/command_line.h"
#include "base/stl_util.h"
#include "build/build_config.h"
@ -160,8 +162,8 @@ class EasyUnlockAuthAttemptUnlockTest : public testing::Test {
~EasyUnlockAuthAttemptUnlockTest() override {}
void SetUp() override {
auth_attempt_.reset(new EasyUnlockAuthAttempt(
test_account_id1_, EasyUnlockAuthAttempt::TYPE_UNLOCK));
auth_attempt_ = std::make_unique<EasyUnlockAuthAttempt>(
test_account_id1_, EasyUnlockAuthAttempt::TYPE_UNLOCK);
}
void TearDown() override {
@ -171,7 +173,7 @@ class EasyUnlockAuthAttemptUnlockTest : public testing::Test {
protected:
void InitScreenLock() {
lock_handler_.reset(new TestLockHandler(test_account_id1_));
lock_handler_ = std::make_unique<TestLockHandler>(test_account_id1_);
lock_handler_->set_state(TestLockHandler::STATE_ATTEMPTING_UNLOCK);
proximity_auth::ScreenlockBridge::Get()->SetLockHandler(
lock_handler_.get());
@ -292,8 +294,8 @@ class EasyUnlockAuthAttemptSigninTest : public testing::Test {
~EasyUnlockAuthAttemptSigninTest() override {}
void SetUp() override {
auth_attempt_.reset(new EasyUnlockAuthAttempt(
test_account_id1_, EasyUnlockAuthAttempt::TYPE_SIGNIN));
auth_attempt_ = std::make_unique<EasyUnlockAuthAttempt>(
test_account_id1_, EasyUnlockAuthAttempt::TYPE_SIGNIN);
}
void TearDown() override {
@ -303,7 +305,7 @@ class EasyUnlockAuthAttemptSigninTest : public testing::Test {
protected:
void InitScreenLock() {
lock_handler_.reset(new TestLockHandler(test_account_id1_));
lock_handler_ = std::make_unique<TestLockHandler>(test_account_id1_);
lock_handler_->set_state(TestLockHandler::STATE_ATTEMPTING_SIGNIN);
proximity_auth::ScreenlockBridge::Get()->SetLockHandler(
lock_handler_.get());

@ -280,10 +280,10 @@ void EasyUnlockCreateKeysOperation::CreateKeyForDeviceAtIndex(size_t index) {
return;
}
challenge_creator_.reset(new ChallengeCreator(
challenge_creator_ = std::make_unique<ChallengeCreator>(
user_key, session_key->key(), tpm_public_key_, device,
base::BindOnce(&EasyUnlockCreateKeysOperation::OnChallengeCreated,
weak_ptr_factory_.GetWeakPtr(), index)));
weak_ptr_factory_.GetWeakPtr(), index));
challenge_creator_->Start();
}

@ -3,6 +3,9 @@
// found in the LICENSE file.
#include "chrome/browser/ash/login/easy_unlock/easy_unlock_refresh_keys_operation.h"
#include <memory>
#include "base/bind.h"
#include "chrome/browser/ash/login/easy_unlock/easy_unlock_create_keys_operation.h"
#include "chrome/browser/ash/login/easy_unlock/easy_unlock_remove_keys_operation.h"
@ -28,10 +31,10 @@ void EasyUnlockRefreshKeysOperation::Start() {
return;
}
create_keys_operation_.reset(new EasyUnlockCreateKeysOperation(
create_keys_operation_ = std::make_unique<EasyUnlockCreateKeysOperation>(
user_context_, tpm_public_key_, devices_,
base::BindOnce(&EasyUnlockRefreshKeysOperation::OnKeysCreated,
weak_ptr_factory_.GetWeakPtr())));
weak_ptr_factory_.GetWeakPtr()));
create_keys_operation_->Start();
}
@ -54,10 +57,10 @@ void EasyUnlockRefreshKeysOperation::OnKeysCreated(bool success) {
void EasyUnlockRefreshKeysOperation::RemoveKeysStartingFromIndex(
size_t key_index) {
remove_keys_operation_.reset(new EasyUnlockRemoveKeysOperation(
remove_keys_operation_ = std::make_unique<EasyUnlockRemoveKeysOperation>(
user_context_, key_index,
base::BindOnce(&EasyUnlockRefreshKeysOperation::OnKeysRemoved,
weak_ptr_factory_.GetWeakPtr())));
weak_ptr_factory_.GetWeakPtr()));
remove_keys_operation_->Start();
}

@ -6,6 +6,7 @@
#include <stddef.h>
#include <memory>
#include <string>
#include <vector>
@ -256,16 +257,16 @@ class EasyUnlockScreenlockStateHandlerTest : public testing::Test {
void SetUp() override {
// Create and inject fake lock handler to the screenlock bridge.
lock_handler_.reset(new TestLockHandler(account_id_));
lock_handler_ = std::make_unique<TestLockHandler>(account_id_);
proximity_auth::ScreenlockBridge* screenlock_bridge =
proximity_auth::ScreenlockBridge::Get();
screenlock_bridge->SetLockHandler(lock_handler_.get());
fake_pref_manager_ = std::make_unique<FakeProximityAuthPrefManager>();
// Create the screenlock state handler object that will be tested.
state_handler_.reset(new EasyUnlockScreenlockStateHandler(
state_handler_ = std::make_unique<EasyUnlockScreenlockStateHandler>(
account_id_, EasyUnlockScreenlockStateHandler::NO_HARDLOCK,
screenlock_bridge, fake_pref_manager_.get()));
screenlock_bridge, fake_pref_manager_.get());
}
void TearDown() override {
@ -466,7 +467,7 @@ TEST_F(EasyUnlockScreenlockStateHandlerTest, StatePreservedWhenScreenUnlocks) {
ASSERT_TRUE(lock_handler_->HasCustomIcon());
proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL);
lock_handler_.reset(new TestLockHandler(account_id_));
lock_handler_ = std::make_unique<TestLockHandler>(account_id_);
EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get());
@ -485,7 +486,7 @@ TEST_F(EasyUnlockScreenlockStateHandlerTest, StateChangeWhileScreenUnlocked) {
ASSERT_TRUE(lock_handler_->HasCustomIcon());
proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL);
lock_handler_.reset(new TestLockHandler(account_id_));
lock_handler_ = std::make_unique<TestLockHandler>(account_id_);
EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
state_handler_->ChangeState(ScreenlockState::BLUETOOTH_CONNECTING);
@ -616,7 +617,7 @@ TEST_F(EasyUnlockScreenlockStateHandlerTest,
EasyUnlockScreenlockStateHandler::NO_HARDLOCK);
proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL);
lock_handler_.reset(new TestLockHandler(account_id_));
lock_handler_ = std::make_unique<TestLockHandler>(account_id_);
EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get());
@ -626,7 +627,7 @@ TEST_F(EasyUnlockScreenlockStateHandlerTest,
EXPECT_TRUE(lock_handler_->HasCustomIcon());
proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL);
lock_handler_.reset(new TestLockHandler(account_id_));
lock_handler_ = std::make_unique<TestLockHandler>(account_id_);
EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get());
@ -651,7 +652,7 @@ TEST_F(EasyUnlockScreenlockStateHandlerTest, HardlockStatePersistsOverUnlocks) {
EXPECT_EQ(2u, lock_handler_->GetAndResetShowIconCount());
proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL);
lock_handler_.reset(new TestLockHandler(account_id_));
lock_handler_ = std::make_unique<TestLockHandler>(account_id_);
EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount());
proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get());

@ -4,6 +4,7 @@
#include "chrome/browser/ash/login/easy_unlock/easy_unlock_service.h"
#include <memory>
#include <utility>
#include "base/bind.h"
@ -232,10 +233,11 @@ EasyUnlockService::GetScreenlockStateHandler() {
if (!IsAllowed())
return NULL;
if (!screenlock_state_handler_) {
screenlock_state_handler_.reset(new EasyUnlockScreenlockStateHandler(
GetAccountId(), GetHardlockState(),
proximity_auth::ScreenlockBridge::Get(),
GetProximityAuthPrefManager()));
screenlock_state_handler_ =
std::make_unique<EasyUnlockScreenlockStateHandler>(
GetAccountId(), GetHardlockState(),
proximity_auth::ScreenlockBridge::Get(),
GetProximityAuthPrefManager());
}
return screenlock_state_handler_.get();
}
@ -295,7 +297,8 @@ bool EasyUnlockService::AttemptAuth(const AccountId& account_id) {
return false;
}
auth_attempt_.reset(new EasyUnlockAuthAttempt(account_id, auth_attempt_type));
auth_attempt_ =
std::make_unique<EasyUnlockAuthAttempt>(account_id, auth_attempt_type);
if (!auth_attempt_->Start()) {
RecordAuthResultFailure(
auth_attempt_type,
@ -430,7 +433,7 @@ void EasyUnlockService::UpdateAppState() {
proximity_auth_system_->Start();
if (!power_monitor_)
power_monitor_.reset(new PowerMonitor(this));
power_monitor_ = std::make_unique<PowerMonitor>(this);
}
}
@ -626,11 +629,12 @@ void EasyUnlockService::SetProximityAuthDevices(
if (!proximity_auth_system_) {
PA_LOG(VERBOSE) << "Creating ProximityAuthSystem.";
proximity_auth_system_.reset(new proximity_auth::ProximityAuthSystem(
GetType() == TYPE_SIGNIN
? proximity_auth::ProximityAuthSystem::SIGN_IN
: proximity_auth::ProximityAuthSystem::SESSION_LOCK,
proximity_auth_client(), secure_channel_client_));
proximity_auth_system_ =
std::make_unique<proximity_auth::ProximityAuthSystem>(
GetType() == TYPE_SIGNIN
? proximity_auth::ProximityAuthSystem::SIGN_IN
: proximity_auth::ProximityAuthSystem::SESSION_LOCK,
proximity_auth_client(), secure_channel_client_);
}
proximity_auth_system_->SetRemoteDevicesForUser(account_id, remote_devices,

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