[go: nahoru, domu]

[Shelf] Refactor: use a non-inline method to access LoginShelfView

With this CL, the LoginShelfView instance that resides in ShelfWidget
is accessed through `ShelfWidget::GetLoginShelfView()` rather than
`ShelfWidget::login_shelf_view()` or the pointer to the instance. It
helps the subsequent CLs to move LoginShelfView to its own widget.

This CL should not bring any noticeable changes.

Bug: 1197052
Change-Id: I405693f6c37defa99c70134d11d96e33f230546f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3752057
Reviewed-by: Toni Barzic <tbarzic@chromium.org>
Commit-Queue: Andrew Xu <andrewxu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1023407}
diff --git a/ash/login/login_screen_controller.cc b/ash/login/login_screen_controller.cc
index 4144f35..149df804 100644
--- a/ash/login/login_screen_controller.cc
+++ b/ash/login/login_screen_controller.cc
@@ -308,7 +308,7 @@
   // Tell the focus direction to the status area or the shelf so they can focus
   // the correct child view.
   if (Shell::GetPrimaryRootWindowController()->IsSystemTrayVisible() &&
-      (reverse || !shelf->shelf_widget()->login_shelf_view()->IsFocusable())) {
+      (reverse || !shelf->shelf_widget()->GetLoginShelfView()->IsFocusable())) {
     // Focus goes to system tray (status area) if one of the following is true:
     //  - system tray is visible and tab is in reverse order;
     //  - system tray is visible and there is no visible shelf buttons before.
@@ -316,7 +316,7 @@
         ->status_area_widget_delegate()
         ->set_default_last_focusable_child(reverse);
     Shell::Get()->focus_cycler()->FocusWidget(shelf->GetStatusAreaWidget());
-  } else if (shelf->shelf_widget()->login_shelf_view()->IsFocusable()) {
+  } else if (shelf->shelf_widget()->GetLoginShelfView()->IsFocusable()) {
     // Otherwise focus goes to shelf buttons when there is any.
     shelf->shelf_widget()->set_default_last_focusable_child(reverse);
     Shell::Get()->focus_cycler()->FocusWidget(shelf->shelf_widget());
@@ -333,42 +333,42 @@
 void LoginScreenController::EnableAddUserButton(bool enable) {
   Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
       ->shelf_widget()
-      ->login_shelf_view()
+      ->GetLoginShelfView()
       ->SetAddUserButtonEnabled(enable);
 }
 
 void LoginScreenController::EnableShutdownButton(bool enable) {
   Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
       ->shelf_widget()
-      ->login_shelf_view()
+      ->GetLoginShelfView()
       ->SetShutdownButtonEnabled(enable);
 }
 
 void LoginScreenController::EnableShelfButtons(bool enable) {
   Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
       ->shelf_widget()
-      ->login_shelf_view()
+      ->GetLoginShelfView()
       ->SetButtonEnabled(enable);
 }
 
 void LoginScreenController::SetIsFirstSigninStep(bool is_first) {
   Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
       ->shelf_widget()
-      ->login_shelf_view()
+      ->GetLoginShelfView()
       ->SetIsFirstSigninStep(is_first);
 }
 
 void LoginScreenController::ShowParentAccessButton(bool show) {
   Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
       ->shelf_widget()
-      ->login_shelf_view()
+      ->GetLoginShelfView()
       ->ShowParentAccessButton(show);
 }
 
 void LoginScreenController::SetAllowLoginAsGuest(bool allow_guest) {
   Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
       ->shelf_widget()
-      ->login_shelf_view()
+      ->GetLoginShelfView()
       ->SetAllowLoginAsGuest(allow_guest);
 }
 
@@ -376,7 +376,7 @@
 LoginScreenController::GetScopedGuestButtonBlocker() {
   return Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
       ->shelf_widget()
-      ->login_shelf_view()
+      ->GetLoginShelfView()
       ->GetScopedGuestButtonBlocker();
 }
 
@@ -418,7 +418,7 @@
     const std::vector<KioskAppMenuEntry>& kiosk_apps) {
   Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
       ->shelf_widget()
-      ->login_shelf_view()
+      ->GetLoginShelfView()
       ->SetKioskApps(kiosk_apps);
 }
 
@@ -427,7 +427,7 @@
     const base::RepeatingClosure& on_show_menu) {
   Shelf::ForWindow(Shell::Get()->GetPrimaryRootWindow())
       ->shelf_widget()
-      ->login_shelf_view()
+      ->GetLoginShelfView()
       ->ConfigureKioskCallbacks(launch_app, on_show_menu);
 }