Commit 6f5e6535 authored by Dana Fried's avatar Dana Fried Committed by Commit Bot

Use std::make_unique for views in MediaDialogView

Use of new operator in constructing views is highly discouraged. See:
https://source.chromium.org/chromium/chromium/src/+/master:docs/ui/learn/bestpractices/ownership.md

This is minor code cleanup and should not affect behavior.

Change-Id: Ia4d522d5e3a40b0d5a148286e84d3764006da990
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2495830Reviewed-by: default avatarAbigail Klein <abigailbklein@google.com>
Commit-Queue: Dana Fried <dfried@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820541}
parent 9099e07e
......@@ -239,7 +239,7 @@ void MediaDialogView::Init() {
views::BoxLayout::Orientation::kVertical))
->set_cross_axis_alignment(views::BoxLayout::CrossAxisAlignment::kStart);
views::View* live_caption_container = new views::View();
auto live_caption_container = std::make_unique<View>();
auto* live_caption_container_layout =
live_caption_container->SetLayoutManager(
std::make_unique<views::BoxLayout>(
......@@ -255,18 +255,18 @@ void MediaDialogView::Init() {
views::CreateSolidBackground(native_theme_bg_color));
}
views::ImageView* live_caption_image = new views::ImageView();
auto live_caption_image = std::make_unique<views::ImageView>();
live_caption_image->SetImage(
gfx::CreateVectorIcon(kLiveCaptionIcon, kLiveCaptionImageWidthDip,
SkColor(gfx::kGoogleGrey700)));
// TODO(crbug.com/1055150): Replace NewBadgeLabel with Label by M93.
views::Label* live_caption_title = new NewBadgeLabel(
auto live_caption_title = std::make_unique<NewBadgeLabel>(
l10n_util::GetStringUTF16(IDS_GLOBAL_MEDIA_CONTROLS_LIVE_CAPTION));
live_caption_title->SetHorizontalAlignment(
gfx::HorizontalAlignment::ALIGN_LEFT);
views::ToggleButton* live_caption_button =
new views::ToggleButton(base::BindRepeating(
auto live_caption_button =
std::make_unique<views::ToggleButton>(base::BindRepeating(
&MediaDialogView::ToggleLiveCaption, base::Unretained(this)));
live_caption_button->SetIsOn(
profile_->GetPrefs()->GetBoolean(prefs::kLiveCaptionEnabled));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment