0

views: Rename AddChildView(T*) to AddChildViewRaw(T*), round 2

This CL renames more uses of View::AddChildView(T*) to
View::AddChildViewRaw(T*).  This makes the raw pointer version more
distinct from AddChildView(std::unique_ptr<T>), enabling future
presubmit checks to discourage raw pointer usage.

Bug: 40485510
No-Try: true
Change-Id: Ib0ad01a8e983386878d27b8519890796f456738d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6315091
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Owners-Override: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Keren Zhu <kerenzhu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1427553}
This commit is contained in:
Keren Zhu
2025-03-03 21:34:44 -08:00
committed by Chromium LUCI CQ
parent f06d757d11
commit 4d6f1430a0
136 changed files with 314 additions and 312 deletions
ash
accessibility
ambient
app_list
app_menu
auth
display
drag_drop
extended_desktop_unittest.cc
focus
frame
ime
login
search_box
session
shelf
style
system
tooltips
touch
wallpaper
wm
chrome/browser
chromeos
components/exo
ui/views

@ -43,7 +43,7 @@ class TestTextInputView : public views::WidgetDelegateView {
text_field_->SetTextInputType(ui::TEXT_INPUT_TYPE_TEXT);
std::string name = "Hello, world";
text_field_->GetViewAccessibility().SetName(base::UTF8ToUTF16(name));
AddChildView(text_field_.get());
AddChildViewRaw(text_field_.get());
SetLayoutManager(std::make_unique<views::FillLayout>());
}
TestTextInputView(const TestTextInputView&) = delete;

@ -52,7 +52,7 @@ class TestTextInputView : public views::WidgetDelegateView {
text_field_->SetTextInputType(ui::TEXT_INPUT_TYPE_TEXT);
std::string name = "Hello, world";
text_field_->GetViewAccessibility().SetName(base::UTF8ToUTF16(name));
AddChildView(text_field_.get());
AddChildViewRaw(text_field_.get());
SetLayoutManager(std::make_unique<views::FillLayout>());
}
TestTextInputView(const TestTextInputView&) = delete;

@ -29,7 +29,7 @@ void AmbientAnimationShieldController::OnColorModeChanged(
bool shield_is_active = parent_view_->Contains(shield_view_.get());
if (dark_mode_enabled && !shield_is_active) {
DVLOG(4) << "Adding dark mode shield";
parent_view_->AddChildView(shield_view_.get());
parent_view_->AddChildViewRaw(shield_view_.get());
} else if (!dark_mode_enabled && shield_is_active) {
DVLOG(4) << "Removing dark mode shield";
parent_view_->RemoveChildView(shield_view_.get());

@ -66,7 +66,7 @@ AmbientVideoView::AmbientVideoView(std::string_view video_file,
BuildFileUrl(html_path), kAmbientVideoFileQueryParam, video_file);
ash_web_view_->Navigate(ambient_video_url);
AddChildView(peripheral_ui_.get());
AddChildViewRaw(peripheral_ui_.get());
peripheral_ui_->UpdateLeftPaddingToMatchBottom();
// Update details label to empty string as details info is not shown for
// ambient video.

@ -140,7 +140,7 @@ PageSwitcher::PageSwitcher(PaginationModel* model)
views::BoxLayout::Orientation::kVertical, gfx::Insets(),
kVerticalButtonPadding));
AddChildView(buttons_.get());
AddChildViewRaw(buttons_.get());
TotalPagesChanged(0, model->total_pages());
SelectedPageChanged(-1, model->selected_page());

@ -102,7 +102,7 @@ SearchResultListView::SearchResultListView(
title_label_->SetPaintToLayer();
title_label_->layer()->SetFillsBoundsOpaquely(false);
results_container_->AddChildView(title_label_.get());
results_container_->AddChildViewRaw(title_label_.get());
size_t result_count =
ash::SharedAppListConfig::instance()
@ -118,7 +118,7 @@ SearchResultListView::SearchResultListView(
results_container_->AddChildView(search_result_views_.back());
AddObservedResultView(search_result_views_.back());
}
AddChildView(results_container_.get());
AddChildViewRaw(results_container_.get());
}
SearchResultListView::~SearchResultListView() = default;

@ -72,8 +72,8 @@ class SearchResultListViewTest : public views::test::WidgetTest {
answer_card_view_->SetActive(true);
widget_->SetBounds(gfx::Rect(0, 0, 700, 500));
widget_->GetContentsView()->AddChildView(default_view_.get());
widget_->GetContentsView()->AddChildView(answer_card_view_.get());
widget_->GetContentsView()->AddChildViewRaw(default_view_.get());
widget_->GetContentsView()->AddChildViewRaw(answer_card_view_.get());
widget_->Show();
default_view_->SetResults(GetResults());
answer_card_view_->SetResults(GetResults());

@ -74,23 +74,23 @@ NotificationItemView::NotificationItemView(
text_container_ = new views::View();
text_container_->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical));
AddChildView(text_container_.get());
AddChildViewRaw(text_container_.get());
title_label_ = new views::Label(title_);
title_label_->SetEnabledColor(kNotificationTitleTextColor);
title_label_->SetLineHeight(kNotificationItemTextLineHeight);
title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
text_container_->AddChildView(title_label_.get());
text_container_->AddChildViewRaw(title_label_.get());
message_label_ = new views::Label(message_);
message_label_->SetEnabledColor(kNotificationMessageTextColor);
message_label_->SetLineHeight(kNotificationItemTextLineHeight);
message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
text_container_->AddChildView(message_label_.get());
text_container_->AddChildViewRaw(message_label_.get());
proportional_icon_view_ =
new message_center::ProportionalImageView(kProportionalIconViewSize);
AddChildView(proportional_icon_view_.get());
AddChildViewRaw(proportional_icon_view_.get());
proportional_icon_view_->SetImage(icon, kProportionalIconViewSize);
}

