0

Rewrite vector<T*> into vector<raw_ptr<T, VectorExperimental>>

See chromium-dev announcement:
https://groups.google.com/a/chromium.org/g/chromium-dev/c/sKckMpzHQgY/m/M3SWxEg3AQAJ?utm_medium=email&utm_source=footer

Code review:
- First patch: Automatic rewrite
- Later patches: Manual fixes

The automatic rewrite used the script:
./tools/clang/rewrite_templated_container_fields/rewrite-multiple-platforms.sh

Binary size increase:
The increase is only 33% (+5kB) above the per-patch limit (+16kB). This
is not a lot given the size of the rewrite. Increase of around 500kb was
approved for MiraclePtr.

AX-Relnotes: n/a.
Binary-Size: See commit description.
Bug: 1432993
Change-Id: I8dfc4c2b274b724b99cf408f010da5c821edae9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5140028
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Owners-Override: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1239777}
This commit is contained in:
Ali Hijazi
2023-12-20 19:29:35 +00:00
committed by Chromium LUCI CQ
parent 2d3d322cbd
commit e63cbaf6fd
1655 changed files with 7442 additions and 4864 deletions
ash
accelerators
accessibility
ambient
app_list
app_menu
assistant
autotest_private_api_utils.cc
bubble
capture_mode
color_enhancement
components
curtain
debug.cc
display
drag_drop
events
fast_ink
focus_cycler.ccfocus_cycler.hfocus_cycler_unittest.cc
frame
frame_throttler
game_dashboard
glanceables
host
hud_display
login
multi_user
picker
public
quick_pair
root_window_controller.ccroot_window_controller_unittest.cc
scalable_iph
shelf
shell_delegate.h
shortcut_viewer
style
system
accessibility
bluetooth
cast
holding_space
input_device_settings
media
message_center
notification_center
phonehub
power
privacy
status_area_animation_controller.ccstatus_area_widget.ccstatus_area_widget.hstatus_area_widget_delegate.cc
time
toast
tray
unified
video_conference
test_shell_delegate.h
user_education
utility
wallpaper
wm
ash_focus_rules.cc
collision_detection
container_finder.h
desks
drag_window_controller.cc
float
fullscreen_window_finder.ccmru_window_tracker.ccmru_window_tracker.h
multi_display
overview
pip
resize_shadow_and_cursor_unittest.ccroot_window_layout_manager.ccroot_window_layout_manager.hscreen_dimmer_unittest.ccscreen_pinning_controller_unittest.cc
snap_group
splitview
system_modal_container_layout_manager.h
tablet_mode
window_cycle
window_finder.ccwindow_mirror_view.ccwindow_positioner.cc
window_restore
window_util.ccwindow_util.hwindow_util_unittest.cc
workspace
workspace_controller_unittest.cc
wm_mode
base
cc
chrome
browser
accessibility
android
app_controller_mac.mm
apps
ash
app_list
app_restore
arc
boot_times_recorder.cc
child_accounts
parent_access_code
crosapi
extensions
file_manager
floating_workspace
input_method
login
net
note_taking_helper_unittest.cc
notifications
phonehub
platform_keys
policy
power
profiles
scalable_iph
system_logs
video_conference
autocomplete
autofill
background
background_fetch
background_sync
bookmarks
browser_process_platform_part_chromeos_browsertest.cc
browser_switcher
browsing_data
cart
certificate_provider
chrome_navigation_browsertest.cc
chromeos
companion
content_settings
device_identity
devtools
dips
dom_distiller
download
enterprise
extensions
history_clusters
installable
lacros
lifetime
lookalikes
media
metrics
navigation_predictor
nearby_sharing
net
new_tab_page
notifications
optimization_guide
page_load_metrics
password_manager
pdf
performance_manager
permissions
plugins
policy
predictors
prefs
printing
privacy
privacy_budget
profile_resetter
profiles
push_messaging
resource_coordinator
safe_browsing
screen_ai
search_engines
segmentation_platform
sessions
site_isolation
subresource_filter
supervised_user
sync
task_manager
tpcd
ui
android
ash
aura
autofill
blocked_content
bookmarks
browser.ccbrowser_browsertest.ccbrowser_close_unittest.ccbrowser_finder.ccbrowser_list.ccbrowser_list.hbrowser_tab_strip_tracker.cc
cocoa
cookie_controls
global_error
media_router
passwords
permission_bubble
sad_tab.cc
search_engines
send_tab_to_self
settings_window_manager_browsertest_chromeos.cc
startup
sync
tabs
test
thumbnails
toolbar
uma_browsing_activity_observer.cc
views
accessibility
apps
autofill
bookmarks
content_setting_bubble_contents.hdark_mode_manager_linux.ccdark_mode_manager_linux.hdark_mode_manager_linux_unittest.cc
desktop_capture
download
editor_menu
extensions
frame
global_media_controls
infobars
intent_picker_bubble_view.ccintent_picker_dialog_browsertest.cc
location_bar
omnibox
page_action
page_info
passwords
payments
permissions
sad_tab_view.h
sharing
sharing_hub
side_panel
tab_sharing
tabs
toolbar
web_apps
webauthn
webid
webview_accessibility_browsertest.cc
web_applications
webui
ukm_worker_browsertest.cc
vr
web_applications
common
renderer
test
utility
chromecast/browser
chromeos
components
autofill
blocked_content
bookmarks
browser_sync
cast_streaming
commerce
content_capture
content_settings
desks_storage
device_signals
core
system_signals
download
exo
feed
core
v2
stream_model
global_media_controls
history
infobars
keyed_service
live_caption
media_message_center
metrics
omnibox
optimization_guide
page_load_metrics
password_manager
payments
pdf
performance_manager
permissions
policy
power_bookmarks
reporting
safe_browsing
search_engines
segmentation_platform
services
signin
subresource_filter
sync_bookmarks
sync_device_info
sync_sessions
translate
ui_devtools
ukm
user_education
user_manager
viz
content
courgette
device
extensions
gpu/command_buffer
ios
ipc
media
mojo/public/cpp/bindings/lib
net
remoting
services
storage/browser
third_party/blink
ui
accessibility
actions
aura
aura_extra
base
compositor
display
events
linux
message_center
ozone
views
accessibility
controls
examples
focus
interaction
layout
test
view.ccview.hview_targeter_delegate.ccview_unittest.ccview_utils.cc
widget
window
windows_stationarity_monitor_aura.ccwindows_stationarity_monitor_aura.h
wm

@ -621,7 +621,7 @@ bool CanToggleOverview() {
auto windows =
Shell::Get()->mru_window_tracker()->BuildMruWindowList(kActiveDesk);
// Do not toggle overview if there is a window being dragged.
for (auto* window : windows) {
for (aura::Window* window : windows) {
if (WindowState::Get(window)->is_dragged())
return false;
}
@ -700,8 +700,9 @@ void ActivateDeskAtIndex(AcceleratorAction action) {
desks[target_index].get(),
DesksSwitchSource::kIndexedDeskSwitchShortcut);
} else {
for (auto* root : Shell::GetAllRootWindows())
for (aura::Window* root : Shell::GetAllRootWindows()) {
desks_animations::PerformHitTheWallAnimation(root, /*going_left=*/false);
}
}
}