@ -131,7 +131,7 @@ void NotificationMenuController::InitializeNotificationMenuView() {
views::MenuItemView* container =
root_menu_->AppendMenuItem(NOTIFICATION_CONTAINER);
notification_menu_view_ = new NotificationMenuView(this, this, app_id_);
container->AddChildView(notification_menu_view_.get());
container->AddChildViewRaw(notification_menu_view_.get());
for (message_center::Notification* notification :
message_center::MessageCenter::Get()->FindNotificationsByAppId(

@ -36,14 +36,14 @@ NotificationMenuHeaderView::NotificationMenuHeaderView() {
{views::Label::GetDefaultFontList().DeriveWithSizeDelta(1)});
notification_title_->SetEnabledColor(kNotificationHeaderTextColor);
notification_title_->SetLineHeight(kNotificationHeaderLineHeight);
AddChildView(notification_title_.get());
AddChildViewRaw(notification_title_.get());
counter_ = new views::Label(
std::u16string(),
{views::Label::GetDefaultFontList().DeriveWithSizeDelta(1)});
counter_->SetEnabledColor(kNotificationHeaderTextColor);
counter_->SetLineHeight(kNotificationHeaderLineHeight);
AddChildView(counter_.get());
AddChildViewRaw(counter_.get());
}
NotificationMenuHeaderView::~NotificationMenuHeaderView() = default;

@ -166,7 +166,7 @@ void ActiveSessionAuthView::AddHeaderAndCloseButton(
std::make_unique<AuthHeaderView>(account_id_, title, description));
header_observation_.Observe(auth_header_);
header->AddChildView(auth_header_container);
header->AddChildViewRaw(auth_header_container);
// Close button position and creation.
views::View* close_button_view =
@ -180,7 +180,7 @@ void ActiveSessionAuthView::AddHeaderAndCloseButton(
close_button_layout->set_cross_axis_alignment(
views::BoxLayout::CrossAxisAlignment::kEnd);
close_button_view->SetLayoutManager(std::move(close_button_layout));
header->AddChildView(close_button_view);
header->AddChildViewRaw(close_button_view);
IconButton::Builder builder;
builder.SetType(IconButton::Type::kXSmall)

@ -105,7 +105,7 @@ AuthHeaderView::AuthHeaderView(const AccountId& account_id,
title_label_->GetViewAccessibility().SetRole(ax::mojom::Role::kTitleBar);
title_label_->GetViewAccessibility().SetName(title);
decorate_label(title_label_);
AddChildView(title_label_.get());
AddChildViewRaw(title_label_.get());
// Add vertical space separator.
add_spacer(kTitleToDescriptionDistanceDp);
@ -119,7 +119,7 @@ AuthHeaderView::AuthHeaderView(const AccountId& account_id,
description_label_->SetFontList(
TypographyProvider::Get()->ResolveTypographyToken(kDescriptionFont));
decorate_label(description_label_);
AddChildView(description_label_.get());
AddChildViewRaw(description_label_.get());
}
AuthHeaderView::~AuthHeaderView() {

@ -106,7 +106,7 @@ PinStatusView::PinStatusView() {
text_label_->SetFontList(
TypographyProvider::Get()->ResolveTypographyToken(kTextFont));
decorate_label(text_label_);
AddChildView(text_label_.get());
AddChildViewRaw(text_label_.get());
}
PinStatusView::~PinStatusView() {

@ -2156,7 +2156,7 @@ TEST_F(WindowTreeHostManagerTest,
views::Widget* widget = views::Widget::CreateWindowWithContext(
nullptr, root2, gfx::Rect(350, 0, 100, 100));
views::View* view = new views::View();
widget->GetContentsView()->AddChildView(view);
widget->GetContentsView()->AddChildViewRaw(view);
view->SetBounds(0, 0, 100, 100);
widget->Show();

@ -343,7 +343,7 @@ void AddViewToWidgetAndResize(views::Widget* widget, views::View* view) {
widget->SetContentsView(std::make_unique<views::View>());
views::View* contents_view = widget->GetContentsView();
contents_view->AddChildView(view);
contents_view->AddChildViewRaw(view);
view->SetBounds(contents_view->width(), 0, 100, 100);
gfx::Rect contents_view_bounds = contents_view->bounds();
contents_view_bounds.Union(view->bounds());

@ -830,7 +830,7 @@ TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) {
views::Widget* lock_widget = CreateTestWidget(
display::Screen::GetScreen()->GetPrimaryDisplay().bounds());
views::Textfield* textfield = new views::Textfield;
lock_widget->client_view()->AddChildView(textfield);
lock_widget->client_view()->AddChildViewRaw(textfield);
Shell::GetContainer(Shell::GetPrimaryRootWindow(),
kShellWindowId_LockScreenContainer)

@ -300,22 +300,22 @@ TEST_F(FocusCyclerTest, CycleFocusThroughWindowWithPanes) {
views::View* view1 = new views::View;
view1->SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
pane1->AddChildView(view1);
pane1->AddChildViewRaw(view1);
views::View* view2 = new views::View;
view2->SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
pane1->AddChildView(view2);
pane1->AddChildViewRaw(view2);
views::AccessiblePaneView* pane2 = new views::AccessiblePaneView();
root_view->AddChildView(pane2);
views::View* view3 = new views::View;
view3->SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
pane2->AddChildView(view3);
pane2->AddChildViewRaw(view3);
views::View* view4 = new views::View;
view4->SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
pane2->AddChildView(view4);
pane2->AddChildViewRaw(view4);
std::vector<raw_ptr<views::View, VectorExperimental>> panes;
panes.push_back(pane1);
@ -408,14 +408,14 @@ TEST_F(FocusCyclerTest, CycleFocusThroughWindowWithPanes_MoveOntoNext) {
views::View* view1 = new views::View();
view1->SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
pane1->AddChildView(view1);
pane1->AddChildViewRaw(view1);
views::AccessiblePaneView* pane2 = new views::AccessiblePaneView();
root_view->AddChildView(pane2);
views::View* view2 = new views::View();
view2->SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
pane2->AddChildView(view2);
pane2->AddChildViewRaw(view2);
test_widget_delegate->SetAccessiblePanes({pane1, pane2});

@ -313,7 +313,7 @@ TEST_F(FrameCaptionButtonContainerViewTest, TestSizeButtonBehaviorOverride) {
FrameCaptionButtonContainerView container(widget);
InitContainer(&container);
widget->GetContentsView()->AddChildView(&container);
widget->GetContentsView()->AddChildViewRaw(&container);
views::test::RunScheduledLayout(&container);
FrameCaptionButtonContainerView::TestApi testApi(&container);
@ -372,7 +372,7 @@ TEST_F(FrameCaptionButtonContainerViewTest, ResizeButtonRestoreBehavior) {
FrameCaptionButtonContainerView container(widget);
InitContainer(&container);
widget->GetContentsView()->AddChildView(&container);
widget->GetContentsView()->AddChildViewRaw(&container);
views::test::RunScheduledLayout(&container);
FrameCaptionButtonContainerView::TestApi testApi(&container);
@ -466,7 +466,7 @@ TEST_F(FrameCaptionButtonContainerViewTest, TestFloatButtonBehavior) {
FrameCaptionButtonContainerView container(widget);
InitContainer(&container);
widget->GetContentsView()->AddChildView(&container);
widget->GetContentsView()->AddChildViewRaw(&container);
views::test::RunScheduledLayout(&container);
FrameCaptionButtonContainerView::TestApi test_api(&container);

@ -125,7 +125,7 @@ class TestWidgetDelegate : public views::WidgetDelegateView {
views::CAPTION_BUTTON_ICON_MAXIMIZE_RESTORE,
views::kWindowControlMaximizeIcon);
AddChildView(caption_button_container_.get());
AddChildViewRaw(caption_button_container_.get());
}
}

@ -95,7 +95,7 @@ gfx::Size ImeModeIndicatorView::CalculatePreferredSize(
void ImeModeIndicatorView::Init() {
SetLayoutManager(std::make_unique<views::FillLayout>());
AddChildView(label_view_.get());
AddChildViewRaw(label_view_.get());
SetAnchorRect(cursor_bounds_);
}

@ -268,7 +268,7 @@ FixedLengthCodeInput::FixedLengthCodeInput(int length,
// FixedLengthCodeInput object.
field->GetViewAccessibility().set_propagate_focus_to_ancestor(true);
input_fields_.push_back(field);
AddChildView(field);
AddChildViewRaw(field);
layout->SetFlexForView(field, 1);
}
text_value_for_a11y_ = std::u16string(length, ' ');

@ -243,7 +243,7 @@ LocalAuthenticationRequestView::LocalAuthenticationRequestView(
close_button_->GetViewAccessibility().SetName(l10n_util::GetStringUTF16(
IDS_ASH_LOGIN_LOCAL_AUTHENTICATION_CLOSE_DIALOG_BUTTON));
close_button_->SetFocusBehavior(FocusBehavior::ALWAYS);
close_button_view->AddChildView(close_button_.get());
close_button_view->AddChildViewRaw(close_button_.get());
auto add_spacer = [&](int height) {
auto* spacer = new NonAccessibleView();
@ -271,7 +271,7 @@ LocalAuthenticationRequestView::LocalAuthenticationRequestView(
title_label_->SetFontList(gfx::FontList().Derive(
kTitleFontSizeDeltaDp, gfx::Font::NORMAL, gfx::Font::Weight::MEDIUM));
decorate_label(title_label_);
AddChildView(title_label_.get());
AddChildViewRaw(title_label_.get());
add_spacer(kTitleToDescriptionDistanceDp);
@ -287,7 +287,7 @@ LocalAuthenticationRequestView::LocalAuthenticationRequestView(
gfx::FontList().Derive(kDescriptionFontSizeDeltaDp, gfx::Font::NORMAL,
gfx::Font::Weight::NORMAL));
decorate_label(description_label_);
AddChildView(description_label_.get());
AddChildViewRaw(description_label_.get());
add_spacer(kDescriptionToAccessCodeDistanceDp);

@ -866,12 +866,12 @@ LockDebugView::LockDebugView(LockScreen::ScreenType screen_type)
lock_ = new LockContentsView(screen_type,
debug_data_dispatcher_->debug_dispatcher(),
std::move(debug_detachable_base_model));
AddChildView(lock_.get());
AddChildViewRaw(lock_.get());
container_ = new NonAccessibleView();
container_->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical));
AddChildView(container_.get());
AddChildViewRaw(container_.get());
auto* margin = new NonAccessibleView();
margin->SetPreferredSize(gfx::Size(10, 10));
@ -1262,7 +1262,7 @@ void LockDebugView::UpdatePerUserActionContainer() {
name->SetSubpixelRenderingEnabled(false);
name->SetEnabledColor(kColorAshTextColorPrimary);
name->SetAutoColorReadabilityEnabled(false);
row->AddChildView(name);
row->AddChildViewRaw(name);
AddButton("Toggle PIN",
base::BindRepeating(

@ -151,7 +151,7 @@ class LoginAuthUserViewTestBase : public LoginTestBase {
container_ = new views::View();
container_->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical));
container_->AddChildView(view_.get());
container_->AddChildViewRaw(view_.get());
SetWidget(CreateWidgetWithContent(container_));
}

@ -156,7 +156,7 @@ class LoginAuthUserViewTestBase : public LoginTestBase {
container_ = new views::View();
container_->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical));
container_->AddChildView(view_.get());
container_->AddChildViewRaw(view_.get());
SetWidget(CreateWidgetWithContent(container_));
}
@ -216,7 +216,7 @@ TEST_F(LoginAuthUserViewUnittest, ShowingPasswordForcesOpaque) {
// since focus will keep it opaque.
auto* focus = new views::View();
focus->SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
container_->AddChildView(focus);
container_->AddChildViewRaw(focus);
focus->RequestFocus();
EXPECT_FALSE(auth_test.user_view()->HasFocus());

@ -58,7 +58,7 @@ class LoginBaseBubbleViewTest : public LoginTestBase {
container_ = new views::View();
container_->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical));
container_->AddChildView(anchor_.get());
container_->AddChildViewRaw(anchor_.get());
SetWidget(CreateWidgetWithContent(container_));
@ -68,9 +68,9 @@ class LoginBaseBubbleViewTest : public LoginTestBase {
views::style::STYLE_PRIMARY);
bubble_->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical));
bubble_->AddChildView(label);
bubble_->AddChildViewRaw(label);
container_->AddChildView(bubble_.get());
container_->AddChildViewRaw(bubble_.get());
}
raw_ptr<LoginBaseBubbleView, DanglingUntriaged> bubble_;

@ -142,7 +142,7 @@ void LoginBigUserView::CreateAuthUser(const LoginUserInfo& user) {
auth_user_ = new LoginAuthUserView(user, auth_user_callbacks_);
delete public_account_;
public_account_ = nullptr;
AddChildView(auth_user_.get());
AddChildViewRaw(auth_user_.get());
}
void LoginBigUserView::CreatePublicAccount(const LoginUserInfo& user) {
@ -153,7 +153,7 @@ void LoginBigUserView::CreatePublicAccount(const LoginUserInfo& user) {
new LoginPublicAccountUserView(user, public_account_callbacks_);
delete auth_user_;
auth_user_ = nullptr;
AddChildView(public_account_.get());
AddChildViewRaw(public_account_.get());
}
BEGIN_METADATA(LoginBigUserView)

@ -77,7 +77,7 @@ LoginCameraTimeoutView::LoginCameraTimeoutView(
views::BoxLayout::MainAxisAlignment::kCenter);
text_container_layout->set_cross_axis_alignment(
views::BoxLayout::CrossAxisAlignment::kCenter);
AddChildView(text_container);
AddChildViewRaw(text_container);
// TODO(dkuzmin): Make title in Google Sans font once
// https://crbug.com/1288022 is resolved.
title_ = text_container->AddChildView(CreateLabel(

@ -219,7 +219,7 @@ class SelectionButtonView : public LoginButton {
label_ = CreateLabel(
text, static_cast<ui::ColorId>(cros_tokens::kCrosSysOnSurface));
left_margin_view_ = add_horizontal_margin(left_margin_, label_container);
label_container->AddChildView(label_.get());
label_container->AddChildViewRaw(label_.get());
auto* icon_container = new NonAccessibleView();
icon_container->SetCanProcessEventsWithinSubtree(false);
@ -235,7 +235,7 @@ class SelectionButtonView : public LoginButton {
const int icon_size = kJellyDropDownIconSizeDp;
icon_->SetPreferredSize(gfx::Size(icon_size, icon_size));
icon_container->AddChildView(icon_.get());
icon_container->AddChildViewRaw(icon_.get());
right_margin_view_ = add_horizontal_margin(right_margin_, icon_container);
}
@ -463,7 +463,7 @@ class RightPaneView : public NonAccessibleView {
advanced_view_button_->SetPreferredSize(
gfx::Size(kAdvancedViewButtonWidthDp, advanced_view_button_icon_size));
AddChildView(advanced_view_button_.get());
AddChildViewRaw(advanced_view_button_.get());
advanced_view_button_->SetProperty(
views::kMarginsKey, gfx::Insets().set_bottom(
@ -475,12 +475,12 @@ class RightPaneView : public NonAccessibleView {
advanced_view_->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical));
advanced_view_->SetVisible(false);
AddChildView(advanced_view_.get());
AddChildViewRaw(advanced_view_.get());
language_title_ = CreateLabel(
l10n_util::GetStringUTF16(IDS_ASH_LOGIN_LANGUAGE_SELECTION_SELECT),
kColorAshTextColorSecondary);
advanced_view_->AddChildView(language_title_.get());
advanced_view_->AddChildViewRaw(language_title_.get());
language_title_->SetProperty(
views::kMarginsKey,
gfx::Insets().set_bottom(kSpacingBetweenSelectionTitleAndButtonDp));
@ -488,7 +488,7 @@ class RightPaneView : public NonAccessibleView {
keyboard_title_ = CreateLabel(
l10n_util::GetStringUTF16(IDS_ASH_LOGIN_KEYBOARD_SELECTION_SELECT),
kColorAshTextColorSecondary);
advanced_view_->AddChildView(keyboard_title_.get());
advanced_view_->AddChildViewRaw(keyboard_title_.get());
keyboard_title_->SetProperty(
views::kMarginsKey,
gfx::Insets()
@ -817,7 +817,7 @@ LoginExpandedPublicAccountView::LoginExpandedPublicAccountView(
user_view_->SetTapEnabled(false);
left_pane_ = box_layout_view_->AddChildView(std::make_unique<LeftPaneView>());
left_pane_->AddChildView(user_view_.get());
left_pane_->AddChildViewRaw(user_view_.get());
const bool enable_warning = Shell::Get()->local_state()->GetBoolean(
prefs::kManagedGuestSessionPrivacyWarningsEnabled);
@ -835,7 +835,7 @@ LoginExpandedPublicAccountView::LoginExpandedPublicAccountView(
right_pane_ = new RightPaneView(
base::BindRepeating(&LoginExpandedPublicAccountView::ShowWarningDialog,
base::Unretained(this)));
box_layout_view_->AddChildView(right_pane_.get());
box_layout_view_->AddChildViewRaw(right_pane_.get());
auto* const submit_button_container =
AddChildView(std::make_unique<SubmitButtonContainer>());

@ -87,8 +87,8 @@ class LoginExpandedPublicAccountViewTest
container_ = new views::BoxLayoutView();
container_->SetCrossAxisAlignment(
views::BoxLayout::CrossAxisAlignment::kStart);
container_->AddChildView(public_account_.get());
container_->AddChildView(other_view_.get());
container_->AddChildViewRaw(public_account_.get());
container_->AddChildViewRaw(other_view_.get());
auto widget = CreateWidgetWithContent(container_);
switch (GetParam().orientation) {
case Orientation::kLandscape:

@ -238,9 +238,9 @@ class LoginPinView::DigitPinButton : public BasePinButton {
base::BindRepeating(on_key, value)) {
SetID(GetViewIdForPinNumber(value));
const gfx::FontList& base_font_list = views::Label::GetDefaultFontList();
label_ = AddChildView(new views::Label(GetButtonLabelForNumber(value),
views::style::CONTEXT_BUTTON,
views::style::STYLE_PRIMARY));
label_ = AddChildViewRaw(new views::Label(GetButtonLabelForNumber(value),
views::style::CONTEXT_BUTTON,
views::style::STYLE_PRIMARY));
label_->SetAutoColorReadabilityEnabled(false);
label_->SetSubpixelRenderingEnabled(false);
label_->SetFontList(base_font_list.Derive(8 /*size_delta*/,
@ -249,7 +249,7 @@ class LoginPinView::DigitPinButton : public BasePinButton {
label_->SetEnabledColor(kColorAshIconColorPrimary);
if (show_sub_label) {
sub_label_ = AddChildView(new views::Label(
sub_label_ = AddChildViewRaw(new views::Label(
GetButtonSubLabelForNumber(value), views::style::CONTEXT_BUTTON,
views::style::STYLE_SECONDARY));
sub_label_->SetAutoColorReadabilityEnabled(false);
@ -285,7 +285,7 @@ class LoginPinView::BackspacePinButton : public BasePinButton {
l10n_util::GetStringUTF16(
IDS_ASH_PIN_KEYBOARD_DELETE_ACCESSIBLE_NAME),
on_press) {
image_ = AddChildView(new views::ImageView());
image_ = AddChildViewRaw(new views::ImageView());
SetEnabled(false);
}

@ -56,8 +56,8 @@ class LoginPublicAccountUserViewTest : public LoginTestBase {
auto* container = new views::View();
container->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical));
container->AddChildView(public_account_view_.get());
container->AddChildView(focusable_view_.get());
container->AddChildViewRaw(public_account_view_.get());
container->AddChildViewRaw(focusable_view_.get());
SetWidget(CreateWidgetWithContent(container));
}

@ -166,7 +166,7 @@ LoginRemoveAccountDialog::LoginRemoveAccountDialog(
container->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical, gfx::Insets(),
kVerticalMarginUsernameMailDp));
AddChildView(container);
AddChildViewRaw(container);
username_label_ =
container->AddChildView(login_views_utils::CreateThemedBubbleLabel(
display_username, nullptr,
@ -229,7 +229,7 @@ LoginRemoveAccountDialog::LoginRemoveAccountDialog(
base::Unretained(this)),
this);
remove_user_button_->SetID(kRemoveUserButtonIdForTest);
AddChildView(remove_user_button_.get());
AddChildViewRaw(remove_user_button_.get());
// Traps the focus on the remove user button.
focus_search_ = std::make_unique<TrappedFocusSearch>(remove_user_button_);

@ -65,7 +65,7 @@ TEST_F(LoginRemoveAccountDialogTest, RemoveUserRequiresTwoActivations) {
&remove_warning_called),
base::BindRepeating([](bool* remove_called) { *remove_called = true; },
&remove_called));
anchor->AddChildView(bubble);
anchor->AddChildViewRaw(bubble);
bubble->Show();
@ -180,7 +180,7 @@ TEST_F(LoginRemoveAccountDialogTest, LongUserNameAndEmailLaidOutCorrectly) {
login_user_info, anchor->AsWeakPtr(), nullptr /*bubble_opener*/,
base::DoNothing(), base::DoNothing());
anchor->AddChildView(bubble);
anchor->AddChildViewRaw(bubble);
bubble->Show();
EXPECT_TRUE(bubble->GetVisible());
@ -219,7 +219,7 @@ TEST_F(LoginRemoveAccountDialogTest, LoginButtonRipple) {
bubble_opener->SetPreferredSize(
gfx::Size(kBubbleAnchorViewSizeDp, kBubbleAnchorViewSizeDp));
container->AddChildView(bubble_opener);
container->AddChildViewRaw(bubble_opener);
SetWidget(CreateWidgetWithContent(container));
views::test::InkDropHostTestApi ink_drop_api(
@ -231,7 +231,7 @@ TEST_F(LoginRemoveAccountDialogTest, LoginButtonRipple) {
LoginUserInfo(), container->AsWeakPtr() /*anchor*/, bubble_opener,
base::DoNothing(), base::DoNothing());
container->AddChildView(bubble);
container->AddChildViewRaw(bubble);
bubble->Show();
EXPECT_TRUE(bubble->GetVisible());
@ -258,7 +258,7 @@ TEST_F(LoginRemoveAccountDialogTest, ResetStateHidesConfirmData) {
auto* bubble = new LoginRemoveAccountDialog(
login_user_info, nullptr /*anchor*/, nullptr /*bubble_opener*/,
base::DoNothing(), base::DoNothing());
container->AddChildView(bubble);
container->AddChildViewRaw(bubble);
bubble->Show();
@ -281,7 +281,7 @@ TEST_F(LoginRemoveAccountDialogTest, AccessibleRole) {
auto* dialog = new LoginRemoveAccountDialog(
login_user_info, nullptr /*anchor*/, nullptr /*bubble_opener*/,
base::DoNothing(), base::DoNothing());
container->AddChildView(dialog);
container->AddChildViewRaw(dialog);
ui::AXNodeData data;
dialog->GetViewAccessibility().GetAccessibleNodeData(&data);

@ -168,7 +168,7 @@ class LoginUserView::UserImage : public NonAccessibleView {
const int image_size = GetImageSize(style);
image_ = new AnimatedRoundedImageView(gfx::Size(image_size, image_size),
image_size / 2);
AddChildView(image_.get());
AddChildViewRaw(image_.get());
enterprise_icon_container_ = AddChildView(std::make_unique<views::View>());
const int icon_size = GetIconSize(style);
enterprise_icon_container_->SetLayoutManager(
@ -304,7 +304,7 @@ class LoginUserView::UserLabel : public NonAccessibleView {
break;
}
AddChildView(user_name_.get());
AddChildViewRaw(user_name_.get());
}
UserLabel(const UserLabel&) = delete;
@ -708,10 +708,10 @@ void LoginUserView::SetLargeLayout() {
kVerticalSpacingBetweenEntriesDp)
.AddRows(1, views::TableLayout::kFixedSize);
AddChildView(tap_button_.get());
AddChildViewRaw(tap_button_.get());
tap_button_->SetProperty(views::kViewIgnoredByLayoutKey, true);
AddChildView(user_image_.get());
AddChildViewRaw(user_image_.get());
user_image_->SetProperty(views::kTableColAndRowSpanKey, gfx::Size(5, 1));
user_image_->SetProperty(views::kTableHorizAlignKey,
views::LayoutAlignment::kCenter);
@ -721,10 +721,10 @@ void LoginUserView::SetLargeLayout() {
skip_column->SetPreferredSize(dropdown_->GetPreferredSize());
}
AddChildView(user_label_.get());
AddChildViewRaw(user_label_.get());
if (dropdown_) {
AddChildView(dropdown_.get());
AddChildViewRaw(dropdown_.get());
}
}
@ -732,11 +732,11 @@ void LoginUserView::SetSmallishLayout() {
SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kHorizontal, gfx::Insets(),
kSmallManyDistanceFromUserIconToUserLabelDp));
AddChildView(tap_button_.get());
AddChildViewRaw(tap_button_.get());
tap_button_->SetProperty(views::kViewIgnoredByLayoutKey, true);
AddChildView(user_image_.get());
AddChildView(user_label_.get());
AddChildViewRaw(user_image_.get());
AddChildViewRaw(user_label_.get());
}
BEGIN_METADATA(LoginUserView)

@ -48,7 +48,7 @@ class LoginUserViewUnittest : public LoginTestBase {
LoginUserInfo user =
public_account ? CreatePublicAccountUser(email) : CreateUser(email);
view->UpdateForUser(user, false /*animate*/);
container_->AddChildView(view);
container_->AddChildViewRaw(view);
container_->InvalidateLayout();
views::test::RunScheduledLayout(widget());
return view;
@ -65,7 +65,7 @@ class LoginUserViewUnittest : public LoginTestBase {
auto* root = new views::View();
root->SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kHorizontal));
root->AddChildView(container_.get());
root->AddChildViewRaw(container_.get());
SetWidget(CreateWidgetWithContent(root));
}

@ -235,7 +235,7 @@ PinRequestView::PinRequestView(PinRequest request, Delegate* delegate)
const ui::ColorId icon_color_id = cros_tokens::kCrosSysOnSurface;
icon->SetImage(ui::ImageModel::FromVectorIcon(
kPinRequestLockIcon, icon_color_id, kLockIconSizeDp));
icon_view->AddChildView(icon);
icon_view->AddChildViewRaw(icon);
// Back button. Note that it should be the last view added to |header| in
// order to be clickable.
@ -266,7 +266,7 @@ PinRequestView::PinRequestView(PinRequest request, Delegate* delegate)
back_button_->GetViewAccessibility().SetName(
l10n_util::GetStringUTF16(IDS_ASH_LOGIN_BACK_BUTTON_ACCESSIBLE_NAME));
back_button_->SetFocusBehavior(FocusBehavior::ALWAYS);
back_button_view->AddChildView(back_button_.get());
back_button_view->AddChildViewRaw(back_button_.get());
auto add_spacer = [&](int height) {
auto* spacer = new NonAccessibleView();
@ -295,7 +295,7 @@ PinRequestView::PinRequestView(PinRequest request, Delegate* delegate)
kTitleFontSizeDeltaDp, gfx::Font::NORMAL, gfx::Font::Weight::MEDIUM));
decorate_label(title_label_);
title_label_->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
AddChildView(title_label_.get());
AddChildViewRaw(title_label_.get());
add_spacer(kTitleToDescriptionDistanceDp);
@ -312,7 +312,7 @@ PinRequestView::PinRequestView(PinRequest request, Delegate* delegate)
gfx::Font::Weight::NORMAL));
description_label_->SetEnabledColor(cros_tokens::kCrosSysOnSurface);
decorate_label(description_label_);
AddChildView(description_label_.get());
AddChildViewRaw(description_label_.get());
add_spacer(kDescriptionToAccessCodeDistanceDp);
@ -353,7 +353,7 @@ PinRequestView::PinRequestView(PinRequest request, Delegate* delegate)
/*on_submit=*/LoginPinView::OnPinSubmit());
// Backspace key is always enabled and |access_code_| field handles it.
pin_keyboard_view_->OnPasswordTextChanged(false);
AddChildView(pin_keyboard_view_.get());
AddChildViewRaw(pin_keyboard_view_.get());
add_spacer(kPinKeyboardToFooterDistanceDp);
@ -375,7 +375,7 @@ PinRequestView::PinRequestView(PinRequest request, Delegate* delegate)
help_button_->SetTextSubpixelRenderingEnabled(false);
help_button_->SetEnabledTextColors(cros_tokens::kCrosSysSecondary);
help_button_->SetVisible(request.help_button_enabled);
footer->AddChildView(help_button_.get());
footer->AddChildViewRaw(help_button_.get());
auto* horizontal_spacer = new NonAccessibleView();
footer->AddChildView(horizontal_spacer);
@ -389,7 +389,7 @@ PinRequestView::PinRequestView(PinRequest request, Delegate* delegate)
static_cast<IconButton*>(submit_button_)->SetToggled(true);
submit_button_->SetEnabled(false);
submit_button_->SetFocusBehavior(FocusBehavior::ALWAYS);
footer->AddChildView(submit_button_.get());
footer->AddChildViewRaw(submit_button_.get());
add_spacer(kSubmitButtonBottomMarginDp);
pin_keyboard_view_->SetVisible(PinKeyboardVisible());

@ -76,7 +76,7 @@ PinStatusMessageView::PinStatusMessageView(OnPinUnlock on_pin_unlock)
message_->SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
message_->GetViewAccessibility().SetName(
std::u16string(), ax::mojom::NameFrom::kAttributeExplicitlyEmpty);
AddChildView(message_.get());
AddChildViewRaw(message_.get());
}
PinStatusMessageView::~PinStatusMessageView() {

@ -96,8 +96,8 @@ PublicAccountMonitoringInfoDialog::PublicAccountMonitoringInfoDialog(
gfx::Size(kBulletContainerSizeDp, kBulletContainerSizeDp));
container->AddChildView(bullet_view);
container->AddChildView(label);
AddChildView(container);
container->AddChildViewRaw(label);
AddChildViewRaw(container);
};
add_bulleted_label(l10n_util::GetStringUTF16(

@ -195,7 +195,7 @@ ScrollableUsersListView::ScrollableUsersListView(
base::RepeatingClosure());
user_views_.push_back(view);
view->UpdateForUser(users[i], false /*animate*/);
user_view_host_->AddChildView(view);
user_view_host_->AddChildViewRaw(view);
}
// |user_view_host_| is the same size as the user views, which may be shorter
@ -216,7 +216,7 @@ ScrollableUsersListView::ScrollableUsersListView(
views::BoxLayout::MainAxisAlignment::kCenter);
ensure_min_height_layout->set_cross_axis_alignment(
views::BoxLayout::MainAxisAlignment::kStart);
ensure_min_height->AddChildView(user_view_host_.get());
ensure_min_height->AddChildViewRaw(user_view_host_.get());
SetContents(std::move(ensure_min_height));
SetBackgroundColor(std::nullopt);
SetDrawOverflowIndicator(false);

@ -405,7 +405,7 @@ SearchBoxViewBase::SearchBoxViewBase()
content_container_->SetFlexForView(text_container_, 1,
/*use_min_size=*/false);
text_container_->AddChildView(search_box_.get());
text_container_->AddChildViewRaw(search_box_.get());
ghost_text_container_ =
text_container_->AddChildView(std::make_unique<views::BoxLayoutView>());
ghost_text_container_->SetCrossAxisAlignment(

@ -82,8 +82,8 @@ void MultiprofilesIntroDialog::InitDialog() {
l10n_util::GetStringUTF16(IDS_ASH_MULTIPROFILES_INTRO_MESSAGE));
label->SetMultiLine(true);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
AddChildView(label);
AddChildView(never_show_again_checkbox_.get());
AddChildViewRaw(label);
AddChildViewRaw(never_show_again_checkbox_.get());
}
} // namespace ash

@ -90,7 +90,7 @@ void SessionAbortedDialog::InitDialog(const std::string& user_email) {
label->SetMultiLine(true);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label->SetAllowCharacterBreak(true);
AddChildView(label);
AddChildViewRaw(label);
}
} // namespace ash

@ -82,8 +82,8 @@ void TeleportWarningDialog::InitDialog() {
l10n_util::GetStringUTF16(IDS_ASH_TELEPORT_WARNING_MESSAGE));
label->SetMultiLine(true);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
AddChildView(label);
AddChildView(never_show_again_checkbox_.get());
AddChildViewRaw(label);
AddChildViewRaw(never_show_again_checkbox_.get());
}
} // namespace ash

@ -204,7 +204,7 @@ void HomeButtonController::OnAppListDismissed() {
void HomeButtonController::InitializeAssistantOverlay() {
DCHECK_EQ(nullptr, tap_overlay_);
tap_overlay_ = new HomeButtonTapOverlay(button_);
button_->AddChildView(tap_overlay_.get());
button_->AddChildViewRaw(tap_overlay_.get());
tap_overlay_->SetVisible(false);
tap_animation_delay_timer_ = std::make_unique<base::OneShotTimer>();
}

@ -473,7 +473,7 @@ ShelfAppButton::ShelfAppButton(ShelfView* shelf_view,
indicator_->SetPaintToLayer();
indicator_->layer()->SetFillsBoundsOpaquely(false);
AddChildView(indicator_.get());
AddChildViewRaw(indicator_.get());
notification_indicator_ =
AddChildView(std::make_unique<DotIndicator>(kDefaultIndicatorColor));

@ -22,7 +22,7 @@ void ShelfContainerView::Initialize() {
shelf_view_->SetPaintToLayer(ui::LAYER_NOT_DRAWN);
shelf_view_->layer()->SetFillsBoundsOpaquely(false);
AddChildView(shelf_view_.get());
AddChildViewRaw(shelf_view_.get());
}
gfx::Size ShelfContainerView::CalculateIdealSize(int button_size) const {

@ -371,7 +371,7 @@ ShelfView::ShelfView(ShelfModel* model,
SetProperty(views::kElementIdentifierKey, kShelfViewElementId);
announcement_view_ = new views::View();
AddChildView(announcement_view_.get());
AddChildViewRaw(announcement_view_.get());
GetViewAccessibility().SetRole(ax::mojom::Role::kToolbar);
GetViewAccessibility().SetName(

@ -48,10 +48,10 @@ WindowPreview::WindowPreview(aura::Window* window, Delegate* delegate)
&WindowPreview::CloseButtonPressed, base::Unretained(this)));
close_button_->SetFocusBehavior(FocusBehavior::NEVER);
AddChildView(preview_container_view_.get());
AddChildView(preview_view_.get());
AddChildView(title_.get());
AddChildView(close_button_.get());
AddChildViewRaw(preview_container_view_.get());
AddChildViewRaw(preview_view_.get());
AddChildViewRaw(title_.get());
AddChildViewRaw(close_button_.get());
}
WindowPreview::~WindowPreview() = default;

@ -209,7 +209,7 @@ void TabSlider::AddButtonInternal(TabSliderButton* button) {
// Add the button as a child of the tab slider and insert it in the
// `buttons_` list.
AddChildView(button);
AddChildViewRaw(button);
buttons_.emplace_back(button);
button->AddedToSlider(this);
}

@ -50,7 +50,7 @@ AccessibilityFeatureDisableDialog::AccessibilityFeatureDisableDialog(
l10n_util::GetStringUTF16(window_title_text_id),
views::style::CONTEXT_DIALOG_BODY_TEXT, views::style::STYLE_PRIMARY);
body_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
AddChildView(body_label.release());
AddChildViewRaw(body_label.release());
set_margins(views::LayoutProvider::Get()->GetDialogInsetsForContentType(
views::DialogContentType::kText, views::DialogContentType::kText));

@ -198,7 +198,7 @@ void AutoclickMenuBubbleController::ShowBubble(AutoclickEventType type,
menu_view_ = new AutoclickMenuView(type, position);
menu_view_->SetBorder(views::CreateEmptyBorder(
gfx::Insets::TLBR(kUnifiedTopShortcutSpacing, 0, 0, 0)));
bubble_view_->AddChildView(menu_view_.get());
bubble_view_->AddChildViewRaw(menu_view_.get());
bubble_widget_ = views::BubbleDialogDelegateView::CreateBubble(bubble_view_);
TrayBackgroundView::InitializeBubbleAnimations(bubble_widget_);

@ -217,7 +217,7 @@ void AutoclickScrollBubbleController::ShowBubble(
scroll_view_ = new AutoclickScrollView();
scroll_view_->SetBorder(views::CreateEmptyBorder(
gfx::Insets::TLBR(kUnifiedTopShortcutSpacing, 0, 0, 0)));
bubble_view_->AddChildView(scroll_view_.get());
bubble_view_->AddChildViewRaw(scroll_view_.get());
bubble_widget_ = views::BubbleDialogDelegateView::CreateBubble(bubble_view_);
TrayBackgroundView::InitializeBubbleAnimations(bubble_widget_);

@ -104,7 +104,7 @@ void FloatingAccessibilityController::Show(FloatingMenuPosition position) {
menu_view_ = new FloatingAccessibilityView(this);
menu_view_->SetBorder(views::CreateEmptyBorder(
gfx::Insets::TLBR(kUnifiedTopShortcutSpacing, 0, 0, 0)));
bubble_view_->AddChildView(menu_view_.get());
bubble_view_->AddChildViewRaw(menu_view_.get());
bubble_view_->SetFocusBehavior(views::View::FocusBehavior::ACCESSIBLE_ONLY);
bubble_widget_ = views::BubbleDialogDelegateView::CreateBubble(bubble_view_);

@ -66,7 +66,7 @@ void SelectToSpeakMenuBubbleController::Show(const gfx::Rect& anchor,
menu_view_ = new SelectToSpeakMenuView(this);
menu_view_->SetBorder(views::CreateEmptyBorder(
gfx::Insets::TLBR(kUnifiedTopShortcutSpacing, 0, 0, 0)));
bubble_view_->AddChildView(menu_view_.get());
bubble_view_->AddChildViewRaw(menu_view_.get());
menu_view_->SetSpeedButtonToggled(false);
bubble_widget_ =

@ -66,7 +66,7 @@ void SelectToSpeakSpeedBubbleController::Show(views::View* anchor_view,
bubble_view_->SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
speed_view_ = new SelectToSpeakSpeedView(this, speech_rate);
bubble_view_->AddChildView(speed_view_.get());
bubble_view_->AddChildViewRaw(speed_view_.get());
bubble_widget_ =
views::BubbleDialogDelegateView::CreateBubble(bubble_view_);

@ -48,7 +48,7 @@ void SwitchAccessBackButtonBubbleController::ShowBackButton(
bubble_view_ = new TrayBubbleView(init_params);
bubble_view_->SetArrow(views::BubbleBorder::BOTTOM_RIGHT);
bubble_view_->AddChildView(back_button_view_.get());
bubble_view_->AddChildViewRaw(back_button_view_.get());
// Only call `SetPaintToLayer()` when necessary since a layer could have
// been created for `ViewShadow` and re-creating here breaks the z-order set

@ -55,7 +55,7 @@ void SwitchAccessMenuBubbleController::ShowMenu(
menu_view_ = new SwitchAccessMenuView();
menu_view_->SetBorder(views::CreateEmptyBorder(kBubbleMenuPadding));
bubble_view_->AddChildView(menu_view_.get());
bubble_view_->AddChildViewRaw(menu_view_.get());
widget_ = views::BubbleDialogDelegateView::CreateBubble(bubble_view_);
TrayBackgroundView::InitializeBubbleAnimations(widget_);

@ -260,7 +260,7 @@ void AudioDetailedView::AddAudioSubHeader(views::View* container,
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosBody2,
*sub_header_label_);
sub_header_label_->SetBorder(views::CreateEmptyBorder(kTextRowInsets));
container->AddChildView(sub_header_label_);
container->AddChildViewRaw(sub_header_label_);
return;
}

@ -42,7 +42,7 @@ views::View* FakeBluetoothDetailedView::AddDeviceListSubHeader(
std::unique_ptr<TriView> sub_header = std::make_unique<TriView>();
sub_header->AddView(TriView::Container::CENTER,
new views::Label(l10n_util::GetStringUTF16(text_id)));
device_list_->AddChildView(sub_header.get());
device_list_->AddChildViewRaw(sub_header.get());
return sub_header.release();
}

@ -79,7 +79,7 @@ class ImeListItemView : public views::Button {
TriView* tri_view = TrayPopupUtils::CreateDefaultRowView(
/*use_wide_layout=*/true);
AddChildView(tri_view);
AddChildViewRaw(tri_view);
SetLayoutManager(std::make_unique<views::FillLayout>());
// |id_label| contains the IME short name (e.g., 'US', 'GB', 'IT').
@ -177,7 +177,7 @@ class KeyboardStatusRow : public views::View {
TriView* tri_view = TrayPopupUtils::CreateDefaultRowView(
/*use_wide_layout=*/true);
AddChildView(tri_view);
AddChildViewRaw(tri_view);
// The on-screen keyboard image button.
views::ImageView* keyboard_image =
@ -309,7 +309,8 @@ void ImeListView::AppendImeListAndProperties(
// Add the properties, if any, of the currently-selected IME.
if (selected && !property_list.empty()) {
// Adds a separator on the top of property items.
container_->AddChildView(TrayPopupUtils::CreateListItemSeparator(true));
container_->AddChildViewRaw(
TrayPopupUtils::CreateListItemSeparator(true));
// Adds the property items.
for (const auto& property : property_list) {
@ -324,7 +325,8 @@ void ImeListView::AppendImeListAndProperties(
// Adds a separator on the bottom of property items if there are still
// other IMEs under the current one.
if (i < list.size() - 1) {
container_->AddChildView(TrayPopupUtils::CreateListItemSeparator(true));
container_->AddChildViewRaw(
TrayPopupUtils::CreateListItemSeparator(true));
}
}
}

@ -291,7 +291,7 @@ class ImeButtonsView : public views::View {
input_method::ImeKeyset::kEmoji),
kImeMenuEmoticonIcon, IDS_ASH_STATUS_TRAY_IME_EMOJI);
emoji_button_->SetID(kEmojiButtonId);
AddChildView(emoji_button_.get());
AddChildViewRaw(emoji_button_.get());
}
if (show_handwriting) {
@ -300,7 +300,7 @@ class ImeButtonsView : public views::View {
base::Unretained(this),
input_method::ImeKeyset::kHandwriting),
kImeMenuWriteIcon, IDS_ASH_STATUS_TRAY_IME_HANDWRITING);
AddChildView(handwriting_button_.get());
AddChildViewRaw(handwriting_button_.get());
}
if (show_voice) {
@ -310,7 +310,7 @@ class ImeButtonsView : public views::View {
input_method::ImeKeyset::kVoice),
kImeMenuMicrophoneIcon, IDS_ASH_STATUS_TRAY_IME_VOICE);
voice_button_->SetID(kVoiceButtonId);
AddChildView(voice_button_.get());
AddChildViewRaw(voice_button_.get());
}
}
@ -655,7 +655,7 @@ void ImeMenuTray::CreateLabel() {
label_->SetElideBehavior(gfx::TRUNCATE);
label_->SetCustomTooltipText(
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_IME));
tray_container()->AddChildView(label_.get());
tray_container()->AddChildViewRaw(label_.get());
}
void ImeMenuTray::CreateImageView() {
@ -671,7 +671,7 @@ void ImeMenuTray::CreateImageView() {
image_view_ = new ImeMenuImageView();
image_view_->SetTooltipText(
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_IME));
tray_container()->AddChildView(image_view_.get());
tray_container()->AddChildViewRaw(image_view_.get());
}
void ImeMenuTray::UpdateTrayImageOrLabelColor(bool is_image) {

@ -57,7 +57,7 @@ class LocaleItemView : public views::Button {
TriView* tri_view = TrayPopupUtils::CreateDefaultRowView(
/*use_wide_layout=*/false);
AddChildView(tri_view);
AddChildViewRaw(tri_view);
SetLayoutManager(std::make_unique<views::FillLayout>());
views::Label* iso_code_label = TrayPopupUtils::CreateDefaultLabel();
@ -144,7 +144,7 @@ void LocaleDetailedView::CreateItems() {
Shell::Get()->system_tray_model()->locale()->current_locale_iso_code();
auto* item =
new LocaleItemView(this, entry.iso_code, entry.display_name, checked);
container->AddChildView(item);
container->AddChildViewRaw(item);
item->SetID(id);
id_to_locale_[id] = entry.iso_code;
++id;

@ -96,7 +96,7 @@ NetworkInfoBubble::NetworkInfoBubble(base::WeakPtr<Delegate> delegate,
label->SetMultiLine(true);
label->SetSelectable(true);
AddChildView(label.release());
AddChildViewRaw(label.release());
}
NetworkInfoBubble::~NetworkInfoBubble() {
@ -163,9 +163,9 @@ std::u16string NetworkInfoBubble::ComputeInfoText() {
address_label->SetEnabledColor(cros_tokens::kCrosSysOnSurfaceVariant);
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosBody2,
*address_label);
container->AddChildView(title_label.release());
container->AddChildView(address_label.release());
label_container->AddChildView(container.release());
container->AddChildViewRaw(title_label.release());
container->AddChildViewRaw(address_label.release());
label_container->AddChildViewRaw(container.release());
};
const NetworkStateProperties* default_network = Shell::Get()

@ -137,7 +137,7 @@ class NetworkStateListDetailedView::InfoBubble
set_shadow(views::BubbleBorder::NO_SHADOW);
SetNotifyEnterExitOnChild(true);
SetLayoutManager(std::make_unique<views::FillLayout>());
AddChildView(content);
AddChildViewRaw(content);
}
InfoBubble(const InfoBubble&) = delete;

@ -185,7 +185,7 @@ class VPNListProviderEntry : public views::Button {
TrayPopupUtils::CreateDefaultRowView(/*use_wide_layout=*/true);
tri_view->SetInsets(kProviderTriViewInsets);
tri_view->SetContainerVisible(TriView::Container::START, false);
AddChildView(tri_view);
AddChildViewRaw(tri_view);
// Add the VPN label with the provider name.
views::Label* label = TrayPopupUtils::CreateDefaultLabel();
@ -463,7 +463,7 @@ void VpnDetailedView::RegisterProfilePrefs(PrefRegistrySimple* registry) {
void VpnDetailedView::AddNetwork(const NetworkStateProperties* network,
views::View* container) {
views::View* entry(new VPNListNetworkEntry(this, model(), network));
container->AddChildView(entry);
container->AddChildViewRaw(entry);
network_view_guid_map_[entry] = network->guid;
list_empty_ = false;
}

@ -113,7 +113,7 @@ void NotificationCenterView::AddChildViews(
scroller_->layer()->SetRoundedCornerRadius(gfx::RoundedCornersF{
static_cast<float>(kMessageCenterScrollViewCornerRadius)});
AddChildView(scroller_.get());
AddChildViewRaw(scroller_.get());
// Make sure the scroll view takes up the entirety of available height in the
// notification center view. We're relying on a max height constraint
@ -126,7 +126,7 @@ void NotificationCenterView::AddChildViews(
scroller_->AddContentsScrolledCallback(base::BindRepeating(
&NotificationCenterView::OnContentsScrolled, base::Unretained(this)));
AddChildView(notification_bar_.get());
AddChildViewRaw(notification_bar_.get());
}
bool NotificationCenterView::UpdateNotificationBar() {

@ -180,7 +180,7 @@ END_METADATA
NotifierButtonWrapperView::NotifierButtonWrapperView(views::View* contents)
: focus_painter_(TrayPopupUtils::CreateFocusPainter()),
contents_(contents) {
AddChildView(contents);
AddChildViewRaw(contents);
// We add callbacks so that whenever the a11y attributes of `contents_`
// change, we update the a11y attributes for `this`.
@ -422,7 +422,7 @@ class EmptyNotifierView : public views::View {
message_center_style::kEmptyIconSize));
icon->SetBorder(
views::CreateEmptyBorder(message_center_style::kEmptyIconPadding));
AddChildView(icon);
AddChildViewRaw(icon);
views::Label* label = new views::Label(
l10n_util::GetStringUTF16(IDS_ASH_MESSAGE_CENTER_NO_NOTIFIERS));
@ -432,7 +432,7 @@ class EmptyNotifierView : public views::View {
// "Roboto-Medium, 12sp" is specified in the mock.
label->SetFontList(
gfx::FontList().DeriveWithWeight(gfx::Font::Weight::MEDIUM));
label_ = AddChildView(label);
label_ = AddChildViewRaw(label);
}
EmptyNotifierView(const EmptyNotifierView&) = delete;
@ -995,7 +995,7 @@ void NotifierSettingsView::OnNotifiersUpdated(
NotifierButtonWrapperView* wrapper = new NotifierButtonWrapperView(button);
wrapper->SetFocusBehavior(FocusBehavior::ALWAYS);
contents_view->AddChildView(wrapper);
contents_view->AddChildViewRaw(wrapper);
buttons_.insert(button);
}

@ -73,7 +73,7 @@ OverviewButtonTray::OverviewButtonTray(Shelf* shelf)
const int horizontal_padding = (kTrayItemSize - image.width()) / 2;
icon_->SetBorder(views::CreateEmptyBorder(
gfx::Insets::VH(vertical_padding, horizontal_padding)));
tray_container()->AddChildView(icon_.get());
tray_container()->AddChildViewRaw(icon_.get());
// Since OverviewButtonTray is located on the rightmost position of a
// horizontal shelf, no separator is required.

@ -568,7 +568,7 @@ void PaletteTray::ShowBubble() {
// Add palette tools.
std::vector<PaletteToolView> views = palette_tool_manager_->CreateViews();
for (const PaletteToolView& view : views) {
bubble_view->AddChildView(view.view.get());
bubble_view->AddChildViewRaw(view.view.get());
}
// Show the bubble.

@ -113,7 +113,7 @@ void CameraRollView::CameraRollItemsView::AddCameraRollItem(
views::View* camera_roll_item) {
size_t view_size = camera_roll_items_.view_size();
camera_roll_items_.Add(camera_roll_item, view_size);
AddChildView(camera_roll_item);
AddChildViewRaw(camera_roll_item);
}
void CameraRollView::CameraRollItemsView::Reset() {

@ -129,7 +129,7 @@ void PhoneHubMoreAppsButton::StartLoadingAnimation(
RemoveAllChildViews();
for (size_t i = 0; i < 4; i++) {
AppLoadingIcon* app_loading_icon =
AddChildView(new AppLoadingIcon(AppIcon::kSizeSmall));
AddChildViewRaw(new AppLoadingIcon(AppIcon::kSizeSmall));
app_loading_icons_.push_back(app_loading_icon);
size_t x = i % 2;

@ -314,9 +314,9 @@ PhoneHubRecentAppsView::LoadingView::LoadingView() {
for (size_t i = 0; i < 5; i++) {
app_loading_icons_.push_back(
AddChildView(new AppLoadingIcon(AppIcon::kSizeNormal)));
AddChildViewRaw(new AppLoadingIcon(AppIcon::kSizeNormal)));
}
more_apps_button_ = AddChildView(new PhoneHubMoreAppsButton());
more_apps_button_ = AddChildViewRaw(new PhoneHubMoreAppsButton());
StartLoadingAnimation();
}

@ -39,18 +39,18 @@ void QuickActionsView::InitQuickActionItems() {
auto enable_hotspot_controller =
std::make_unique<EnableHotspotQuickActionController>(
phone_hub_manager_->GetTetherController());
enable_hotspot_ = AddChildView(enable_hotspot_controller->CreateItem());
enable_hotspot_ = AddChildViewRaw(enable_hotspot_controller->CreateItem());
quick_action_controllers_.push_back(std::move(enable_hotspot_controller));
auto silence_phone_controller =
std::make_unique<SilencePhoneQuickActionController>(
phone_hub_manager_->GetDoNotDisturbController());
silence_phone_ = AddChildView(silence_phone_controller->CreateItem());
silence_phone_ = AddChildViewRaw(silence_phone_controller->CreateItem());
auto locate_phone_controller =
std::make_unique<LocatePhoneQuickActionController>(
phone_hub_manager_->GetFindMyDeviceController());
locate_phone_ = AddChildView(locate_phone_controller->CreateItem());
locate_phone_ = AddChildViewRaw(locate_phone_controller->CreateItem());
quick_action_controllers_.push_back(std::move(silence_phone_controller));
quick_action_controllers_.push_back(std::move(locate_phone_controller));

@ -104,7 +104,7 @@ TaskContinuationView::TaskChipsView::~TaskChipsView() = default;
void TaskContinuationView::TaskChipsView::AddTaskChip(views::View* task_chip) {
size_t view_size = task_chips_.view_size();
task_chips_.Add(task_chip, view_size);
AddChildView(task_chip);
AddChildViewRaw(task_chip);
}
// views::View:

@ -139,10 +139,10 @@ PowerButtonMenuScreenView::PowerButtonMenuScreenView(
power_button_offset_percentage_(power_button_offset_percentage) {
power_button_screen_background_shield_ =
new PowerButtonMenuBackgroundView(show_animation_done);
AddChildView(power_button_screen_background_shield_.get());
AddChildViewRaw(power_button_screen_background_shield_.get());
power_button_menu_view_ =
new PowerButtonMenuView(shutdown_reason, power_button_position_);
AddChildView(power_button_menu_view_.get());
AddChildViewRaw(power_button_menu_view_.get());
AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE));
}

@ -59,7 +59,7 @@ void PrivacyScreenToastController::ShowToast() {
toast_view_ = new PrivacyScreenToastView(
this, base::BindRepeating(&PrivacyScreenToastController::ButtonPressed,
base::Unretained(this)));
bubble_view_->AddChildView(toast_view_.get());
bubble_view_->AddChildViewRaw(toast_view_.get());
bubble_widget_ = views::BubbleDialogDelegateView::CreateBubble(bubble_view_);

@ -69,8 +69,8 @@ class PrivacyScreenToastManagedView : public views::View {
icon->SetImage(
ui::ImageModel::FromVectorIcon(kSystemTrayManagedIcon, icon_color));
AddChildView(label);
AddChildView(icon);
AddChildViewRaw(label);
AddChildViewRaw(icon);
}
~PrivacyScreenToastManagedView() override = default;
@ -92,8 +92,8 @@ class PrivacyScreenToastLabelView : public views::View {
label_ = new views::Label();
managed_view_ = new PrivacyScreenToastManagedView();
AddChildView(label_.get());
AddChildView(managed_view_.get());
AddChildViewRaw(label_.get());
AddChildViewRaw(managed_view_.get());
const AshColorProvider* color_provider = AshColorProvider::Get();
const SkColor primary_text_color = color_provider->GetContentLayerColor(
@ -140,10 +140,10 @@ PrivacyScreenToastView::PrivacyScreenToastView(
button_->SetVectorIcon(kPrivacyScreenIcon);
button_->SetToggled(false);
button_->AddObserver(this);
AddChildView(button_.get());
AddChildViewRaw(button_.get());
label_ = new PrivacyScreenToastLabelView();
AddChildView(label_.get());
AddChildViewRaw(label_.get());
}
PrivacyScreenToastView::~PrivacyScreenToastView() {

@ -58,7 +58,7 @@ LogoutConfirmationDialog::LogoutConfirmationDialog(
label_ = new views::Label;
label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label_->SetMultiLine(true);
AddChildView(label_.get());
AddChildViewRaw(label_.get());
UpdateLabel();

@ -56,7 +56,7 @@ ShutdownConfirmationDialog::ShutdownConfirmationDialog(
label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label_->SetMultiLine(true);
label_->SetText(l10n_util::GetStringUTF16(dialog_text_id));
AddChildView(label_.get());
AddChildViewRaw(label_.get());
// Parent the dialog widget to the PowerButtonAnimationContainer
int container_id = kShellWindowId_PowerButtonAnimationContainer;

@ -536,7 +536,7 @@ CalendarView::CalendarView(bool use_glanceables_container_style)
kContentHorizontalPadding - kChevronPadding)));
tri_view->AddView(TriView::Container::START, CreateMonthHeaderContainer());
tri_view->AddView(TriView::Container::END, CreateButtonContainer());
AddChildView(tri_view);
AddChildViewRaw(tri_view);
}
// Add month header.
@ -669,7 +669,7 @@ views::View* CalendarView::CreateCalendarHeaderRow() {
calendar_header_view->SetContainerBorder(
TriView::Container::START, views::CreateEmptyBorder(kHeaderLabelBorder));
calendar_header_view->SetMinHeight(kHeaderViewHeight);
return AddChildView(calendar_header_view);
return AddChildViewRaw(calendar_header_view);
}
void CalendarView::CreateCalendarTitleRow() {

@ -164,7 +164,7 @@ void HoverHighlightView::AddViewAndLabel(std::unique_ptr<views::View> view,
SetLayoutManager(std::make_unique<views::FillLayout>());
tri_view_ = TrayPopupUtils::CreateDefaultRowView(
/*use_wide_layout=*/true);
AddChildView(tri_view_.get());
AddChildViewRaw(tri_view_.get());
left_view_ = view.get();
tri_view_->AddView(TriView::Container::START, view.release());
@ -195,7 +195,7 @@ void HoverHighlightView::AddLabelRow(const std::u16string& text) {
SetLayoutManager(std::make_unique<views::FillLayout>());
tri_view_ = TrayPopupUtils::CreateDefaultRowView(
/*use_wide_layout=*/true);
AddChildView(tri_view_.get());
AddChildViewRaw(tri_view_.get());
text_label_ = TrayPopupUtils::CreateUnfocusableLabel();
text_label_->SetText(text);

@ -293,7 +293,7 @@ TrayBackgroundView::TrayBackgroundView(
views::HighlightPathGenerator::Install(
this, std::make_unique<HighlightPathGenerator>(this));
AddChildView(tray_container_.get());
AddChildViewRaw(tray_container_.get());
// Use layer color to provide background color. Note that children views
// need to have their own layers to be visible.

@ -118,7 +118,7 @@ void TrayItemView::RemoveObserver(Observer* observer) {
void TrayItemView::CreateLabel() {
label_ = new IconizedLabel;
AddChildView(label_.get());
AddChildViewRaw(label_.get());
PreferredSizeChanged();
for (auto& observer : observers_) {
observer.OnTrayItemChildViewChanged();
@ -127,7 +127,7 @@ void TrayItemView::CreateLabel() {
void TrayItemView::CreateImageView() {
image_view_ = new views::ImageView;
AddChildView(image_view_.get());
AddChildViewRaw(image_view_.get());
PreferredSizeChanged();
for (auto& observer : observers_) {
observer.OnTrayItemChildViewChanged();

@ -40,9 +40,9 @@ TriView::TriView(int padding_between_containers)
TriView::TriView(Orientation orientation) : TriView(orientation, 0) {}
TriView::TriView(Orientation orientation, int padding_between_containers) {
start_container_layout_manager_ = AddChildView(new SizeRangeLayout);
center_container_layout_manager_ = AddChildView(new SizeRangeLayout);
end_container_layout_manager_ = AddChildView(new SizeRangeLayout);
start_container_layout_manager_ = AddChildViewRaw(new SizeRangeLayout);
center_container_layout_manager_ = AddChildViewRaw(new SizeRangeLayout);
end_container_layout_manager_ = AddChildViewRaw(new SizeRangeLayout);
auto layout = std::make_unique<views::BoxLayout>(
GetOrientation(orientation), gfx::Insets(), padding_between_containers);
@ -86,7 +86,7 @@ void TriView::SetMaxSize(Container container, const gfx::Size& size) {
}
void TriView::AddView(Container container, views::View* view) {
GetContainer(container)->AddChildView(view);
GetContainer(container)->AddChildViewRaw(view);
}
void TriView::AddViewAt(Container container, views::View* view, int index) {

@ -87,9 +87,9 @@ FeaturePodLabelButton::FeaturePodLabelButton(PressedCallback callback)
detailed_view_arrow_->SetCanProcessEventsWithinSubtree(false);
detailed_view_arrow_->SetVisible(false);
AddChildView(label_.get());
AddChildView(detailed_view_arrow_.get());
AddChildView(sub_label_.get());
AddChildViewRaw(label_.get());
AddChildViewRaw(detailed_view_arrow_.get());
AddChildViewRaw(sub_label_.get());
StyleUtil::SetUpInkDropForButton(this);
@ -241,8 +241,8 @@ FeaturePodButton::FeaturePodButton(FeaturePodControllerBase* controller,
layout->set_cross_axis_alignment(
views::BoxLayout::CrossAxisAlignment::kCenter);
AddChildView(icon_button_.get());
AddChildView(label_button_.get());
AddChildViewRaw(icon_button_.get());
AddChildViewRaw(label_button_.get());
SetPaintToLayer();
layer()->SetFillsBoundsOpaquely(false);

@ -101,7 +101,7 @@ class UserAvatarButton : public views::Button {
: views::Button(std::move(callback)) {
SetLayoutManager(std::make_unique<views::FillLayout>());
SetBorder(views::CreateEmptyBorder(gfx::Insets(0)));
AddChildView(CreateUserAvatarView(/*user_index=*/0));
AddChildViewRaw(CreateUserAvatarView(/*user_index=*/0));
SetTooltipText(GetUserItemAccessibleString(/*user_index=*/0));
SetInstallFocusRingOnFocus(true);
views::FocusRing::Get(this)->SetColorId(cros_tokens::kCrosSysFocusRing);

@ -434,7 +434,7 @@ void UnifiedSystemTray::HandleLocaleChange() {
tray_container()->RemoveAllChildViewsWithoutDeleting();
for (TrayItemView* item : tray_items_) {
item->HandleLocaleChange();
tray_container()->AddChildView(item);
tray_container()->AddChildViewRaw(item);
}
// TrayItemView objects can impact the accessible name.

@ -204,7 +204,7 @@ UserItemButton::UserItemButton(PressedCallback callback,
layout->set_cross_axis_alignment(
views::BoxLayout::CrossAxisAlignment::kCenter);
layout->set_minimum_cross_axis_size(kUnifiedUserChooserRowHeight);
AddChildView(CreateUserAvatarView(user_index));
AddChildViewRaw(CreateUserAvatarView(user_index));
views::View* vertical_labels = new views::View;
vertical_labels->SetCanProcessEventsWithinSubtree(false);
@ -222,7 +222,7 @@ UserItemButton::UserItemButton(PressedCallback callback,
TypographyProvider::Get()->StyleLabel(TypographyToken::kCrosButton2, *name_);
name_->SetAutoColorReadabilityEnabled(false);
name_->SetSubpixelRenderingEnabled(false);
vertical_labels->AddChildView(name_.get());
vertical_labels->AddChildViewRaw(name_.get());
email_->SetText(base::UTF8ToUTF16(user_session->user_info.display_email));
email_->SetEnabledColor(cros_tokens::kCrosSysOnSurfaceVariant);
@ -230,9 +230,9 @@ UserItemButton::UserItemButton(PressedCallback callback,
*email_);
email_->SetAutoColorReadabilityEnabled(false);
email_->SetSubpixelRenderingEnabled(false);
vertical_labels->AddChildView(email_.get());
vertical_labels->AddChildViewRaw(email_.get());
AddChildView(vertical_labels);
AddChildViewRaw(vertical_labels);
layout->SetFlexForView(vertical_labels, 1);
capture_icon_->SetImage(ui::ImageModel::FromVectorIcon(
@ -244,7 +244,7 @@ UserItemButton::UserItemButton(PressedCallback callback,
0, 0, 0, kTrayItemSize + kUnifiedTopShortcutSpacing)));
}
capture_icon_->SetVisible(false);
AddChildView(capture_icon_.get());
AddChildViewRaw(capture_icon_.get());
if (has_close_button) {
AddChildView(std::make_unique<IconButton>(
@ -357,11 +357,11 @@ UserChooserView::UserChooserView(
AddChildView(std::make_unique<AddUserButton>(controller));
break;
case AddUserSessionPolicy::ERROR_NOT_ALLOWED_PRIMARY_USER:
AddChildView(CreateAddUserErrorView(l10n_util::GetStringUTF16(
AddChildViewRaw(CreateAddUserErrorView(l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_MESSAGE_NOT_ALLOWED_PRIMARY_USER)));
break;
case AddUserSessionPolicy::ERROR_MAXIMUM_USERS_REACHED:
AddChildView(CreateAddUserErrorView(l10n_util::GetStringFUTF16Int(
AddChildViewRaw(CreateAddUserErrorView(l10n_util::GetStringFUTF16Int(
IDS_ASH_STATUS_TRAY_MESSAGE_CANNOT_ADD_USER,
session_manager::kMaximumNumberOfUserSessions)));
break;
@ -370,7 +370,7 @@ UserChooserView::UserChooserView(
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_MESSAGE_OUT_OF_USERS)));
break;
case AddUserSessionPolicy::ERROR_LOCKED_TO_SINGLE_USER:
AddChildView(CreateAddUserErrorView(l10n_util::GetStringUTF16(
AddChildViewRaw(CreateAddUserErrorView(l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_MESSAGE_NOT_ALLOWED_PRIMARY_USER)));
break;
}

@ -61,7 +61,7 @@ void AddViewToWidgetAndResize(views::Widget* widget, views::View* view) {
widget->SetContentsView(std::make_unique<views::View>());
views::View* contents_view = widget->GetContentsView();
contents_view->AddChildView(view);
contents_view->AddChildViewRaw(view);
view->SetBounds(contents_view->width(), 0, 100, 100);
gfx::Rect contents_view_bounds = contents_view->bounds();
contents_view_bounds.Union(view->bounds());

@ -277,7 +277,7 @@ TouchHudDebug::TouchHudDebug(aura::Window* initial_root)
views::View* content = widget()->GetContentsView();
content->AddChildView(canvas_.get());
content->AddChildViewRaw(canvas_.get());
const gfx::Size& display_size = display.size();
canvas_->SetSize(display_size);
@ -294,13 +294,13 @@ TouchHudDebug::TouchHudDebug(aura::Window* initial_root)
touch_labels_[i]->SetBackgroundColor(SK_ColorTRANSPARENT);
touch_labels_[i]->SetShadows(gfx::ShadowValues(
1, gfx::ShadowValue(gfx::Vector2d(1, 1), 0, kShadowColor)));
label_container_->AddChildView(touch_labels_[i]);
label_container_->AddChildViewRaw(touch_labels_[i]);
}
label_container_->SetX(0);
label_container_->SetY(display_size.height() / kReducedScale);
label_container_->SetSize(label_container_->GetPreferredSize());
label_container_->SetVisible(false);
content->AddChildView(label_container_.get());
content->AddChildViewRaw(label_container_.get());
}
TouchHudDebug::~TouchHudDebug() = default;

@ -43,7 +43,7 @@ class WallpaperWidgetDelegate : public views::WidgetDelegateView {
explicit WallpaperWidgetDelegate(views::View* view) {
SetCanMaximize(true);
SetCanFullscreen(true);
AddChildView(view);
AddChildViewRaw(view);
view->SetPaintToLayer();
}

@ -401,7 +401,7 @@ DeskPreviewView::DeskPreviewView(
layer()->SetFillsBoundsOpaquely(false);
layer()->SetMasksToBounds(false);
AddChildView(wallpaper_preview_.get());
AddChildViewRaw(wallpaper_preview_.get());
desk_mirrored_contents_view_->SetPaintToLayer(ui::LAYER_NOT_DRAWN);
ui::Layer* contents_view_layer = desk_mirrored_contents_view_->layer();
@ -409,7 +409,7 @@ DeskPreviewView::DeskPreviewView(
contents_view_layer->SetName("Desk mirrored contents view");
contents_view_layer->SetRoundedCornerRadius(kCornerRadius);
contents_view_layer->SetIsFastRoundedCorner(true);
AddChildView(desk_mirrored_contents_view_.get());
AddChildViewRaw(desk_mirrored_contents_view_.get());
highlight_overlay_ = AddChildView(std::make_unique<views::View>());
highlight_overlay_->SetPaintToLayer(ui::LAYER_SOLID_COLOR);

@ -146,7 +146,7 @@ class ImmersiveFullscreenControllerTest : public AshTestBase {
gfx::Size window_size = widget_->GetWindowBoundsInScreen().size();
content_view_ = new views::NativeViewHost();
content_view_->SetBounds(0, 0, window_size.width(), window_size.height());
widget_->client_view()->AddChildView(content_view_.get());
widget_->client_view()->AddChildViewRaw(content_view_.get());
test_api_ =
std::make_unique<ImmersiveFullscreenControllerTestApi>(controller());
@ -816,11 +816,11 @@ TEST_F(ImmersiveFullscreenControllerTest, Focus) {
views::View* child_view = new views::View();
child_view->SetBounds(0, 0, 10, 10);
child_view->SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
top_container()->AddChildView(child_view);
top_container()->AddChildViewRaw(child_view);
views::View* unrelated_view = new views::View();
unrelated_view->SetBounds(0, 100, 10, 10);
unrelated_view->SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
top_container()->parent()->AddChildView(unrelated_view);
top_container()->parent()->AddChildViewRaw(unrelated_view);
views::FocusManager* focus_manager =
top_container()->GetWidget()->GetFocusManager();
@ -928,10 +928,10 @@ TEST_F(ImmersiveFullscreenControllerTest, Bubbles) {
// Add views to the view hierarchy to which we will anchor bubbles.
views::View* child_view = new views::View();
child_view->SetBounds(0, 0, 10, 10);
top_container()->AddChildView(child_view);
top_container()->AddChildViewRaw(child_view);
views::View* unrelated_view = new views::View();
unrelated_view->SetBounds(0, 100, 10, 10);
top_container()->parent()->AddChildView(unrelated_view);
top_container()->parent()->AddChildViewRaw(unrelated_view);
SetEnabled(true);
ASSERT_FALSE(controller()->IsRevealed());

@ -88,7 +88,7 @@ TestChildModalParent::TestChildModalParent(aura::Window* context)
modal_parent_->GetRootView()->SetBackground(
views::CreateSolidBackground(kModalParentColor));
auto* modal_parent_textfield = new views::Textfield;
modal_parent_->GetRootView()->AddChildView(modal_parent_textfield);
modal_parent_->GetRootView()->AddChildViewRaw(modal_parent_textfield);
modal_parent_textfield->SetBounds(kTextfieldLeft, kTextfieldTop,
kTextfieldWidth, kTextfieldHeight);
modal_parent_textfield->SetPlaceholderText(u"modal parent window");
@ -98,8 +98,8 @@ TestChildModalParent::TestChildModalParent(aura::Window* context)
base::Unretained(this)),
u"Show/Hide Child Modal Window");
button_ = AddChildView(std::move(button));
AddChildView(textfield_.get());
AddChildView(host_.get());
AddChildViewRaw(textfield_.get());
AddChildViewRaw(host_.get());
}
TestChildModalParent::~TestChildModalParent() = default;

@ -1544,7 +1544,7 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest,
view->GetViewAccessibility().SetRole(ax::mojom::Role::kButton);
view->GetViewAccessibility().SetName(u"hello");
view->SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
widget->GetRootView()->AddChildView(view);
widget->GetRootView()->AddChildViewRaw(view);
// Show the widget, then touch and slide on the right edge of the screen.
sm_.Call([widget, clock_ptr, generator_ptr]() {
@ -1626,7 +1626,7 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, TouchExploreSecondaryDisplay) {
view->GetViewAccessibility().SetRole(ax::mojom::Role::kButton);
view->GetViewAccessibility().SetName(u"hello");
view->SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
widget->GetRootView()->AddChildView(view);
widget->GetRootView()->AddChildViewRaw(view);
// Show the widget, then touch and slide on the right edge of the screen.
sm_.Call([widget, clock_ptr, generator_ptr]() {

@ -94,10 +94,10 @@ void InputMappingView::SortChildren() {
std::sort(right.begin(), right.end(), CompareActionViewPosition);
for (auto* child : left) {
AddChildView(child);
AddChildViewRaw(child);
}
for (auto* child : right) {
AddChildView(child);
AddChildViewRaw(child);
}
}

@ -55,7 +55,7 @@ NearbyShareOverlayView::NearbyShareOverlayView(views::View* child_view)
views::kFlexBehaviorKey,
views::FlexSpecification(views::MinimumFlexSizeRule::kScaleToZero));
AddChildView(child_view);
AddChildViewRaw(child_view);
}
}

@ -58,7 +58,7 @@ ProgressBarDialogView::ProgressBarDialogView(bool is_multiple_files)
message_label_->SetMultiLine(true);
message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
message_label_->SetVerticalAlignment(gfx::ALIGN_TOP);
AddChildView(message_label_.get());
AddChildViewRaw(message_label_.get());
progress_bar_ = AddChildView(std::make_unique<views::ProgressBar>());
progress_bar_->SetPreferredHeight(kProgressBarHeight);

@ -196,7 +196,7 @@ class IdleAppNameNotificationDelegateView
label->SetFontList(font);
label->SetEnabledColor(text_color);
label->SetAutoColorReadabilityEnabled(false);
AddChildView(label);
AddChildViewRaw(label);
}
// A timer which calls us to remove the message from the screen.

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