@ -44,7 +44,7 @@ void AccessibilityEventHandlerManager::RemoveAccessibilityEventHandler(
void AccessibilityEventHandlerManager::UpdateEventHandlers() {
// Remove them all and add them again so they are guaranteed to be in the
// right order.
for (auto* handler : event_handlers_) {
for (ui::EventHandler* handler : event_handlers_) {
if (handler == nullptr)
continue;
ash::Shell::Get()->RemovePreTargetHandler(handler);

@ -7,6 +7,7 @@
#include <vector>
#include "base/memory/raw_ptr.h"
#include "ui/events/event_handler.h"
namespace ash {
@ -47,7 +48,7 @@ class AccessibilityEventHandlerManager {
// List of the current event handlers, indexed by
// AccessibilityEventHandlerType.
std::vector<ui::EventHandler*> event_handlers_;
std::vector<raw_ptr<ui::EventHandler, VectorExperimental>> event_handlers_;
};
} // namespace ash

@ -300,7 +300,7 @@ TEST_F(AutoclickTest, MovementThreshold) {
GetAutoclickController()->SetMovementThreshold(movement_threshold);
// Run test for the secondary display too to test fix for crbug.com/449870.
for (auto* root_window : root_windows) {
for (aura::Window* root_window : root_windows) {
gfx::Point center = root_window->GetBoundsInScreen().CenterPoint();
GetAutoclickController()->SetEnabled(true,

@ -7,6 +7,7 @@
#include "ash/frame_throttler/frame_throttling_controller.h"
#include "base/check.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/notreached.h"
#include "base/time/time.h"
#include "cc/paint/skottie_wrapper.h"
@ -160,7 +161,7 @@ void AmbientAnimationFrameRateController::ThrottleFrameRateForCurrentSection() {
void AmbientAnimationFrameRateController::ThrottleFrameRate(
base::TimeDelta frame_interval) {
std::vector<aura::Window*> windows_as_vector;
std::vector<raw_ptr<aura::Window, VectorExperimental>> windows_as_vector;
for (const auto& [window, animation] : windows_to_throttle_) {
windows_as_vector.push_back(window);
}

@ -211,10 +211,10 @@ PrefService* GetLastActiveUserPrefService() {
// Gets the MRU window shown over the applist when in tablet mode.
// Returns nullptr if no windows are shown over the applist.
aura::Window* GetTopVisibleWindow() {
std::vector<aura::Window*> window_list =
std::vector<raw_ptr<aura::Window, VectorExperimental>> window_list =
Shell::Get()->mru_window_tracker()->BuildWindowListIgnoreModal(
DesksMruType::kActiveDesk);
for (auto* window : window_list) {
for (aura::Window* window : window_list) {
if (!window->TargetVisibility() || WindowState::Get(window)->IsMinimized())
continue;
@ -627,7 +627,7 @@ bool AppListControllerImpl::GoHome(int64_t display_id) {
// The foreground window or windows (for split mode) - the windows that will
// not be minimized without animations (instead they will be animated into the
// home screen).
std::vector<aura::Window*> foreground_windows;
std::vector<raw_ptr<aura::Window, VectorExperimental>> foreground_windows;
if (split_view_active) {
foreground_windows = {split_view_controller->primary_window(),
split_view_controller->secondary_window()};
@ -677,7 +677,7 @@ bool AppListControllerImpl::GoHome(int64_t display_id) {
// TODO(https://crbug.com/1019531): This can be removed once transitions
// between in-app state and home do not cause work area updates.
std::vector<std::unique_ptr<ScopedAnimationDisabler>> animation_disablers;
for (auto* window : foreground_windows) {
for (aura::Window* window : foreground_windows) {
animation_disablers.push_back(
std::make_unique<ScopedAnimationDisabler>(window));
}
@ -694,7 +694,7 @@ bool AppListControllerImpl::GoHome(int64_t display_id) {
// Minimize currently active windows, but this time, using animation.
// Home screen will show when all the windows are done minimizing.
for (auto* foreground_window : foreground_windows) {
for (aura::Window* foreground_window : foreground_windows) {
if (::wm::WindowAnimationsDisabled(foreground_window)) {
WindowState::Get(foreground_window)->Minimize();
window_transforms_callback.Run();
@ -1834,7 +1834,7 @@ void AppListControllerImpl::UpdateForOverviewModeChange(bool show_home_launcher,
aura::Window* app_list_window =
Shell::Get()->app_list_controller()->GetHomeScreenWindow();
if (app_list_window) {
for (auto* child : wm::GetTransientChildren(app_list_window)) {
for (aura::Window* child : wm::GetTransientChildren(app_list_window)) {
if (show_home_launcher)
child->Show();
else

@ -586,7 +586,7 @@ views::View* AppListTestApi::GetVisibleSearchResultView(int index) {
app_list->GetViewsInGroup(kSearchResultViewGroup, &search_results);
int current_visible_index = -1;
for (auto* view : search_results) {
for (views::View* view : search_results) {
if (view->GetVisible())
++current_visible_index;
if (current_visible_index == index)

@ -143,14 +143,16 @@ FolderImage::FolderImage(const AppListConfig* app_list_config,
}
FolderImage::~FolderImage() {
for (auto* item : top_items_)
for (ash::AppListItem* item : top_items_) {
item->RemoveObserver(this);
}
item_list_->RemoveObserver(this);
}
void FolderImage::UpdateIcon() {
for (auto* item : top_items_)
for (ash::AppListItem* item : top_items_) {
item->RemoveObserver(this);
}
top_items_.clear();
for (size_t i = 0;
@ -342,8 +344,9 @@ void FolderImage::OnListItemMoved(size_t from_index,
void FolderImage::RedrawIconAndNotify() {
FolderImageSource::Icons top_icons;
for (const auto* item : top_items_)
for (const ash::AppListItem* item : top_items_) {
top_icons.push_back(item->GetIcon(app_list_config_->type()));
}
const gfx::Size icon_size = app_list_config_->folder_icon_size();
icon_ = gfx::ImageSkia(std::make_unique<FolderImageSource>(
*app_list_config_, top_icons, icon_size),

@ -116,7 +116,7 @@ class APP_LIST_MODEL_EXPORT FolderImage : public AppListItemListObserver,
raw_ptr<const AppListItem, ExperimentalAsh> dragged_item_ = nullptr;
// Top items for generating folder icon.
std::vector<AppListItem*> top_items_;
std::vector<raw_ptr<AppListItem, VectorExperimental>> top_items_;
base::ObserverList<FolderImageObserver> observers_;
};

@ -42,6 +42,7 @@
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/i18n/rtl.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/time/time.h"
#include "chromeos/ash/services/assistant/public/cpp/assistant_enums.h"
@ -199,7 +200,7 @@ class ButtonFocusSkipper : public ui::EventHandler {
}
private:
std::vector<views::View*> buttons_;
std::vector<raw_ptr<views::View, VectorExperimental>> buttons_;
};
AppListBubbleView::AppListBubbleView(

@ -292,8 +292,9 @@ class TopIconAnimation : public AppListFolderView::Animation,
TopIconAnimation& operator=(const TopIconAnimation&) = delete;
~TopIconAnimation() override {
for (auto* view : top_icon_views_)
for (ash::TopIconAnimationView* view : top_icon_views_) {
view->RemoveObserver(this);
}
top_icon_views_.clear();
}
@ -483,7 +484,8 @@ class TopIconAnimation : public AppListFolderView::Animation,
// not outlive the `folder_item_view_`.
const raw_ptr<AppListItemView, ExperimentalAsh> folder_item_view_;
std::vector<TopIconAnimationView*> top_icon_views_;
std::vector<raw_ptr<TopIconAnimationView, VectorExperimental>>
top_icon_views_;
base::OnceClosure completion_callback_;
};

@ -284,7 +284,7 @@ void AppListSearchView::VisibilityChanged(View* starting_from,
bool is_visible) {
if (!is_visible) {
result_selection_controller_->ClearSelection();
for (auto* container : result_container_views_) {
for (ash::SearchResultContainerView* container : result_container_views_) {
container->ResetAndHide();
}
}
@ -357,7 +357,7 @@ void AppListSearchView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
void AppListSearchView::OnActiveAppListModelsChanged(
AppListModel* model,
SearchModel* search_model) {
for (auto* container : result_container_views_) {
for (ash::SearchResultContainerView* container : result_container_views_) {
container->SetResults(search_model->results());
}
}
@ -376,7 +376,7 @@ bool AppListSearchView::OverrideKeyNavigationAboveSearchResults(
}
void AppListSearchView::UpdateForNewSearch(bool search_active) {
for (auto* container : result_container_views_) {
for (ash::SearchResultContainerView* container : result_container_views_) {
container->SetActive(search_active);
}

@ -86,7 +86,8 @@ class ASH_EXPORT AppListSearchView : public views::View,
// `search_notifier_` is either accepted or timeout.
void RemoveSearchNotifierView();
std::vector<SearchResultContainerView*> result_container_views_for_test() {
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_container_views_for_test() {
return result_container_views_;
}
@ -162,7 +163,8 @@ class ASH_EXPORT AppListSearchView : public views::View,
// Containers for search result views. The contained views are owned by the
// views hierarchy. Used by result_selection_controller_.
std::vector<SearchResultContainerView*> result_container_views_;
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_container_views_;
// The notifier that shows the search privacy notice or educational nudge.
raw_ptr<AppListToastView, ExperimentalAsh> search_notifier_ = nullptr;

@ -28,6 +28,7 @@
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "base/files/file.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/strings/strcat.h"
#include "base/test/bind.h"
@ -199,8 +200,8 @@ class AppListSearchViewTest : public AshTestBase {
bool IsSearchResultPageVisible() { return GetSearchPage()->GetVisible(); }
std::vector<size_t> GetVisibleResultContainers() {
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
std::vector<size_t> visible_result_containers = {};
for (size_t i = 0; i < result_containers.size(); i++) {
if (result_containers[i]->GetVisible()) {
@ -219,8 +220,8 @@ class AppListSearchViewTest : public AshTestBase {
SearchResultView* GetSearchResultView(size_t container_index,
size_t view_index) {
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
if (container_index >= result_containers.size()) {
ADD_FAILURE() << "Container index out of bounds";
return nullptr;
@ -316,9 +317,9 @@ TEST_P(SearchResultImageViewTest, ImageListViewVisible) {
PressAndReleaseKey(ui::VKEY_A);
// Check result container visibility.
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -330,9 +331,10 @@ TEST_P(SearchResultImageViewTest, ImageListViewVisible) {
// SearchResultImageListView container should be visible.
EXPECT_TRUE(result_containers[2]->GetVisible());
std::vector<SearchResultImageView*> search_result_image_views =
static_cast<SearchResultImageListView*>(result_containers[2])
->GetSearchResultImageViews();
std::vector<raw_ptr<SearchResultImageView, VectorExperimental>>
search_result_image_views =
static_cast<SearchResultImageListView*>(result_containers[2])
->GetSearchResultImageViews();
// The SearchResultImageListView should have 3 result views.
EXPECT_EQ(image_max_results, search_result_image_views.size());
@ -380,9 +382,9 @@ TEST_P(SearchResultImageViewTest, OneResultShowsImageInfo) {
PressAndReleaseKey(ui::VKEY_A);
// Check result container visibility.
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -405,7 +407,7 @@ TEST_P(SearchResultImageViewTest, OneResultShowsImageInfo) {
// Verify the actual texts shown in the info container are correct. Note that
// the narrowed space \x202F is used in formatting the time of the day.
const std::vector<views::Label*>& content_labels =
const std::vector<raw_ptr<views::Label, VectorExperimental>>& content_labels =
image_list_view->metadata_content_labels_for_test();
EXPECT_EQ(content_labels[0]->GetText(), u"file name");
EXPECT_EQ(content_labels[1]->GetText(), u"displayable folder");
@ -430,10 +432,10 @@ TEST_P(SearchResultImageViewTest, ActivateImageResult) {
SharedAppListConfig::instance().image_search_max_results());
// Check result container visibility.
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
ASSERT_EQ(static_cast<int>(result_containers.size()), kResultContainersCount);
for (auto* container : result_containers) {
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -489,9 +491,9 @@ TEST_P(SearchResultImageViewTest, PulsingBlocksShowWhenNoResultIcon) {
PressAndReleaseKey(ui::VKEY_A);
// Check result container visibility.
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -499,9 +501,10 @@ TEST_P(SearchResultImageViewTest, PulsingBlocksShowWhenNoResultIcon) {
// SearchResultImageListView container should be visible.
EXPECT_TRUE(result_containers[2]->GetVisible());
std::vector<SearchResultImageView*> search_result_image_views =
static_cast<SearchResultImageListView*>(result_containers[2])
->GetSearchResultImageViews();
std::vector<raw_ptr<SearchResultImageView, VectorExperimental>>
search_result_image_views =
static_cast<SearchResultImageListView*>(result_containers[2])
->GetSearchResultImageViews();
// The SearchResultImageListView should have 3 result views.
EXPECT_EQ(image_max_results, search_result_image_views.size());
@ -724,9 +727,9 @@ TEST_P(SearchResultImageViewTest, ResultSelectionCycle) {
SetUpSearchResults(results, 1, kDefaultSearchItems, 100, false,
SearchResult::Category::kApps);
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -811,9 +814,9 @@ TEST_P(SearchViewClamshellAndTabletTest, AnimateSearchResultView) {
// Verify that search containers have a scheduled update, and ensure they get
// run.
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -870,9 +873,9 @@ TEST_P(SearchViewClamshellAndTabletTest, ResultContainerIsVisible) {
// Press a key to start a search.
PressAndReleaseKey(ui::VKEY_A);
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -884,7 +887,7 @@ TEST_P(SearchViewClamshellAndTabletTest, ResultContainerIsVisible) {
PressAndReleaseKey(ui::VKEY_ESCAPE);
result_containers = GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_FALSE(container->UpdateScheduled());
}
@ -925,9 +928,9 @@ TEST_P(SearchViewClamshellAndTabletTest,
// Press a key to start a search.
PressAndReleaseKey(ui::VKEY_A);
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -946,7 +949,7 @@ TEST_P(SearchViewClamshellAndTabletTest,
// Verify that clearing search results did not schedule a container update,
// and that result view text has not been cleared.
for (auto* container : result_containers) {
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_FALSE(container->UpdateScheduled());
}
@ -1010,9 +1013,9 @@ TEST_F(SearchViewTabletTest, SearchResultPageShownWhileClosing) {
// Press a key to start a search.
PressAndReleaseKey(ui::VKEY_A);
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -1069,9 +1072,9 @@ TEST_P(SearchViewClamshellAndTabletTest, SelectionChangeDuringHide) {
// Press a key to start a search.
PressAndReleaseKey(ui::VKEY_A);
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -1084,7 +1087,7 @@ TEST_P(SearchViewClamshellAndTabletTest, SelectionChangeDuringHide) {
// Verify that clearing search results did not schedule a container update,
// and that result view text has not been cleared.
for (auto* container : result_containers) {
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_FALSE(container->UpdateScheduled());
}
@ -1126,9 +1129,9 @@ TEST_P(SearchViewClamshellAndTabletTest, ResultSelectionCycle) {
SetUpSearchResults(results, 1 + kDefaultSearchItems, kDefaultSearchItems, 1,
false, SearchResult::Category::kWeb);
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -1203,14 +1206,14 @@ TEST_P(SearchViewClamshellAndTabletTest, AnswerCardSelection) {
SearchResult::Category::kApps);
// Verify result container ordering.
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
SetUpAnswerCardResult(results, 1, 1);
for (auto* container : result_containers) {
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -1252,9 +1255,9 @@ TEST_P(SearchViewClamshellAndTabletTest, ResultSelection) {
SetUpSearchResults(results, 2 + kDefaultSearchItems, kDefaultSearchItems, 1,
false, SearchResult::Category::kWeb);
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -1314,9 +1317,9 @@ TEST_P(SearchViewClamshellAndTabletTest, ResultPageHiddenInZeroSearchState) {
SearchResult::Category::kApps);
// Verify that containers are not updating if search is not in progress.
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_FALSE(container->UpdateScheduled());
}
@ -1332,7 +1335,7 @@ TEST_P(SearchViewClamshellAndTabletTest, ResultPageHiddenInZeroSearchState) {
ordered_categories->push_back(AppListSearchResultCategory::kWeb);
SetUpSearchResults(results, 1, kDefaultSearchItems, 100, false,
SearchResult::Category::kWeb);
for (auto* container : result_containers) {
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -1346,7 +1349,7 @@ TEST_P(SearchViewClamshellAndTabletTest, ResultPageHiddenInZeroSearchState) {
// Backspace should clear selection, and search box content.
PressAndReleaseKey(ui::VKEY_BACK);
for (auto* container : result_containers) {
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_FALSE(container->UpdateScheduled());
}
@ -1365,8 +1368,8 @@ TEST_P(SearchViewClamshellAndTabletTest, SearchResultCategoricalSort) {
SearchModel::SearchResults* results = test_helper->GetSearchResults();
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
ASSERT_EQ(static_cast<int>(result_containers.size()), kResultContainersCount);
// Create categorized results and order categories as {kApps, kWeb}.
@ -1379,7 +1382,7 @@ TEST_P(SearchViewClamshellAndTabletTest, SearchResultCategoricalSort) {
SearchResult::Category::kApps);
SetUpSearchResults(results, 1 + kDefaultSearchItems, kDefaultSearchItems, 1,
false, SearchResult::Category::kWeb);
for (auto* container : result_containers) {
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -1411,7 +1414,7 @@ TEST_P(SearchViewClamshellAndTabletTest, SearchResultCategoricalSort) {
SetUpSearchResults(results, 1 + kDefaultSearchItems, kDefaultSearchItems, 100,
false, SearchResult::Category::kWeb);
result_containers = GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -1435,14 +1438,14 @@ TEST_P(SearchViewClamshellAndTabletTest, SearchResultCategoricalSort) {
SearchResultListView::SearchResultListType::kApps);
SetUpAnswerCardResult(results, 1, 1);
for (auto* container : result_containers) {
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
EXPECT_EQ(GetVisibleResultContainers(), (std::vector<size_t>{0, 2, 3}));
AppListModelProvider::Get()->search_model()->DeleteAllResults();
for (auto* container : result_containers) {
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
EXPECT_EQ(GetVisibleResultContainers(), (std::vector<size_t>{}));
@ -1460,9 +1463,9 @@ TEST_P(SearchViewClamshellAndTabletTest, SearchResultA11y) {
// Create |kDefaultSearchItems| new search results for us to cycle through.
SetUpSearchResults(results, 1, kDefaultSearchItems, 100, true,
SearchResult::Category::kApps);
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -1507,9 +1510,9 @@ TEST_P(SearchViewClamshellAndTabletTest, SearchPageA11y) {
auto* search_view = GetSearchView();
// Check result container visibility.
std::vector<SearchResultContainerView*> result_containers =
search_view->result_container_views_for_test();
for (auto* container : result_containers) {
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = search_view->result_container_views_for_test();
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -1524,7 +1527,7 @@ TEST_P(SearchViewClamshellAndTabletTest, SearchPageA11y) {
data.GetStringAttribute(ax::mojom::StringAttribute::kValue));
// Create a single search result and and verify A11yNodeData.
SetUpSearchResults(results, 1, 1, 100, true, SearchResult::Category::kApps);
for (auto* container : result_containers) {
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
search_view->GetAccessibleNodeData(&data);
@ -1534,7 +1537,7 @@ TEST_P(SearchViewClamshellAndTabletTest, SearchPageA11y) {
// Create new search results and and and verify A11yNodeData.
SetUpSearchResults(results, 2, kDefaultSearchItems - 1, 100, true,
SearchResult::Category::kApps);
for (auto* container : result_containers) {
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
ui::AXNodeData data2;
@ -1555,9 +1558,9 @@ TEST_P(SearchViewClamshellAndTabletTest, SearchClearedOnModelUpdate) {
SetUpSearchResults(results, 1, kDefaultSearchItems, 100, true,
SearchResult::Category::kApps);
std::vector<SearchResultContainerView*> result_containers =
GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
result_containers = GetSearchView()->result_container_views_for_test();
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}
@ -1583,7 +1586,7 @@ TEST_P(SearchViewClamshellAndTabletTest, SearchClearedOnModelUpdate) {
SetUpSearchResults(search_model_override->results(), 2, 1, 100, true,
SearchResult::Category::kApps);
result_containers = GetSearchView()->result_container_views_for_test();
for (auto* container : result_containers) {
for (ash::SearchResultContainerView* container : result_containers) {
EXPECT_TRUE(container->RunScheduledUpdateForTest());
}

@ -222,7 +222,7 @@ class WindowDeletionWaiter : aura::WindowObserver {
aura::Window* FindMenuWindow(aura::Window* root) {
if (root->GetType() == aura::client::WINDOW_TYPE_MENU)
return root;
for (auto* child : root->children()) {
for (aura::Window* child : root->children()) {
auto* menu_in_child = FindMenuWindow(child);
if (menu_in_child)
return menu_in_child;

@ -108,7 +108,7 @@ class AssistantPageViewLayout : public views::LayoutManagerBase {
std::max(preferred_height, host->GetMinimumSize().height());
// Snap to |kMaxHeightDip| if |child| exceeds |preferred_height|.
for (const auto* child : host->children()) {
for (const views::View* child : host->children()) {
if (child->GetHeightForWidth(width) > preferred_height)
return kMaxHeightDip;
}
@ -128,7 +128,7 @@ class AssistantPageViewLayout : public views::LayoutManagerBase {
views::ProposedLayout proposed_layout;
proposed_layout.host_size = host_view()->size();
for (auto* child : host_view()->children()) {
for (views::View* child : host_view()->children()) {
proposed_layout.child_layouts.push_back(views::ChildLayout{
child, child->GetVisible(), bounds, views::SizeBounds()});
}

@ -112,12 +112,13 @@ class FocusChangeListenerStub : public views::FocusChangeListener {
}
// Returns all views that received the focus at some point.
const std::vector<views::View*>& focused_views() const {
const std::vector<raw_ptr<views::View, VectorExperimental>>& focused_views()
const {
return focused_views_;
}
private:
std::vector<views::View*> focused_views_;
std::vector<raw_ptr<views::View, VectorExperimental>> focused_views_;
raw_ptr<views::FocusManager, ExperimentalAsh> focus_manager_;
};

@ -232,7 +232,7 @@ class ASH_EXPORT ContentsView : public views::View,
nullptr;
// The child page views. Owned by the views hierarchy.
std::vector<AppListPage*> app_list_pages_;
std::vector<raw_ptr<AppListPage, VectorExperimental>> app_list_pages_;
// Owned by the views hierarchy.
const raw_ptr<AppListView, ExperimentalAsh> app_list_view_;

@ -32,6 +32,7 @@
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
@ -1450,7 +1451,7 @@ TEST_P(ContinueSectionViewTest, InitialShowDoesNotAnimate) {
InitializeForAnimationTest(/*result_count=*/5);
ASSERT_EQ(4u, initial_bounds.size());
std::vector<views::View*> container_children =
std::vector<raw_ptr<views::View, VectorExperimental>> container_children =
GetContinueSectionView()->suggestions_container()->children();
ASSERT_EQ(4u, container_children.size());
for (int i = 0; i < 4; ++i) {
@ -1467,7 +1468,7 @@ TEST_P(ContinueSectionViewTest, UpdateWithNoChangesDoesNotAnimate) {
GetContinueSectionView()->suggestions_container()->Update();
base::RunLoop().RunUntilIdle();
std::vector<views::View*> container_children =
std::vector<raw_ptr<views::View, VectorExperimental>> container_children =
GetContinueSectionView()->suggestions_container()->children();
ASSERT_EQ(4u, container_children.size());
for (int i = 0; i < 4; ++i) {
@ -1487,7 +1488,8 @@ TEST_P(ContinueSectionViewTest, AnimatesWhenLastItemReplaced) {
GetContinueSectionView()->suggestions_container();
container_view->Update();
std::vector<views::View*> container_children = container_view->children();
std::vector<raw_ptr<views::View, VectorExperimental>> container_children =
container_view->children();
const size_t new_views_start = 4;
ASSERT_EQ(new_views_start + 4, container_children.size());
@ -1544,7 +1546,8 @@ TEST_P(ContinueSectionViewTest, AnimatesWhenFirstItemRemoved) {
GetContinueSectionView()->suggestions_container();
container_view->Update();
std::vector<views::View*> container_children = container_view->children();
std::vector<raw_ptr<views::View, VectorExperimental>> container_children =
container_view->children();
const size_t new_views_start = 4;
ASSERT_EQ(new_views_start + 4, container_children.size());
@ -1607,7 +1610,8 @@ TEST_P(ContinueSectionViewTest, AnimatesWhenSecondItemRemoved) {
GetContinueSectionView()->suggestions_container();
container_view->Update();
std::vector<views::View*> container_children = container_view->children();
std::vector<raw_ptr<views::View, VectorExperimental>> container_children =
container_view->children();
const size_t new_views_start = 4;
ASSERT_EQ(new_views_start + 4, container_children.size());
@ -1677,7 +1681,8 @@ TEST_P(ContinueSectionViewTest, AnimatesWhenThirdItemRemoved) {
GetContinueSectionView()->suggestions_container();
container_view->Update();
std::vector<views::View*> container_children = container_view->children();
std::vector<raw_ptr<views::View, VectorExperimental>> container_children =
container_view->children();
const size_t new_views_start = 4;
ASSERT_EQ(new_views_start + 4, container_children.size());
@ -1752,7 +1757,8 @@ TEST_P(ContinueSectionViewTest, AnimatesWhenItemInserted) {
GetContinueSectionView()->suggestions_container();
container_view->Update();
std::vector<views::View*> container_children = container_view->children();
std::vector<raw_ptr<views::View, VectorExperimental>> container_children =
container_view->children();
const size_t new_views_start = 4;
ASSERT_EQ(new_views_start + 4, container_children.size());
@ -1830,7 +1836,8 @@ TEST_P(ContinueSectionViewTest, AnimatesWhenTwoItemsRemoved) {
GetContinueSectionView()->suggestions_container();
container_view->Update();
std::vector<views::View*> container_children = container_view->children();
std::vector<raw_ptr<views::View, VectorExperimental>> container_children =
container_view->children();
const size_t new_views_start = 4;
ASSERT_EQ(new_views_start + 4, container_children.size());
@ -1910,7 +1917,8 @@ TEST_P(ContinueSectionViewTest, ResultRemovedMidAnimation) {
GetResults()->DeleteAt(1);
container_view->Update();
std::vector<views::View*> container_children = container_view->children();
std::vector<raw_ptr<views::View, VectorExperimental>> container_children =
container_view->children();
const size_t new_views_start = 4;
ASSERT_EQ(new_views_start + 4, container_children.size());
@ -1989,7 +1997,8 @@ TEST_P(ContinueSectionViewTest, ContinueSectionHiddenMidAnimation) {
container_view->Update();
EXPECT_FALSE(GetContinueSectionView()->GetVisible());
std::vector<views::View*> container_children = container_view->children();
std::vector<raw_ptr<views::View, VectorExperimental>> container_children =
container_view->children();
ASSERT_EQ(1u, container_children.size());
EXPECT_FALSE(container_children[0]->layer()->GetAnimator()->is_animating());
}
@ -2005,7 +2014,8 @@ TEST_P(ContinueSectionViewTest, AnimatesWhenNumberOfChipsChanges) {
GetContinueSectionView()->suggestions_container();
container_view->Update();
std::vector<views::View*> container_children = container_view->children();
std::vector<raw_ptr<views::View, VectorExperimental>> container_children =
container_view->children();
const size_t new_views_start = 4;
ASSERT_EQ(new_views_start + 3, container_children.size());

@ -15,6 +15,7 @@
#include "ash/public/cpp/app_list/app_list_notifier.h"
#include "ash/strings/grit/ash_strings.h"
#include "base/check.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_util.h"
#include "base/task/single_thread_task_runner.h"
@ -378,7 +379,7 @@ void ContinueTaskContainerView::ScheduleContainerUpdateAnimation(
animation_builder.GetCurrentSequence().At(delay).SetDuration(
base::Milliseconds(300));
for (auto* view : suggestion_tasks_views_) {
for (ash::ContinueTaskView* view : suggestion_tasks_views_) {
const std::string& result_id = view->result()->id();
// If view remained in place, it does not need to be animated in.
auto view_remaining_in_place_it = views_remaining_in_place.find(result_id);
@ -403,8 +404,9 @@ void ContinueTaskContainerView::ScheduleContainerUpdateAnimation(
}
void ContinueTaskContainerView::AbortTasksUpdateAnimations() {
for (auto* view : suggestion_tasks_views_)
for (ash::ContinueTaskView* view : suggestion_tasks_views_) {
view->layer()->GetAnimator()->StopAnimating();
}
ClearAnimatingViews();
}
@ -413,10 +415,11 @@ void ContinueTaskContainerView::ClearAnimatingViews() {
// case view removal causes an aborted view animation that calls back into
// `ClearAnimatingViews()`. Clearing `views_to_remove_after_animation_` mid
// iteraion over the vector would not be safe.
std::vector<ContinueTaskView*> views_to_remove;
std::vector<raw_ptr<ContinueTaskView, VectorExperimental>> views_to_remove;
views_to_remove_after_animation_.swap(views_to_remove);
for (auto* view : views_to_remove)
for (ash::ContinueTaskView* view : views_to_remove) {
RemoveChildViewT(view);
}
NotifyAccessibilityEvent(ax::mojom::Event::kChildrenChanged, true);
}
@ -469,7 +472,7 @@ void ContinueTaskContainerView::AnimateSlideInSuggestions(
views::AnimationBuilder animation_builder;
animation_builder.Once().SetDuration(duration);
for (auto* view : suggestion_tasks_views_) {
for (ash::ContinueTaskView* view : suggestion_tasks_views_) {
animation_builder.GetCurrentSequence()
.SetTransform(view, gfx::Transform(), tween)
.SetOpacity(view, 1.0f, tween);

@ -181,7 +181,8 @@ class ASH_EXPORT ContinueTaskContainerView : public ui::ListModelObserver,
raw_ptr<views::TableLayout, ExperimentalAsh> table_layout_ = nullptr;
// The list of tasks views for the container.
std::vector<ContinueTaskView*> suggestion_tasks_views_;
std::vector<raw_ptr<ContinueTaskView, VectorExperimental>>
suggestion_tasks_views_;
// The number of results shown in the container. Each result has one view.
size_t num_results_ = 0;
@ -207,7 +208,8 @@ class ASH_EXPORT ContinueTaskContainerView : public ui::ListModelObserver,
// of results shown in the container gets updated. The views are only still
// needed for the update animation and should be removed once the animation
// completes.
std::vector<ContinueTaskView*> views_to_remove_after_animation_;
std::vector<raw_ptr<ContinueTaskView, VectorExperimental>>
views_to_remove_after_animation_;
// Timer which when active disables container update animations. The timer
// gets started when the container gets shown. The goal is to disable update

@ -176,7 +176,7 @@ void PageSwitcher::OnThemeChanged() {
views::View::OnThemeChanged();
if (!buttons_)
return;
for (auto* child : buttons_->children()) {
for (views::View* child : buttons_->children()) {
if (child->GetVisible())
child->SchedulePaint();
}

@ -198,8 +198,9 @@ void RecentAppsView::OnAppListItemWillBeDeleted(AppListItem* item) {
void RecentAppsView::UpdateAppListConfig(const AppListConfig* app_list_config) {
app_list_config_ = app_list_config;
for (auto* item_view : item_views_)
for (ash::AppListItemView* item_view : item_views_) {
item_view->UpdateAppListConfig(app_list_config);
}
}
void RecentAppsView::UpdateResults(

@ -103,7 +103,7 @@ class ASH_EXPORT RecentAppsView : public AppListModelObserver,
// The recent app items. Stored here because this view has child views for
// spacing that are not AppListItemViews.
std::vector<AppListItemView*> item_views_;
std::vector<raw_ptr<AppListItemView, VectorExperimental>> item_views_;
};
} // namespace ash

@ -38,7 +38,7 @@ namespace {
aura::Window* FindMenuWindow(aura::Window* root) {
if (root->GetType() == aura::client::WINDOW_TYPE_MENU)
return root;
for (auto* child : root->children()) {
for (aura::Window* child : root->children()) {
auto* menu_in_child = FindMenuWindow(child);
if (menu_in_child)
return menu_in_child;

@ -21,7 +21,8 @@ class SearchResultContainerView;
// This alias is intended to clarify the intended use of this class within the
// context of this controller.
using ResultSelectionModel = std::vector<SearchResultContainerView*>;
using ResultSelectionModel =
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>;
// Stores and organizes the details for the 'coordinates' of the selected
// result. This includes all information to determine exactly where a result is,

@ -19,6 +19,7 @@
#include "ash/app_list/views/search_result_container_view.h"
#include "base/functional/bind.h"
#include "base/i18n/rtl.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/stringprintf.h"
#include "ui/events/event.h"
@ -633,7 +634,8 @@ class ResultSelectionTest : public testing::Test,
std::unique_ptr<test::AppListTestViewDelegate> app_list_test_delegate_;
std::unique_ptr<ResultSelectionController> result_selection_controller_;
std::vector<SearchResultContainerView*> containers_;
std::vector<raw_ptr<SearchResultContainerView, VectorExperimental>>
containers_;
// Set up key events for test. These will never be marked as 'handled'.
ui::KeyEvent down_arrow_ =

@ -17,6 +17,7 @@
#include "ash/style/ash_color_id.h"
#include "ash/style/typography.h"
#include "base/i18n/time_formatting.h"
#include "base/memory/raw_ptr.h"
#include "chromeos/constants/chromeos_features.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/time_format.h"
@ -191,7 +192,7 @@ SearchResultImageView* SearchResultImageListView::GetResultViewAt(
return image_views_[index];
}
std::vector<SearchResultImageView*>
std::vector<raw_ptr<SearchResultImageView, VectorExperimental>>
SearchResultImageListView::GetSearchResultImageViews() {
return image_views_;
}
@ -202,7 +203,7 @@ void SearchResultImageListView::ConfigureLayoutForAvailableWidth(int width) {
kSpaceBetweenImages * (image_count - 1);
const int image_width = std::max(0, (width - margin_space) / image_count);
for (auto* image_view : image_views_) {
for (ash::SearchResultImageView* image_view : image_views_) {
image_view->ConfigureLayoutForAvailableWidth(image_width);
}
}

@ -40,7 +40,8 @@ class ASH_EXPORT SearchResultImageListView : public SearchResultContainerView {
SearchResultImageView* GetResultViewAt(size_t index) override;
// Returns all search result image views children of this view.
std::vector<SearchResultImageView*> GetSearchResultImageViews();
std::vector<raw_ptr<SearchResultImageView, VectorExperimental>>
GetSearchResultImageViews();
// Returns the preferred width of the image search result according to the
// layout.
@ -53,7 +54,8 @@ class ASH_EXPORT SearchResultImageListView : public SearchResultContainerView {
const views::FlexLayoutView* image_info_container_for_test() const {
return image_info_container_.get();
}
const std::vector<views::Label*>& metadata_content_labels_for_test() const {
const std::vector<raw_ptr<views::Label, VectorExperimental>>&
metadata_content_labels_for_test() const {
return metadata_content_labels_;
}
@ -74,12 +76,13 @@ class ASH_EXPORT SearchResultImageListView : public SearchResultContainerView {
raw_ptr<views::FlexLayoutView> image_view_container_ = nullptr;
raw_ptr<views::FlexLayoutView> image_info_container_ = nullptr;
std::vector<SearchResultImageView*> image_views_;
std::vector<raw_ptr<SearchResultImageView, VectorExperimental>> image_views_;
// Labels that show the file metadata in `image_info_container_`. There should
// always be 3 labels, which in the order of {file name, file directory, date
// modified}.
std::vector<views::Label*> metadata_content_labels_;
std::vector<raw_ptr<views::Label, VectorExperimental>>
metadata_content_labels_;
base::WeakPtrFactory<SearchResultImageListView> weak_ptr_factory_{this};
};

@ -148,7 +148,8 @@ class ASH_EXPORT SearchResultListView : public SearchResultContainerView {
raw_ptr<views::View, ExperimentalAsh> results_container_;
std::vector<SearchResultView*> search_result_views_; // Not owned.
std::vector<raw_ptr<SearchResultView, VectorExperimental>>
search_result_views_; // Not owned.
// The SearchResultListViewType dictates what kinds of results will be shown.
std::optional<SearchResultListType> list_type_ =

@ -122,7 +122,7 @@ class SearchResultListViewTest : public views::test::WidgetTest {
std::vector<SearchResultView*> GetAssistantResultViews() const {
std::vector<SearchResultView*> results;
for (auto* view : default_view_->search_result_views_) {
for (ash::SearchResultView* view : default_view_->search_result_views_) {
auto* result = view->result();
if (result &&
result->result_type() == AppListSearchResultType::kAssistantText)

@ -60,7 +60,8 @@ class APP_MENU_EXPORT NotificationOverflowView : public views::View {
raw_ptr<views::MenuSeparator, ExperimentalAsh> separator_;
// The list of overflow icons. Listed in right to left ordering.
std::vector<NotificationOverflowImageView*> image_views_;
std::vector<raw_ptr<NotificationOverflowImageView, VectorExperimental>>
image_views_;
// The overflow icon shown when there are more than |kMaxOverflowIcons|
// notifications.

@ -43,7 +43,7 @@ class NotificationOverflowViewTest : public views::ViewsTestBase {
// shown in the overflow. Does not include the overflow icon.
void CheckNumberOfNotificationIcons(int expected_notification_icons) {
int actual_notification_icons = 0;
for (auto* v : notification_overflow_view_->GetChildrenInZOrder()) {
for (views::View* v : notification_overflow_view_->GetChildrenInZOrder()) {
if (!v->GetVisible() || v->GetID() != kNotificationOverflowIconId)
continue;
@ -54,7 +54,7 @@ class NotificationOverflowViewTest : public views::ViewsTestBase {
// Returns whether the overflow icon is being shown.
bool HasOverflowIcon() {
for (auto* v : notification_overflow_view_->GetChildrenInZOrder()) {
for (views::View* v : notification_overflow_view_->GetChildrenInZOrder()) {
if (v->GetID() != kOverflowIconId)
continue;

@ -27,7 +27,7 @@ void StackLayout::ViewRemoved(views::View* host, views::View* view) {
gfx::Size StackLayout::GetPreferredSize(const views::View* host) const {
return std::accumulate(host->children().cbegin(), host->children().cend(),
gfx::Size(), [](gfx::Size size, const auto* v) {
gfx::Size(), [](gfx::Size size, const views::View* v) {
size.SetToMax(v->GetPreferredSize());
return size;
});
@ -49,7 +49,7 @@ void StackLayout::Layout(views::View* host) {
const int host_width = host->GetContentsBounds().width();
const int host_height = host->GetContentsBounds().height();
for (auto* child : host->children()) {
for (views::View* child : host->children()) {
int child_width = host_width;
int child_height = host_height;

@ -73,8 +73,9 @@ void FindDescendentByClassName(views::View* parent, T** result) {
return;
}
for (auto* child : candidate->children())
for (views::View* child : candidate->children()) {
children.push(child);
}
}
}

@ -118,8 +118,9 @@ void AssistantProgressIndicator::VisibilityChanged(views::View* starting_from,
if (!is_drawn_) {
// Stop all animations.
for (auto* child : children())
for (views::View* child : children()) {
child->layer()->GetAnimator()->StopAnimating();
}
return;
}
@ -140,7 +141,7 @@ void AssistantProgressIndicator::VisibilityChanged(views::View* starting_from,
return;
base::TimeDelta start_offset;
for (auto* child : children()) {
for (views::View* child : children()) {
if (!start_offset.is_zero()) {
// Schedule the animations to start after an offset.
child->layer()->GetAnimator()->SchedulePauseForProperties(

@ -14,6 +14,7 @@
#include "ash/wm/tablet_mode/scoped_skip_user_session_blocked_check.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/scoped_observation.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_observer.h"
@ -147,7 +148,7 @@ bool WaitForLauncherAnimation(base::OnceClosure closure) {
} // namespace
std::vector<aura::Window*> GetAppWindowList() {
std::vector<raw_ptr<aura::Window, VectorExperimental>> GetAppWindowList() {
ScopedSkipUserSessionBlockedCheck skip_session_blocked;
return Shell::Get()->mru_window_tracker()->BuildAppWindowList(kAllDesks);
}

@ -31,7 +31,7 @@ views::ProposedLayout SimpleGridLayout::CalculateProposedLayout(
gfx::Size size = GetChildPreferredSize();
int row = 0;
int col = 0;
for (auto* child : host_view()->children()) {
for (views::View* child : host_view()->children()) {
if (!IsChildIncludedInLayout(child))
continue;
@ -71,7 +71,7 @@ gfx::Size SimpleGridLayout::GetChildPreferredSize() const {
gfx::Size SimpleGridLayout::CalculatePreferredSize() const {
int total_children = 0;
for (auto* child : host_view()->children()) {
for (views::View* child : host_view()->children()) {
if (IsChildIncludedInLayout(child))
++total_children;
}

@ -210,9 +210,9 @@ gfx::Rect GetCollisionAvoidanceRect(aura::Window* root_window) {
unified_system_tray->IsBubbleShown()) {
collision_avoidance_rect = unified_system_tray->GetBubbleBoundsInScreen();
} else {
const std::vector<TrayBackgroundView*> tray_buttons =
status_area_widget->tray_buttons();
for (auto* tray_button : tray_buttons) {
const std::vector<raw_ptr<TrayBackgroundView, VectorExperimental>>
tray_buttons = status_area_widget->tray_buttons();
for (ash::TrayBackgroundView* tray_button : tray_buttons) {
if (views::Widget* tray_bubble_widget = tray_button->GetBubbleWidget();
tray_bubble_widget && tray_bubble_widget->IsVisible()) {
collision_avoidance_rect.Union(
@ -249,7 +249,7 @@ void UpdateFloatingPanelBoundsIfNeeded(aura::Window* root_window) {
// with the current configuration.
gfx::Size CalculatePreviewInitialSize() {
int max_shorter_side = 0;
for (auto* root_window : Shell::GetAllRootWindows()) {
for (aura::Window* root_window : Shell::GetAllRootWindows()) {
const auto work_area = display::Screen::GetScreen()
->GetDisplayNearestWindow(root_window)
.work_area();

@ -3586,7 +3586,7 @@ TEST_P(CaptureModeCameraPreviewTest, MultiDisplayResize) {
StartCaptureSessionWithParam();
auto* controller = CaptureModeController::Get();
auto* session = controller->capture_mode_session();
auto* display_2_root = Shell::GetAllRootWindows()[1];
auto* display_2_root = Shell::GetAllRootWindows()[1].get();
// When capturing a window, set its bounds such that it is placed on the
// secondary display.

@ -406,7 +406,7 @@ void CaptureModeMenuGroup::AddOrUpdateExistingOption(
}
void CaptureModeMenuGroup::RefreshOptionsSelections() {
for (auto* option : options_) {
for (ash::CaptureModeOption* option : options_) {
option->SetOptionChecked(delegate_->IsOptionChecked(option->id()));
option->SetEnabled(delegate_->IsOptionEnabled(option->id()));
}
@ -449,12 +449,13 @@ void CaptureModeMenuGroup::AppendHighlightableItems(
if (menu_header_)
highlightable_items.push_back(menu_header_);
for (auto* option : options_) {
for (ash::CaptureModeOption* option : options_) {
if (option->GetEnabled())
highlightable_items.push_back(option);
}
for (auto* menu_item : menu_items_)
for (ash::CaptureModeMenuItem* menu_item : menu_items_) {
highlightable_items.push_back(menu_item);
}
}
views::View* CaptureModeMenuGroup::GetOptionForTesting(int option_id) {

@ -152,7 +152,7 @@ class ASH_EXPORT CaptureModeMenuGroup : public views::View {
// Options added via calls "AddOption()". Options are owned by theirs views
// hierarchy.
std::vector<CaptureModeOption*> options_;
std::vector<raw_ptr<CaptureModeOption, VectorExperimental>> options_;
// It's a container view for |options_|. It's owned by its views hierarchy.
// We need it for grouping up options. For example, when user selects a custom
@ -161,7 +161,7 @@ class ASH_EXPORT CaptureModeMenuGroup : public views::View {
raw_ptr<views::View, ExperimentalAsh> options_container_;
// Menu items added by calling AddMenuItem().
std::vector<CaptureModeMenuItem*> menu_items_;
std::vector<raw_ptr<CaptureModeMenuItem, VectorExperimental>> menu_items_;
};
} // namespace ash

@ -2832,7 +2832,7 @@ void CaptureModeSession::InitInternal() {
if (auto* capture_client = aura::client::GetCaptureClient(current_root_)) {
input_capture_window_ = capture_client->GetCaptureWindow();
if (input_capture_window_) {
aura::WindowTracker tracker({input_capture_window_});
aura::WindowTracker tracker({input_capture_window_.get()});
capture_client->ReleaseCapture(input_capture_window_);
if (tracker.windows().empty()) {
input_capture_window_ = nullptr;

@ -27,6 +27,7 @@
#include "ash/wm/window_state.h"
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "chromeos/ui/base/chromeos_ui_constants.h"
#include "ui/base/class_property.h"
@ -67,7 +68,8 @@ constexpr int kIntersectingWindowOutset =
chromeos::kResizeOutsideBoundsSize + 1;
constexpr int kWindowOfInterestInset = 1;
std::vector<aura::Window*> GetWindowListIgnoreModalForActiveDesk() {
std::vector<raw_ptr<aura::Window, VectorExperimental>>
GetWindowListIgnoreModalForActiveDesk() {
return Shell::Get()->mru_window_tracker()->BuildWindowListIgnoreModal(
DesksMruType::kActiveDesk);
}
@ -463,7 +465,7 @@ CaptureModeSessionFocusCycler::CaptureModeSessionFocusCycler(
session_(session),
scoped_a11y_overrider_(
std::make_unique<ScopedA11yOverrideWindowSetter>()) {
for (auto* window : GetWindowListIgnoreModalForActiveDesk()) {
for (aura::Window* window : GetWindowListIgnoreModalForActiveDesk()) {
if (!IsCaptureWindowSelectable(window))
continue;
highlightable_windows_.emplace(
@ -852,12 +854,12 @@ CaptureModeSessionFocusCycler::GetGroupItems(FocusGroup group) const {
break;
}
case FocusGroup::kCaptureWindow: {
const std::vector<aura::Window*> windows =
const std::vector<raw_ptr<aura::Window, VectorExperimental>> windows =
GetWindowListIgnoreModalForActiveDesk();
if (!windows.empty()) {
const std::vector<HighlightableView*> camera_items =
GetGroupItems(FocusGroup::kCameraPreview);
for (auto* window : windows) {
for (aura::Window* window : windows) {
auto iter = highlightable_windows_.find(window);
if (iter != highlightable_windows_.end()) {
items.push_back(iter->second.get());

@ -3764,7 +3764,8 @@ TEST_F(CaptureModeTest, KeyboardNavigationBasic) {
// mode.
TEST_F(CaptureModeTest, KeyboardNavigationTabThroughWindowsOnMultipleDisplays) {
UpdateDisplay("800x700,801+0-800x700");
std::vector<aura::Window*> root_windows = Shell::GetAllRootWindows();
std::vector<raw_ptr<aura::Window, VectorExperimental>> root_windows =
Shell::GetAllRootWindows();
ASSERT_EQ(2u, root_windows.size());
// Create three windows, one of them is a modal transient child.

@ -139,7 +139,7 @@ class ModifiersContainerView : public views::View {
private:
void RemoveModifier(ui::KeyboardCode key_code) {
for (auto* child : children()) {
for (views::View* child : children()) {
if (static_cast<KeyItemView*>(child)->key_code() == key_code) {
RemoveChildViewT(child);
return;

@ -106,7 +106,7 @@ gfx::Size KeyItemView::CalculatePreferredSize() const {
}
int width = 0;
for (const auto* child : children()) {
for (const views::View* child : children()) {
const auto child_size = child->GetPreferredSize();
width += child_size.width();
}

@ -764,7 +764,7 @@ void VideoRecordingWatcher::UpdateLayerStackingAndDimmers() {
DesksMruType::kAllDesks);
bool did_find_recorded_window = false;
// Note that the order of |mru_windows| are from top-most first.
for (auto* window : mru_windows) {
for (aura::Window* window : mru_windows) {
if (window == window_being_recorded_) {
did_find_recorded_window = true;
continue;

@ -233,8 +233,9 @@ void ColorEnhancementController::OnRootWindowAdded(aura::Window* root_window) {
}
void ColorEnhancementController::UpdateAllDisplays() {
for (auto* root_window : Shell::GetAllRootWindows())
for (aura::Window* root_window : Shell::GetAllRootWindows()) {
UpdateDisplay(root_window);
}
}
void ColorEnhancementController::UpdateDisplay(aura::Window* root_window) {

@ -48,11 +48,11 @@ TEST_F(ColorEnhancementControllerTest, HighContrast) {
PrefService* prefs = GetPrefs();
prefs->SetBoolean(prefs::kAccessibilityHighContrastEnabled, true);
EXPECT_TRUE(IsCursorCompositingEnabled());
for (auto* root_window : Shell::GetAllRootWindows()) {
for (aura::Window* root_window : Shell::GetAllRootWindows()) {
EXPECT_TRUE(root_window->layer()->layer_inverted());
}
prefs->SetBoolean(prefs::kAccessibilityHighContrastEnabled, false);
for (auto* root_window : Shell::GetAllRootWindows()) {
for (aura::Window* root_window : Shell::GetAllRootWindows()) {
EXPECT_FALSE(root_window->layer()->layer_inverted());
}
EXPECT_FALSE(IsCursorCompositingEnabled());
@ -65,7 +65,7 @@ TEST_F(ColorEnhancementControllerTest, Greyscale) {
prefs->SetInteger(prefs::kAccessibilityColorVisionCorrectionType,
ColorVisionCorrectionType::kGrayscale);
EXPECT_FALSE(IsCursorCompositingEnabled());
for (auto* root_window : Shell::GetAllRootWindows()) {
for (aura::Window* root_window : Shell::GetAllRootWindows()) {
EXPECT_FLOAT_EQ(0.f, root_window->layer()->layer_grayscale());
// No other color filters were set.
EXPECT_FALSE(root_window->layer()->LayerHasCustomColorMatrix());
@ -73,14 +73,14 @@ TEST_F(ColorEnhancementControllerTest, Greyscale) {
prefs->SetInteger(prefs::kAccessibilityColorVisionCorrectionAmount, 100);
EXPECT_FALSE(IsCursorCompositingEnabled());
for (auto* root_window : Shell::GetAllRootWindows()) {
for (aura::Window* root_window : Shell::GetAllRootWindows()) {
EXPECT_FLOAT_EQ(1, root_window->layer()->layer_grayscale());
// No other color filters were set.
EXPECT_FALSE(root_window->layer()->LayerHasCustomColorMatrix());
}
prefs->SetInteger(prefs::kAccessibilityColorVisionCorrectionAmount, 50);
for (auto* root_window : Shell::GetAllRootWindows()) {
for (aura::Window* root_window : Shell::GetAllRootWindows()) {
EXPECT_FLOAT_EQ(0.5f, root_window->layer()->layer_grayscale());
// No other color filters were set.
EXPECT_FALSE(root_window->layer()->LayerHasCustomColorMatrix());
@ -88,14 +88,14 @@ TEST_F(ColorEnhancementControllerTest, Greyscale) {
// Greyscale larger than 100% or smaller than 0% does nothing.
prefs->SetInteger(prefs::kAccessibilityColorVisionCorrectionAmount, 500);
for (auto* root_window : Shell::GetAllRootWindows()) {
for (aura::Window* root_window : Shell::GetAllRootWindows()) {
EXPECT_FLOAT_EQ(0.5f, root_window->layer()->layer_grayscale());
// No other color filters were set.
EXPECT_FALSE(root_window->layer()->LayerHasCustomColorMatrix());
}
prefs->SetInteger(prefs::kAccessibilityColorVisionCorrectionAmount, -10);
for (auto* root_window : Shell::GetAllRootWindows()) {
for (aura::Window* root_window : Shell::GetAllRootWindows()) {
EXPECT_FLOAT_EQ(0.5f, root_window->layer()->layer_grayscale());
// No other color filters were set.
EXPECT_FALSE(root_window->layer()->LayerHasCustomColorMatrix());
@ -112,20 +112,20 @@ TEST_F(ColorEnhancementControllerTest, ColorVisionCorrectionFilters) {
// With severity at 0, no matrix should be applied.
prefs->SetInteger(prefs::kAccessibilityColorVisionCorrectionAmount, 0);
for (auto* root_window : Shell::GetAllRootWindows()) {
for (aura::Window* root_window : Shell::GetAllRootWindows()) {
EXPECT_FALSE(root_window->layer()->LayerHasCustomColorMatrix());
EXPECT_FLOAT_EQ(0.f, root_window->layer()->layer_grayscale());
}
// With a non-zero severity, a matrix should be applied.
prefs->SetInteger(prefs::kAccessibilityColorVisionCorrectionAmount, 50);
for (auto* root_window : Shell::GetAllRootWindows()) {
for (aura::Window* root_window : Shell::GetAllRootWindows()) {
EXPECT_TRUE(root_window->layer()->LayerHasCustomColorMatrix());
// Grayscale was not impacted.
EXPECT_FLOAT_EQ(0.f, root_window->layer()->layer_grayscale());
}
prefs->SetInteger(prefs::kAccessibilityColorVisionCorrectionAmount, 100);
for (auto* root_window : Shell::GetAllRootWindows()) {
for (aura::Window* root_window : Shell::GetAllRootWindows()) {
const cc::FilterOperation::Matrix* matrix =
root_window->layer()->GetLayerCustomColorMatrix();
EXPECT_TRUE(matrix);
@ -153,14 +153,14 @@ TEST_F(ColorEnhancementControllerTest, GrayscaleBehindColorCorrectionOption) {
ColorVisionCorrectionType::kGrayscale);
// Default values.
for (auto* root_window : Shell::GetAllRootWindows()) {
for (aura::Window* root_window : Shell::GetAllRootWindows()) {
EXPECT_FLOAT_EQ(0.0f, root_window->layer()->layer_grayscale());
EXPECT_FALSE(root_window->layer()->LayerHasCustomColorMatrix());
}
// Turn on color filtering, values should now be from prefs.
prefs->SetBoolean(prefs::kAccessibilityColorCorrectionEnabled, true);
for (auto* root_window : Shell::GetAllRootWindows()) {
for (aura::Window* root_window : Shell::GetAllRootWindows()) {
EXPECT_FLOAT_EQ(0.5f, root_window->layer()->layer_grayscale());
EXPECT_FALSE(root_window->layer()->LayerHasCustomColorMatrix());
}
@ -168,14 +168,14 @@ TEST_F(ColorEnhancementControllerTest, GrayscaleBehindColorCorrectionOption) {
prefs->SetInteger(prefs::kAccessibilityColorVisionCorrectionType,
ColorVisionCorrectionType::kDeuteranomaly);
prefs->SetBoolean(prefs::kAccessibilityColorCorrectionEnabled, true);
for (auto* root_window : Shell::GetAllRootWindows()) {
for (aura::Window* root_window : Shell::GetAllRootWindows()) {
EXPECT_FLOAT_EQ(0.0f, root_window->layer()->layer_grayscale());
EXPECT_TRUE(root_window->layer()->LayerHasCustomColorMatrix());
}
// Turn it off again, expect defaults to be restored.
prefs->SetBoolean(prefs::kAccessibilityColorCorrectionEnabled, false);
for (auto* root_window : Shell::GetAllRootWindows()) {
for (aura::Window* root_window : Shell::GetAllRootWindows()) {
EXPECT_FLOAT_EQ(0.0f, root_window->layer()->layer_grayscale());
EXPECT_FALSE(root_window->layer()->LayerHasCustomColorMatrix());
}

@ -1105,7 +1105,7 @@ void ArcNetHostImpl::AddPasspointCredentials(
aura::Window* ArcNetHostImpl::GetAppWindow(const std::string& package_name) {
std::queue<aura::Window*> windows = {};
for (auto* window : ash::Shell::GetAllRootWindows()) {
for (aura::Window* window : ash::Shell::GetAllRootWindows()) {
windows.push(window);
}
while (!windows.empty()) {
@ -1114,7 +1114,7 @@ aura::Window* ArcNetHostImpl::GetAppWindow(const std::string& package_name) {
if (!window) {
continue;
}
for (auto* child_window : window->children()) {
for (aura::Window* child_window : window->children()) {
windows.push(child_window);
}
const std::string* app_id = window->GetProperty(ash::kAppIDKey);

@ -165,7 +165,7 @@ Session::~Session() {
}
void Session::CurtainOffAllRootWindows() {
for (auto* root_window : shell_->GetAllRootWindows()) {
for (aura::Window* root_window : shell_->GetAllRootWindows()) {
CurtainOffRootWindow(root_window);
}
}
@ -185,7 +185,7 @@ void Session::CurtainOffRootWindow(aura::Window* root_window) {
}
void Session::RemoveCurtainOfAllRootWindows() {
for (auto* root_window : shell_->GetAllRootWindows()) {
for (aura::Window* root_window : shell_->GetAllRootWindows()) {
RemoveCurtainOfRootWindow(root_window);
}
}

@ -14,6 +14,7 @@
#include "ash/wm/window_properties.h"
#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
#include "base/memory/raw_ptr.h"
#include "cc/debug/layer_tree_debug_state.h"
#include "ui/accessibility/aura/aura_window_properties.h"
#include "ui/aura/client/aura_constants.h"
@ -131,7 +132,7 @@ void PrintWindowHierarchy(const aura::Window* active_window,
views::PrintWidgetInformation(*widget, /*detailed*/ false, out);
}
std::vector<aura::Window*> children =
std::vector<raw_ptr<aura::Window, VectorExperimental>> children =
instance ? instance->GetAdjustedWindowChildren(window)
: window->children();
for (aura::Window* child : children) {
@ -158,7 +159,7 @@ std::vector<std::string> PrintWindowHierarchy(std::ostringstream* out,
void ToggleShowDebugBorders() {
aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows();
std::unique_ptr<cc::DebugBorderTypes> value;
for (auto* window : root_windows) {
for (aura::Window* window : root_windows) {
ui::Compositor* compositor = window->GetHost()->compositor();
cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState();
if (!value.get())
@ -172,7 +173,7 @@ void ToggleShowDebugBorders() {
void ToggleShowFpsCounter() {
aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows();
std::unique_ptr<bool> value;
for (auto* window : root_windows) {
for (aura::Window* window : root_windows) {
ui::Compositor* compositor = window->GetHost()->compositor();
cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState();
if (!value.get())
@ -185,7 +186,7 @@ void ToggleShowFpsCounter() {
void ToggleShowPaintRects() {
aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows();
std::unique_ptr<bool> value;
for (auto* window : root_windows) {
for (aura::Window* window : root_windows) {
ui::Compositor* compositor = window->GetHost()->compositor();
cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState();
if (!value.get())

@ -220,7 +220,8 @@ void ColorMatrixVectorFromSrgbToDeviceAndColorMatrix(
bool HasColorCorrectionMatrix(display::DisplayConfigurator* configurator,
int64_t display_id) {
for (const auto* display_snapshot : configurator->cached_displays()) {
for (const display::DisplaySnapshot* display_snapshot :
configurator->cached_displays()) {
if (display_snapshot->display_id() != display_id)
continue;
@ -263,7 +264,8 @@ bool DisplayColorManager::SetDisplayColorTemperatureAdjustment(
// Look up the calibration matrix, if one exists.
SkM44 srgb_to_device_matrix;
{
for (const auto* display_snapshot : configurator_->cached_displays()) {
for (const display::DisplaySnapshot* display_snapshot :
configurator_->cached_displays()) {
if (display_snapshot->display_id() != display_id) {
continue;
}

@ -24,7 +24,7 @@ void DisplayErrorObserver::OnDisplayModeChangeFailed(
display::MultipleDisplayState new_state) {
bool internal_display_failed = false;
LOG(ERROR) << "Failed to configure the following display(s):";
for (auto* display : displays) {
for (display::DisplaySnapshot* display : displays) {
const int64_t display_id = display->display_id();
internal_display_failed |= display::IsInternalDisplayId(display_id);
LOG(ERROR) << "- Display with ID = " << display_id << ", and EDID = "

@ -2296,7 +2296,7 @@ TEST_F(DisplayManagerTest, CloseDisplayByEvent) {
auto* mirror_window_controller =
Shell::Get()->window_tree_host_manager()->mirror_window_controller();
auto* host_root = mirror_window_controller->GetAllRootWindows()[1];
auto* host_root = mirror_window_controller->GetAllRootWindows()[1].get();
ui::test::EventGenerator generator(host_root);
generator.PressAndReleaseKey(ui::VKEY_A);

@ -16,10 +16,10 @@ namespace ash {
std::vector<aura::WindowTreeHost*> MirrorWindowTestApi::GetHosts() const {
std::vector<aura::WindowTreeHost*> hosts;
for (auto* window : Shell::Get()
->window_tree_host_manager()
->mirror_window_controller()
->GetAllRootWindows()) {
for (aura::Window* window : Shell::Get()
->window_tree_host_manager()
->mirror_window_controller()
->GetAllRootWindows()) {
hosts.emplace_back(window->GetHost());
}
return hosts;

@ -8,6 +8,7 @@
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
@ -25,7 +26,7 @@ display::DisplaySnapshot* GetSupportedDisplay() {
const auto& cached_displays =
Shell::Get()->display_configurator()->cached_displays();
for (auto* display : cached_displays) {
for (display::DisplaySnapshot* display : cached_displays) {
if (display->type() == display::DISPLAY_CONNECTION_TYPE_INTERNAL &&
display->privacy_screen_state() != display::kNotSupported &&
display->current_mode()) {
@ -140,7 +141,8 @@ void PrivacyScreenController::OnSigninScreenPrefServiceInitialized(
}
void PrivacyScreenController::OnDisplayModeChanged(
const std::vector<display::DisplaySnapshot*>& displays) {
const std::vector<raw_ptr<display::DisplaySnapshot, VectorExperimental>>&
displays) {
// OnDisplayModeChanged() may fire many times during Chrome's lifetime. We
// limit automatic user pref initialization to login screen only.
if (!applying_login_screen_prefs_)

@ -63,7 +63,8 @@ class ASH_EXPORT PrivacyScreenController
// DisplayConfigurator::Observer:
void OnDisplayModeChanged(
const std::vector<display::DisplaySnapshot*>& displays) override;
const std::vector<raw_ptr<display::DisplaySnapshot, VectorExperimental>>&
displays) override;
private:
// Calculates PrivacyScreen's logical status.

@ -681,7 +681,7 @@ void ScreenOrientationController::ApplyLockForTopMostWindowOnInternalDisplay() {
Shell::Get()->mru_window_tracker()->BuildWindowListIgnoreModal(
kActiveDesk));
for (auto* window : mru_windows) {
for (aura::Window* window : mru_windows) {
if (window->GetRootWindow() != internal_display_root)
continue;

@ -8,6 +8,7 @@
#include <vector>
#include "ash/ash_export.h"
#include "base/memory/raw_ptr.h"
#include "ui/aura/client/screen_position_client.h"
namespace ash {
@ -23,7 +24,8 @@ class ASH_EXPORT ScreenPositionController
// returns the other root window.
static void ConvertHostPointToRelativeToRootWindow(
aura::Window* root_window,
const std::vector<aura::Window*>& root_windows,
const std::vector<raw_ptr<aura::Window, VectorExperimental>>&
root_windows,
gfx::Point* point_in_host,
aura::Window** target_window);

@ -142,7 +142,7 @@ class TouchCalibratorControllerTest : public AshTestBase {
// Get the correct EventTarget for the given |display|.
aura::Window::Windows root_windows = Shell::GetAllRootWindows();
ui::EventTarget* event_target = nullptr;
for (auto* window : root_windows) {
for (aura::Window* window : root_windows) {
if (display::Screen::GetScreen()->GetDisplayNearestWindow(window).id() ==
display.id()) {
event_target = window;

@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "ash/drag_drop/tab_drag_drop_windows_hider.h"
#include "base/memory/raw_ptr.h"
#include <vector>
@ -32,7 +33,7 @@ TabDragDropWindowsHider::TabDragDropWindowsHider(aura::Window* source_window)
DCHECK(!Shell::Get()->overview_controller()->InOverviewSession());
std::vector<aura::Window*> windows =
std::vector<raw_ptr<aura::Window, VectorExperimental>> windows =
Shell::Get()->mru_window_tracker()->BuildMruWindowList(kActiveDesk);
for (aura::Window* window : windows) {
if (window == source_window_ || window->GetRootWindow() != root_window_) {

@ -42,7 +42,7 @@ EventRewriterControllerImpl::EventRewriterControllerImpl() {
EventRewriterControllerImpl::~EventRewriterControllerImpl() {
aura::Env::GetInstance()->RemoveObserver(this);
// Remove the rewriters from every root window EventSource.
for (auto* window : Shell::GetAllRootWindows()) {
for (aura::Window* window : Shell::GetAllRootWindows()) {
auto* event_source = window->GetHost()->GetEventSource();
for (const auto& rewriter : rewriters_) {
event_source->RemoveEventRewriter(rewriter.get());
@ -116,15 +116,17 @@ void EventRewriterControllerImpl::Initialize(
void EventRewriterControllerImpl::AddEventRewriter(
std::unique_ptr<ui::EventRewriter> rewriter) {
// Add the rewriters to each existing root window EventSource.
for (auto* window : Shell::GetAllRootWindows())
for (aura::Window* window : Shell::GetAllRootWindows()) {
window->GetHost()->GetEventSource()->AddEventRewriter(rewriter.get());
}
// In case there are any mirroring displays, their hosts' EventSources won't
// be included above.
const auto* mirror_window_controller =
Shell::Get()->window_tree_host_manager()->mirror_window_controller();
for (auto* window : mirror_window_controller->GetAllRootWindows())
for (aura::Window* window : mirror_window_controller->GetAllRootWindows()) {
window->GetHost()->GetEventSource()->AddEventRewriter(rewriter.get());
}
rewriters_.push_back(std::move(rewriter));
}

@ -104,7 +104,7 @@ bool FastInkPointerController::IsPointerInExcludedWindows(
aura::Window* event_target = static_cast<aura::Window*>(event->target());
wm::ConvertPointToScreen(event_target, &screen_location);
for (const auto* excluded_window : excluded_windows_.windows()) {
for (const aura::Window* excluded_window : excluded_windows_.windows()) {
if (excluded_window->GetBoundsInScreen().Contains(screen_location)) {
return true;
}

@ -87,7 +87,7 @@ void FocusCycler::RotateFocus(Direction direction, bool move_onto_next_widget) {
Shell::Get()->mru_window_tracker()->BuildMruWindowList(kActiveDesk));
if (mru_windows.empty())
break;
auto* window = mru_windows.front();
auto* window = mru_windows.front().get();
WindowState::Get(window)->Activate();
views::Widget* widget = views::Widget::GetWidgetForNativeView(window);
if (!widget)
@ -121,7 +121,7 @@ bool FocusCycler::FocusWidget(views::Widget* widget) {
views::Widget* FocusCycler::FindWidget(
base::RepeatingCallback<bool(views::Widget*)> callback) {
for (auto* widget : widgets_) {
for (views::Widget* widget : widgets_) {
if (callback.Run(widget))
return widget;
}

@ -53,7 +53,7 @@ class ASH_EXPORT FocusCycler {
base::RepeatingCallback<bool(views::Widget*)> callback);
private:
std::vector<views::Widget*> widgets_;
std::vector<raw_ptr<views::Widget, VectorExperimental>> widgets_;
// See description above getter.
raw_ptr<views::Widget, ExperimentalAsh> widget_activating_;

@ -39,7 +39,8 @@ class PanedWidgetDelegate : public views::WidgetDelegate {
public:
PanedWidgetDelegate(views::Widget* widget) : widget_(widget) {}
void SetAccessiblePanes(const std::vector<views::View*>& panes) {
void SetAccessiblePanes(
const std::vector<raw_ptr<views::View, VectorExperimental>>& panes) {
accessible_panes_ = panes;
}
@ -52,7 +53,7 @@ class PanedWidgetDelegate : public views::WidgetDelegate {
private:
raw_ptr<views::Widget, DanglingUntriaged | ExperimentalAsh> widget_;
std::vector<views::View*> accessible_panes_;
std::vector<raw_ptr<views::View, VectorExperimental>> accessible_panes_;
};
} // namespace
@ -317,7 +318,7 @@ TEST_F(FocusCyclerTest, CycleFocusThroughWindowWithPanes) {
view4->SetFocusBehavior(views::View::FocusBehavior::ALWAYS);
pane2->AddChildView(view4);
std::vector<views::View*> panes;
std::vector<raw_ptr<views::View, VectorExperimental>> panes;
panes.push_back(pane1);
panes.push_back(pane2);

@ -211,14 +211,14 @@ TEST_F(DefaultFrameHeaderTest, DeleteDuringAnimation) {
wm::ActivateWindow(win0.get());
auto* frame_view = NonClientFrameViewAsh::Get(win0.get());
auto* animating_layer_holding_view = frame_view->children()[0];
auto* animating_layer_holding_view = frame_view->children()[0].get();
EXPECT_TRUE(views::IsViewClass<chromeos::FrameHeader::FrameAnimatorView>(
animating_layer_holding_view));
ASSERT_TRUE(animating_layer_holding_view->layer());
ASSERT_GT(animating_layer_holding_view->layer()->parent()->children().size(),
2u);
auto* animating_layer =
animating_layer_holding_view->layer()->parent()->children()[0];
animating_layer_holding_view->layer()->parent()->children()[0].get();
EXPECT_EQ(ui::LAYER_TEXTURED, animating_layer->type());
EXPECT_TRUE(base::Contains(animating_layer->name(), ":Old"));
EXPECT_TRUE(animating_layer->GetAnimator()->is_animating());
@ -246,7 +246,7 @@ TEST_F(DefaultFrameHeaderTest, ResizeAndReorderDuringAnimation) {
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
auto* frame_view_0 = NonClientFrameViewAsh::Get(win_0.get());
auto* animating_layer_holding_view_0 = frame_view_0->children()[0];
auto* animating_layer_holding_view_0 = frame_view_0->children()[0].get();
EXPECT_TRUE(views::IsViewClass<chromeos::FrameHeader::FrameAnimatorView>(
animating_layer_holding_view_0));
size_t original_layers_count_0 =
@ -256,7 +256,7 @@ TEST_F(DefaultFrameHeaderTest, ResizeAndReorderDuringAnimation) {
auto* extra_view_1 =
frame_view_1->AddChildView(std::make_unique<views::View>());
auto* animating_layer_holding_view_1 = frame_view_1->children()[0];
auto* animating_layer_holding_view_1 = frame_view_1->children()[0].get();
EXPECT_TRUE(views::IsViewClass<chromeos::FrameHeader::FrameAnimatorView>(
animating_layer_holding_view_1));
size_t original_layers_count_1 =
@ -270,7 +270,7 @@ TEST_F(DefaultFrameHeaderTest, ResizeAndReorderDuringAnimation) {
animating_layer_holding_view_0->layer()->parent()->children().size(),
original_layers_count_0 + 1);
auto* animating_layer =
animating_layer_holding_view_0->layer()->parent()->children()[0];
animating_layer_holding_view_0->layer()->parent()->children()[0].get();
EXPECT_TRUE(animating_layer->GetAnimator()->is_animating());
LayerDestroyedChecker checker(animating_layer);
@ -290,7 +290,7 @@ TEST_F(DefaultFrameHeaderTest, ResizeAndReorderDuringAnimation) {
animating_layer_holding_view_1->layer()->parent()->children().size(),
original_layers_count_1 + 1);
auto* animating_layer =
animating_layer_holding_view_1->layer()->parent()->children()[0];
animating_layer_holding_view_1->layer()->parent()->children()[0].get();
EXPECT_TRUE(animating_layer->GetAnimator()->is_animating());
LayerDestroyedChecker checker(animating_layer);

@ -13,6 +13,7 @@
#include "ash/wm/mru_window_tracker.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/numerics/safe_conversions.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
@ -42,7 +43,7 @@ void CollectFrameSinkIds(const aura::Window* window,
frame_sink_ids->insert(id);
return;
}
for (auto* child : window->children()) {
for (aura::Window* child : window->children()) {
CollectFrameSinkIds(child, frame_sink_ids);
}
}
@ -65,7 +66,7 @@ void CollectBrowserFrameSinkIdsInWindow(
inside_browser = true;
}
for (auto* child : window->children()) {
for (aura::Window* child : window->children()) {
CollectBrowserFrameSinkIdsInWindow(child, inside_browser, ids,
frame_sink_ids);
}
@ -122,7 +123,7 @@ FrameThrottlingController::~FrameThrottlingController() {
}
void FrameThrottlingController::StartThrottling(
const std::vector<aura::Window*>& windows,
const std::vector<raw_ptr<aura::Window, VectorExperimental>>& windows,
base::TimeDelta requested_frame_interval) {
latest_custom_throttled_frame_interval_ = requested_frame_interval;
@ -142,7 +143,7 @@ void FrameThrottlingController::StartThrottling(
std::vector<aura::Window*> arc_windows;
arc_windows.reserve(windows.size());
for (auto* window : windows) {
for (aura::Window* window : windows) {
ash::AppType type =
static_cast<ash::AppType>(window->GetProperty(aura::client::kAppType));
switch (type) {
@ -361,7 +362,7 @@ void FrameThrottlingController::CollectLacrosWindowsInWindow(
}
}
for (auto* child : window->children()) {
for (aura::Window* child : window->children()) {
CollectLacrosWindowsInWindow(child, inside_lacros, ids, candidates,
lacros_window);
}
@ -379,8 +380,9 @@ void FrameThrottlingController::CollectLacrosCandidates(
lacros_window->AddObserver(this);
return;
}
for (auto* child : window->children())
for (aura::Window* child : window->children()) {
CollectLacrosCandidates(child, candidates, lacros_window);
}
}
bool FrameThrottlingController::HasCompositingBasedThrottling() const {

@ -103,7 +103,7 @@ class ASH_EXPORT FrameThrottlingController final
// If the |requested_frame_interval| is zero, the default throttled frame rate
// is used internally.
void StartThrottling(
const std::vector<aura::Window*>& windows,
const std::vector<raw_ptr<aura::Window, VectorExperimental>>& windows,
base::TimeDelta requested_frame_interval = base::TimeDelta());
// Ends throttling of all windows specified via StartThrottling(). The

@ -195,10 +195,12 @@ void GameDashboardController::GetWindowGameState(aura::Window* window) {
} else if (IsArcWindow(window)) {
// For ARC apps, the "app_id" is equivalent to its package name.
delegate_->GetIsGame(
*app_id, base::BindOnce(&GameDashboardController::OnArcWindowIsGame,
weak_ptr_factory_.GetWeakPtr(),
std::make_unique<aura::WindowTracker>(
std::vector<aura::Window*>({window}))));
*app_id, base::BindOnce(
&GameDashboardController::OnArcWindowIsGame,
weak_ptr_factory_.GetWeakPtr(),
std::make_unique<aura::WindowTracker>(
std::vector<raw_ptr<aura::Window, VectorExperimental>>(
{window}))));
} else {
RefreshWindowTracking(window, (*app_id == extension_misc::kGeForceNowAppId)
? WindowGameState::kGame

@ -246,7 +246,8 @@ TEST_F(GlanceablesTasksViewTest,
TEST_F(GlanceablesTasksViewTest, DoesNotAllowEditingToBlankTitle) {
tasks_client()->set_paused(true);
const auto* const task_view = GetTaskItemsContainerView()->children()[0];
const auto* const task_view =
GetTaskItemsContainerView()->children()[0].get();
{
const auto* const title_label =

@ -82,15 +82,17 @@ AshWindowTreeHostUnified::AshWindowTreeHostUnified(
}
AshWindowTreeHostUnified::~AshWindowTreeHostUnified() {
for (auto* ash_host : mirroring_hosts_)
for (ash::AshWindowTreeHost* ash_host : mirroring_hosts_) {
ash_host->AsWindowTreeHost()->window()->RemoveObserver(this);
}
}
void AshWindowTreeHostUnified::PrepareForShutdown() {
AshWindowTreeHostPlatform::PrepareForShutdown();
for (auto* host : mirroring_hosts_)
for (ash::AshWindowTreeHost* host : mirroring_hosts_) {
host->PrepareForShutdown();
}
}
void AshWindowTreeHostUnified::RegisterMirroringHost(
@ -109,18 +111,21 @@ void AshWindowTreeHostUnified::RegisterMirroringHost(
void AshWindowTreeHostUnified::UpdateCursorConfig() {}
void AshWindowTreeHostUnified::ClearCursorConfig() {
for (auto* host : mirroring_hosts_)
for (ash::AshWindowTreeHost* host : mirroring_hosts_) {
host->ClearCursorConfig();
}
}
void AshWindowTreeHostUnified::SetCursorNative(gfx::NativeCursor cursor) {
for (auto* host : mirroring_hosts_)
for (ash::AshWindowTreeHost* host : mirroring_hosts_) {
host->AsWindowTreeHost()->SetCursor(cursor);
}
}
void AshWindowTreeHostUnified::OnCursorVisibilityChangedNative(bool show) {
for (auto* host : mirroring_hosts_)
for (ash::AshWindowTreeHost* host : mirroring_hosts_) {
host->AsWindowTreeHost()->OnCursorVisibilityChanged(show);
}
}
void AshWindowTreeHostUnified::OnBoundsChanged(const BoundsChange& change) {

@ -8,6 +8,7 @@
#include <vector>
#include "ash/host/ash_window_tree_host_platform.h"
#include "base/memory/raw_ptr.h"
#include "ui/aura/window_observer.h"
namespace ash {
@ -46,7 +47,7 @@ class AshWindowTreeHostUnified : public AshWindowTreeHostPlatform,
// aura::WindowObserver:
void OnWindowDestroying(aura::Window* window) override;
std::vector<AshWindowTreeHost*> mirroring_hosts_;
std::vector<raw_ptr<AshWindowTreeHost, VectorExperimental>> mirroring_hosts_;
};
} // namespace ash

@ -89,7 +89,7 @@ void GraphsContainerView::UpdateData(
: 1;
data_update_count_ += intervals;
for (auto* child : children()) {
for (views::View* child : children()) {
// Insert missing points.
for (unsigned j = 0; j < intervals; ++j)
static_cast<GraphPageViewBase*>(child)->UpdateData(*snapshot);
@ -117,8 +117,9 @@ void GraphsContainerView::SetMode(HUDDisplayMode mode) {
DCHECK(selected);
return;
}
for (auto* child : children())
for (views::View* child : children()) {
child->SetVisible(false);
}
selected->SetVisible(true);
}

@ -143,7 +143,7 @@ void HUDHeaderLayout::Layout(views::View* host) {
const gfx::Size preferred_size = data_view_->GetPreferredSize();
for (auto* child : host->children()) {
for (views::View* child : host->children()) {
if (child != padding_) {
child->SetPosition({0, 0});
child->SetSize(preferred_size);

@ -112,7 +112,7 @@ base::RepeatingCallback<void(views::Checkbox*)> GetCCDebugUpdateStateCallback(
views::Checkbox* checkbox) {
bool is_enabled = false;
aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows();
for (auto* window : root_windows) {
for (aura::Window* window : root_windows) {
ui::Compositor* compositor = window->GetHost()->compositor();
is_enabled |= compositor->GetLayerTreeDebugState().*field;
}
@ -126,7 +126,7 @@ base::RepeatingCallback<void(views::Checkbox*)> GetCCDebugHandleClickCallback(
return base::BindRepeating(
[](bool cc::LayerTreeDebugState::*field, views::Checkbox* checkbox) {
aura::Window::Windows root_windows = Shell::Get()->GetAllRootWindows();
for (auto* window : root_windows) {
for (aura::Window* window : root_windows) {
ui::Compositor* compositor = window->GetHost()->compositor();
cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState();
state.*field = checkbox->GetChecked();
@ -341,11 +341,13 @@ void AnimationSpeedControl::SliderValueChanged(
void AnimationSpeedControl::Layout() {
gfx::Size max_size;
// Make all labels equal size.
for (const auto* label : hints_container_->children())
for (const views::View* label : hints_container_->children()) {
max_size.SetToMax(label->GetPreferredSize());
}
for (auto* label : hints_container_->children())
for (views::View* label : hints_container_->children()) {
label->SetPreferredSize(max_size);
}
gfx::Size hints_total_size = hints_container_->GetPreferredSize();
// Slider should begin in the middle of the first label, and end in the

@ -182,7 +182,7 @@ void Legend::Layout() {
gfx::Size max_size;
bool updated = false;
for (auto* view : children()) {
for (views::View* view : children()) {
if (std::string_view(view->GetClassName()) !=
std::string_view(LegendEntry::kViewClassName)) {
continue;
@ -193,7 +193,7 @@ void Legend::Layout() {
updated |= max_size != value->GetPreferredSize();
}
if (updated) {
for (auto* view : children()) {
for (views::View* view : children()) {
if (std::string_view(view->GetClassName()) !=
std::string_view(LegendEntry::kViewClassName)) {
continue;
@ -206,7 +206,7 @@ void Legend::Layout() {
}
void Legend::SetValuesIndex(size_t index) {
for (auto* view : children()) {
for (views::View* view : children()) {
if (std::string_view(view->GetClassName()) !=
std::string_view(LegendEntry::kViewClassName)) {
continue;
@ -217,7 +217,7 @@ void Legend::SetValuesIndex(size_t index) {
}
void Legend::RefreshValues() {
for (auto* view : children()) {
for (views::View* view : children()) {
if (std::string_view(view->GetClassName()) !=
std::string_view(LegendEntry::kViewClassName)) {
continue;

@ -42,7 +42,7 @@ class HUDTabStripLayout : public views::LayoutManager {
gfx::Size HUDTabStripLayout::GetPreferredSize(const views::View* host) const {
gfx::Size result;
for (const auto* child : host->children()) {
for (const views::View* child : host->children()) {
const gfx::Size child_preferred = child->GetPreferredSize();
// Tab strip is always horizontal.
result.set_width(result.width() + child_preferred.width() -
@ -63,7 +63,7 @@ void HUDTabStripLayout::Layout(views::View* host) {
// Assume all children have equal left and right border, which is used to
// overlay the tabs.
int left_offset = 0;
for (auto* child : host->children()) {
for (views::View* child : host->children()) {
const gfx::Size preferred = child->GetPreferredSize();
const gfx::Size child_size({preferred.width(), host->height()});
child->SetSize(child_size);
@ -181,7 +181,7 @@ HUDTabButton* HUDTabStrip::AddTabButton(const HUDDisplayMode display_mode,
display_mode, label));
tab_button->SetCallback(base::BindRepeating(
[](HUDTabButton* sender, HUDTabStrip* tab_strip) {
for (const auto* tab : tab_strip->tabs_) {
for (const ash::hud_display::HUDTabButton* tab : tab_strip->tabs_) {
if (tab == sender) {
tab_strip->hud_->SetDisplayMode(tab->display_mode());
return;

@ -80,7 +80,8 @@ class HUDTabStrip : public views::View {
private:
raw_ptr<HUDDisplayView, ExperimentalAsh> hud_;
std::vector<HUDTabButton*> tabs_; // Ordered list of child tabs.
std::vector<raw_ptr<HUDTabButton, VectorExperimental>>
tabs_; // Ordered list of child tabs.
};
} // namespace hud_display

@ -325,7 +325,7 @@ void FixedLengthCodeInput::Backspace() {
std::optional<std::string> FixedLengthCodeInput::GetCode() const {
std::string result;
size_t length;
for (auto* field : input_fields_) {
for (ash::AccessibleInputField* field : input_fields_) {
length = field->GetText().length();
if (!length) {
return std::nullopt;
@ -343,7 +343,7 @@ void FixedLengthCodeInput::SetInputColorId(ui::ColorId color_id) {
? static_cast<ui::ColorId>(cros_tokens::kCrosSysError)
: kColorAshTextColorAlert;
for (auto* field : input_fields_) {
for (ash::AccessibleInputField* field : input_fields_) {
field->SetTextColorId(color_id);
// We don't update the underline color to red.
if (color_id != error_color_id) {
@ -528,7 +528,7 @@ bool FixedLengthCodeInput::HandleGestureEvent(
}
void FixedLengthCodeInput::SetInputEnabled(bool input_enabled) {
for (auto* field : input_fields_) {
for (ash::AccessibleInputField* field : input_fields_) {
field->SetEnabled(input_enabled);
}
}
@ -538,7 +538,7 @@ void FixedLengthCodeInput::SetReadOnly(bool read_only) {
const ui::ColorId underline_color_id =
is_jelly ? static_cast<ui::ColorId>(cros_tokens::kCrosSysOnSurface)
: kColorAshTextColorPrimary;
for (auto* field : input_fields_) {
for (ash::AccessibleInputField* field : input_fields_) {
field->SetReadOnly(read_only);
field->SetBackground(nullptr);
field->SetBorder(views::CreateThemedSolidSidedBorder(
@ -560,7 +560,7 @@ bool FixedLengthCodeInput::IsReadOnly() const {
}
void FixedLengthCodeInput::ClearInput() {
for (auto* field : input_fields_) {
for (ash::AccessibleInputField* field : input_fields_) {
field->SetText(std::u16string());
}
active_input_index_ = 0;
@ -569,7 +569,7 @@ void FixedLengthCodeInput::ClearInput() {
}
bool FixedLengthCodeInput::IsEmpty() const {
for (auto* field : input_fields_) {
for (ash::AccessibleInputField* field : input_fields_) {
if (field->GetText().length()) {
return false;
}

@ -295,7 +295,7 @@ class FixedLengthCodeInput : public AccessCodeInput {
int active_input_index_ = 0;
// Unowned input textfields ordered from the first to the last digit.
std::vector<AccessibleInputField*> input_fields_;
std::vector<raw_ptr<AccessibleInputField, VectorExperimental>> input_fields_;
// Value of current input, associate with AX event. The value will be the
// concat string of input fields. i.e. [1][2][3][|][][], text_value_for_a11y_

@ -2480,7 +2480,7 @@ bool LockContentsView::GetSystemInfoVisibility() const {
}
void LockContentsView::UpdateSystemInfoColors() {
for (auto* child : system_info_->children()) {
for (views::View* child : system_info_->children()) {
views::Label* label = static_cast<views::Label*>(child);
label->SetEnabledColorId(kColorAshTextColorPrimary);
}

@ -2768,7 +2768,7 @@ TEST_F(LockContentsViewUnitTest, LoginNotReactingOnEventsWithOobeDialogShown) {
LockContentsViewTestApi lock_contents(contents);
ScrollableUsersListView::TestApi users_list(lock_contents.users_list());
const auto* const list_user_view = users_list.user_views()[0];
const auto* const list_user_view = users_list.user_views()[0].get();
LoginBigUserView* auth_view = lock_contents.primary_big_view();
AccountId auth_view_user =
@ -3148,7 +3148,7 @@ TEST_F(LockContentsViewUnitTest,
LockContentsViewTestApi lock_contents(contents);
ScrollableUsersListView::TestApi users_list(lock_contents.users_list());
const auto* const list_user_view = users_list.user_views()[0];
const auto* const list_user_view = users_list.user_views()[0].get();
LoginBigUserView* auth_view = lock_contents.primary_big_view();
AccountId auth_view_user =

@ -397,7 +397,7 @@ LockScreenMediaControlsView::LockScreenMediaControlsView(
this, kPlayPauseIconSize, MediaSessionAction::kPause,
l10n_util::GetStringUTF16(
IDS_ASH_LOCK_SCREEN_MEDIA_CONTROLS_ACTION_PAUSE)));
media_action_buttons_.push_back(play_pause_button_);
media_action_buttons_.push_back(play_pause_button_.get());
media_action_buttons_.push_back(
right_control_group->AddChildView(std::make_unique<MediaActionButton>(

@ -244,7 +244,7 @@ class ASH_EXPORT LockScreenMediaControlsView
raw_ptr<media_message_center::MediaControlsProgressView, ExperimentalAsh>
progress_ = nullptr;
std::vector<views::Button*> media_action_buttons_;
std::vector<raw_ptr<views::Button, VectorExperimental>> media_action_buttons_;
// Callbacks.
const MediaControlsEnabled media_controls_enabled_;

@ -256,7 +256,8 @@ class LockScreenMediaControlsViewTest : public LoginTestBase {
return header_row()->close_button_for_testing();
}
std::vector<views::Button*>& media_action_buttons() const {
std::vector<raw_ptr<views::Button, VectorExperimental>>&
media_action_buttons() const {
return media_controls_view_->media_action_buttons_;
}
@ -380,7 +381,7 @@ TEST_F(LockScreenMediaControlsViewTest, ButtonsSanityCheck) {
EXPECT_EQ(5u, media_action_buttons().size());
for (int i = 0; i < 5; /* size of |button_row| */ i++) {
auto* child = media_action_buttons()[i];
auto* child = media_action_buttons()[i].get();
ASSERT_TRUE(IsMediaButtonType(child));

@ -157,7 +157,7 @@ class LoginAuthFactorsViewUnittest : public LoginTestBase {
size_t GetVisibleIconCount() {
LoginAuthFactorsView::TestApi test_api(view_);
size_t count = 0;
for (auto* icon : test_api.auth_factor_icon_row()->children()) {
for (views::View* icon : test_api.auth_factor_icon_row()->children()) {
if (icon->GetVisible()) {
count++;
}
@ -213,14 +213,14 @@ class LoginAuthFactorsViewUnittest : public LoginTestBase {
raw_ptr<views::View, ExperimentalAsh> container_ = nullptr;
raw_ptr<LoginAuthFactorsView, ExperimentalAsh> view_ =
nullptr; // Owned by container.
std::vector<FakeAuthFactorModel*> auth_factors_;
std::vector<raw_ptr<FakeAuthFactorModel, VectorExperimental>> auth_factors_;
bool click_to_enter_called_ = false;
bool auth_factor_is_hiding_password_ = false;
};
TEST_F(LoginAuthFactorsViewUnittest, TapOrClickCalled) {
AddAuthFactors({AuthFactorType::kFingerprint, AuthFactorType::kSmartLock});
auto* factor = auth_factors_[0];
auto* factor = auth_factors_[0].get();
// RefreshUI() calls UpdateIcon(), which captures a pointer to the
// icon.
@ -238,11 +238,11 @@ TEST_F(LoginAuthFactorsViewUnittest, ShouldAnnounceLabel) {
LoginAuthFactorsView::TestApi test_api(view_);
views::Label* label = test_api.label();
ScopedAXEventObserver alert_observer(label, ax::mojom::Event::kAlert);
for (auto* factor : auth_factors_) {
for (FakeAuthFactorModel* factor : auth_factors_) {
factor->state_ = AuthFactorState::kAvailable;
}
auto* factor = auth_factors_[0];
auto* factor = auth_factors_[0].get();
ASSERT_FALSE(factor->ShouldAnnounceLabel());
ASSERT_FALSE(alert_observer.event_called);
@ -489,7 +489,7 @@ TEST_F(LoginAuthFactorsViewUnittest, ErrorPermanent) {
auth_factors_[0]->state_ = AuthFactorState::kErrorPermanent;
auth_factors_[1]->state_ = AuthFactorState::kReady;
test_api.UpdateState();
auto* factor = auth_factors_[0];
auto* factor = auth_factors_[0].get();
EXPECT_TRUE(test_api.auth_factor_icon_row()->GetVisible());
EXPECT_FALSE(test_api.checkmark_icon()->GetVisible());

@ -204,7 +204,7 @@ TEST_P(LoginExpandedPublicAccountViewTest, ShowLearnMoreDialog) {
// Tap on the learn more link.
const auto& children = test_api.learn_more_label()->children();
const auto it = base::ranges::find_if(children, [](auto* child) {
const auto it = base::ranges::find_if(children, [](views::View* child) {
return views::IsViewClass<views::LinkFragment>(child);
});
DCHECK(it != children.cend());

@ -127,8 +127,8 @@ class ASH_EXPORT LoginPinView : public NonAccessibleView {
// The submit button does not exist when no |on_submit| callback is passed.
raw_ptr<SubmitPinButton, ExperimentalAsh> submit_button_ = nullptr;
std::vector<NonAccessibleView*> rows_;
std::vector<DigitPinButton*> digit_buttons_;
std::vector<raw_ptr<NonAccessibleView, VectorExperimental>> rows_;
std::vector<raw_ptr<DigitPinButton, VectorExperimental>> digit_buttons_;
};
} // namespace ash

@ -89,7 +89,7 @@ LoginUserInfo CreatePublicAccountUser(const std::string& email) {
bool HasFocusInAnyChildView(const views::View* view) {
return view->HasFocus() ||
base::ranges::any_of(view->children(), [](const auto* v) {
base::ranges::any_of(view->children(), [](const views::View* v) {
return HasFocusInAnyChildView(v);
});
}
@ -116,7 +116,7 @@ bool TabThroughView(ui::test::EventGenerator* event_generator,
// Performs a DFS for the first button in the views hierarchy
// The last child is on the top of the z layer stack
views::View* FindTopButton(views::View* current_view) {
for (auto* child : base::Reversed(current_view->children())) {
for (views::View* child : base::Reversed(current_view->children())) {
if (views::Button::AsButton(child)) {
return child;
}

@ -125,7 +125,7 @@ class EnterpriseBadgeLayout : public views::LayoutManager {
DCHECK_EQ(host->children().size(), 1U);
const gfx::Rect content_bounds(host->GetContentsBounds());
const int offset = content_bounds.width() - size_;
auto* child = host->children()[0];
auto* child = host->children()[0].get();
child->SetPosition({offset, offset});
child->SetSize({size_, size_});
}

@ -19,6 +19,7 @@
#include "ash/wallpaper/wallpaper_controller_impl.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "cc/paint/paint_flags.h"
#include "cc/paint/paint_shader.h"
#include "chromeos/constants/chromeos_features.h"
@ -169,7 +170,7 @@ ScrollableUsersListView::TestApi::TestApi(ScrollableUsersListView* view)
ScrollableUsersListView::TestApi::~TestApi() = default;
const std::vector<LoginUserView*>&
const std::vector<raw_ptr<LoginUserView, VectorExperimental>>&
ScrollableUsersListView::TestApi::user_views() const {
return view_->user_views_;
}
@ -234,7 +235,7 @@ ScrollableUsersListView::~ScrollableUsersListView() = default;
LoginUserView* ScrollableUsersListView::GetUserView(
const AccountId& account_id) {
for (auto* view : user_views_) {
for (ash::LoginUserView* view : user_views_) {
if (view->current_user().basic_user_info.account_id == account_id) {
return view;
}

@ -39,7 +39,8 @@ class ASH_EXPORT ScrollableUsersListView : public views::ScrollView,
explicit TestApi(ScrollableUsersListView* view);
~TestApi();
const std::vector<LoginUserView*>& user_views() const;
const std::vector<raw_ptr<LoginUserView, VectorExperimental>>& user_views()
const;
private:
const raw_ptr<ScrollableUsersListView, ExperimentalAsh> view_;
@ -106,7 +107,7 @@ class ASH_EXPORT ScrollableUsersListView : public views::ScrollView,
// Layout for |user_view_host_|.
raw_ptr<views::BoxLayout, ExperimentalAsh> user_view_host_layout_ = nullptr;
std::vector<LoginUserView*> user_views_;
std::vector<raw_ptr<LoginUserView, VectorExperimental>> user_views_;
GradientParams gradient_params_;

@ -177,7 +177,7 @@ views::View* GetBubbleContainer(views::View* view) {
// An arbitrary id that no other child of root view should use.
const int kMenuContainerId = 1000;
views::View* container = nullptr;
for (auto* child : root_view->children()) {
for (views::View* child : root_view->children()) {
if (child->GetID() == kMenuContainerId) {
container = child;
break;

@ -16,6 +16,7 @@
#include "ash/wm/window_positioner.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/compositor/layer.h"
@ -74,7 +75,8 @@ class MaximizedWindowAnimationWatcher : public ui::ImplicitAnimationObserver {
// Modifies the given |window_list| such that the most-recently used window (if
// any, and if it exists in |window_list|) will be the last window in the list.
void PutMruWindowLast(std::vector<aura::Window*>* window_list) {
void PutMruWindowLast(
std::vector<raw_ptr<aura::Window, VectorExperimental>>* window_list) {
DCHECK(window_list);
auto it = base::ranges::find_if(*window_list, &wm::IsActiveWindow);
if (it == window_list->end())
@ -228,7 +230,7 @@ void UserSwitchAnimator::TransitionWindows(AnimationStep animation_step) {
// activateable window to restore focus to, and so we don't change
// window order (crbug.com/424307).
PutMruWindowLast(&(user_pair.second));
for (auto* window : user_pair.second) {
for (aura::Window* window : user_pair.second) {
// Minimized visiting windows (minimized windows with an owner
// different than that of the for_show_account_id) should return to
// their
@ -282,7 +284,7 @@ void UserSwitchAnimator::TransitionWindows(AnimationStep animation_step) {
return;
}
for (auto* window : new_user_itr->second) {
for (aura::Window* window : new_user_itr->second) {
auto entry = owner_->window_to_entry().find(window);
DCHECK(entry != owner_->window_to_entry().end());
@ -364,7 +366,7 @@ void UserSwitchAnimator::BuildUserToWindowsListMap() {
aura::Window* parent_window = window_entry_pair.first->parent();
if (!base::Contains(parent_windows, parent_window)) {
parent_windows.insert(parent_window);
for (auto* child_window : parent_window->children()) {
for (aura::Window* child_window : parent_window->children()) {
auto itr = window_to_entry_map.find(child_window);
if (itr != window_to_entry_map.end()) {
windows_by_account_id_[itr->second->show_for_user()].push_back(

@ -15,6 +15,7 @@ namespace {
using ::testing::AllOf;
using ::testing::ElementsAre;
using ::testing::IsEmpty;
using ::testing::Pointee;
using ::testing::Property;
using PickerContentsViewTest = AshTestBase;
@ -36,8 +37,9 @@ TEST_F(PickerContentsViewTest, AddPageCreatesHiddenChildren) {
EXPECT_THAT(
view->children(),
ElementsAre(AllOf(page1, Property(&views::View::GetVisible, false)),
AllOf(page2, Property(&views::View::GetVisible, false))));
ElementsAre(
AllOf(page1, Pointee(Property(&views::View::GetVisible, false))),
AllOf(page2, Pointee(Property(&views::View::GetVisible, false)))));
}
TEST_F(PickerContentsViewTest, SetActivePageChangesVisibility) {
@ -50,15 +52,17 @@ TEST_F(PickerContentsViewTest, SetActivePageChangesVisibility) {
EXPECT_THAT(
view->children(),
ElementsAre(AllOf(page1, Property(&views::View::GetVisible, true)),
AllOf(page2, Property(&views::View::GetVisible, false))));
ElementsAre(
AllOf(page1, Pointee(Property(&views::View::GetVisible, true))),
AllOf(page2, Pointee(Property(&views::View::GetVisible, false)))));
view->SetActivePage(page2);
EXPECT_THAT(
view->children(),
ElementsAre(AllOf(page1, Property(&views::View::GetVisible, false)),
AllOf(page2, Property(&views::View::GetVisible, true))));
ElementsAre(
AllOf(page1, Pointee(Property(&views::View::GetVisible, false))),
AllOf(page2, Pointee(Property(&views::View::GetVisible, true)))));
}
} // namespace

@ -10,6 +10,7 @@
#include "ash/ash_export.h"
#include "ash/public/cpp/app_list/app_list_types.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
namespace aura {
class Window;
@ -19,7 +20,8 @@ class Window;
namespace ash {
// Get application windows, windows that are shown in overview grid.
ASH_EXPORT std::vector<aura::Window*> GetAppWindowList();
ASH_EXPORT std::vector<raw_ptr<aura::Window, VectorExperimental>>
GetAppWindowList();
// Runs the callback when the launcher state becomes |state| after
// state transition animation. For clamshell launcher, it invokes closure

@ -10,6 +10,7 @@
#include <vector>
#include "ash/ash_export.h"
#include "base/memory/raw_ptr.h"
namespace aura {
class Window;
@ -25,11 +26,11 @@ namespace debug {
class ASH_EXPORT DebugWindowHierarchyDelegate {
public:
virtual ~DebugWindowHierarchyDelegate() = default;
virtual std::vector<aura::Window*> GetAdjustedWindowChildren(
aura::Window* window) const = 0;
virtual std::vector<raw_ptr<aura::Window, VectorExperimental>>
GetAdjustedWindowChildren(aura::Window* window) const = 0;
virtual std::vector<ui::Layer*> GetAdjustedLayerChildren(
const ui::Layer* layer) const = 0;
virtual std::vector<raw_ptr<ui::Layer, VectorExperimental>>
GetAdjustedLayerChildren(const ui::Layer* layer) const = 0;
};
ASH_EXPORT void SetDebugWindowHierarchyDelegate(

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