[go: nahoru, domu]

vsplit: Rename left/right snap to prim/secondary in chromeos and exo

To support snap top and bottom in portrait layout, rename left/right
snap to primary/secondary snap position:
- Rename enums chromeos::SnapDirection and WaylandWindowSnapDirection
kLeft/Right to kPrimary/Secondary.
- Rename Left/RightSnap function names to Primary/Secondary in exo.
Example functions are `ShellSurfaceBase::SetSnappedToLeft()` and
`AuraSurface::SetSnapLeft()`.

Bug: 1233194
Test: Manual and dry-run affected unit tests
Change-Id: I2907b738b6fa2642ae6a6757cf8e64fecbae0e8a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3192934
Reviewed-by: James Cook <jamescook@chromium.org>
Reviewed-by: Mitsuru Oshima (exo only) <oshima@chromium.org>
Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Cattalyya Nuengsigkapian <cattalyya@chromium.org>
Cr-Commit-Position: refs/heads/main@{#927464}
diff --git a/ash/frame/snap_controller_impl.cc b/ash/frame/snap_controller_impl.cc
index e388cfa..8d31bc3 100644
--- a/ash/frame/snap_controller_impl.cc
+++ b/ash/frame/snap_controller_impl.cc
@@ -32,12 +32,11 @@
     phantom_window_controller_ =
         std::make_unique<PhantomWindowController>(window);
   }
+  const SnapViewType snap_type = snap == chromeos::SnapDirection::kPrimary
+                                     ? SnapViewType::kPrimary
+                                     : SnapViewType::kSecondary;
   gfx::Rect phantom_bounds_in_screen =
-      (snap == chromeos::SnapDirection::kLeft)
-          ? GetDefaultSnappedWindowBoundsInParent(window,
-                                                  SnapViewType::kPrimary)
-          : GetDefaultSnappedWindowBoundsInParent(window,
-                                                  SnapViewType::kSecondary);
+      GetDefaultSnappedWindowBoundsInParent(window, snap_type);
   ::wm::ConvertRectToScreen(window->parent(), &phantom_bounds_in_screen);
   phantom_window_controller_->Show(phantom_bounds_in_screen);
 }
@@ -49,7 +48,7 @@
     return;
 
   WindowState* window_state = WindowState::Get(window);
-  const WMEvent snap_event(snap == chromeos::SnapDirection::kLeft
+  const WMEvent snap_event(snap == chromeos::SnapDirection::kPrimary
                                ? WM_EVENT_SNAP_PRIMARY
                                : WM_EVENT_SNAP_SECONDARY);
   window_state->OnWMEvent(&snap_event);
diff --git a/chrome/browser/ash/app_restore/arc_ghost_window_delegate.cc b/chrome/browser/ash/app_restore/arc_ghost_window_delegate.cc
index ad54abe..6c6de85 100644
--- a/chrome/browser/ash/app_restore/arc_ghost_window_delegate.cc
+++ b/chrome/browser/ash/app_restore/arc_ghost_window_delegate.cc
@@ -120,9 +120,9 @@
            requested_state == chromeos::WindowStateType::kSecondarySnapped);
 
     if (requested_state == chromeos::WindowStateType::kPrimarySnapped)
-      shell_surface_->SetSnappedToLeft();
+      shell_surface_->SetSnappedToPrimary();
     else
-      shell_surface_->SetSnappedToRight();
+      shell_surface_->SetSnappedToSecondary();
     // TODO(sstan): Currently the snap state will be ignored. Sync it to ARC.
   }
   shell_surface_->OnSurfaceCommit();
diff --git a/chrome/browser/lacros/snap_controller_lacros.cc b/chrome/browser/lacros/snap_controller_lacros.cc
index 15e07729..f03d8c3 100644
--- a/chrome/browser/lacros/snap_controller_lacros.cc
+++ b/chrome/browser/lacros/snap_controller_lacros.cc
@@ -16,10 +16,10 @@
   switch (snap) {
     case chromeos::SnapDirection::kNone:
       return ui::WaylandWindowSnapDirection::kNone;
-    case chromeos::SnapDirection::kLeft:
-      return ui::WaylandWindowSnapDirection::kLeft;
-    case chromeos::SnapDirection::kRight:
-      return ui::WaylandWindowSnapDirection::kRight;
+    case chromeos::SnapDirection::kPrimary:
+      return ui::WaylandWindowSnapDirection::kPrimary;
+    case chromeos::SnapDirection::kSecondary:
+      return ui::WaylandWindowSnapDirection::kSecondary;
   }
 }
 
diff --git a/chromeos/ui/frame/caption_buttons/frame_size_button.cc b/chromeos/ui/frame/caption_buttons/frame_size_button.cc
index c14b2dc..6ce3fc4 100644
--- a/chromeos/ui/frame/caption_buttons/frame_size_button.cc
+++ b/chromeos/ui/frame/caption_buttons/frame_size_button.cc
@@ -46,9 +46,9 @@
   if (to_hover) {
     switch (to_hover->GetIcon()) {
       case views::CAPTION_BUTTON_ICON_LEFT_SNAPPED:
-        return SnapDirection::kLeft;
+        return SnapDirection::kPrimary;
       case views::CAPTION_BUTTON_ICON_RIGHT_SNAPPED:
-        return SnapDirection::kRight;
+        return SnapDirection::kSecondary;
       case views::CAPTION_BUTTON_ICON_MAXIMIZE_RESTORE:
       case views::CAPTION_BUTTON_ICON_MINIMIZE:
       case views::CAPTION_BUTTON_ICON_CLOSE:
@@ -290,9 +290,9 @@
   delegate_->CommitSnap(snap);
   delegate_->SetHoveredAndPressedButtons(nullptr, nullptr);
 
-  if (snap == SnapDirection::kLeft) {
+  if (snap == SnapDirection::kPrimary) {
     base::RecordAction(base::UserMetricsAction("MaxButton_MaxLeft"));
-  } else if (snap == SnapDirection::kRight) {
+  } else if (snap == SnapDirection::kSecondary) {
     base::RecordAction(base::UserMetricsAction("MaxButton_MaxRight"));
   } else {
     SetButtonsToNormalMode(FrameSizeButtonDelegate::Animate::kYes);
diff --git a/chromeos/ui/frame/caption_buttons/snap_controller.h b/chromeos/ui/frame/caption_buttons/snap_controller.h
index cd98aa5..e51aa7bd 100644
--- a/chromeos/ui/frame/caption_buttons/snap_controller.h
+++ b/chromeos/ui/frame/caption_buttons/snap_controller.h
@@ -16,9 +16,16 @@
 // The previewed snap state for a window, corresponding to the use of a
 // PhantomWindowController.
 enum class SnapDirection {
-  kNone,   // No snap preview.
-  kLeft,   // The phantom window controller is previewing a snap to the left.
-  kRight,  // The phantom window controller is previewing a snap to the right.
+  kNone,       // No snap preview.
+  kPrimary,    // The phantom window controller is previewing a snap to the
+               // primary position, translated into left for landscape display
+               // (or right for secondary display layout) and top (or bottom)
+               // for portrait display. For more details, see
+               // description for `SplitViewController::IsLayoutHorizontal()`.
+  kSecondary,  // The phantom window controller is previewing a snap to the
+               // secondary position, the opposite position of the primary. For
+               // example, in primary portrait display, primary position is the
+               // top and secondary position is the bottom.
 };
 
 // This interface handles snap actions to be performed on a top level window.
diff --git a/components/exo/client_controlled_shell_surface.cc b/components/exo/client_controlled_shell_surface.cc
index e9aaecd..e9b5c7b 100644
--- a/components/exo/client_controlled_shell_surface.cc
+++ b/components/exo/client_controlled_shell_surface.cc
@@ -794,13 +794,13 @@
   }
 }
 
-void ClientControlledShellSurface::SetSnappedToLeft() {
-  TRACE_EVENT0("exo", "ClientControlledShellSurface::SetSnappedToLeft");
+void ClientControlledShellSurface::SetSnappedToPrimary() {
+  TRACE_EVENT0("exo", "ClientControlledShellSurface::SetSnappedToPrimary");
   pending_window_state_ = chromeos::WindowStateType::kPrimarySnapped;
 }
 
-void ClientControlledShellSurface::SetSnappedToRight() {
-  TRACE_EVENT0("exo", "ClientControlledShellSurface::SetSnappedToRight");
+void ClientControlledShellSurface::SetSnappedToSecondary() {
+  TRACE_EVENT0("exo", "ClientControlledShellSurface::SetSnappedToSecondary");
   pending_window_state_ = chromeos::WindowStateType::kSecondarySnapped;
 }
 
diff --git a/components/exo/client_controlled_shell_surface.h b/components/exo/client_controlled_shell_surface.h
index 3d549893..b1ae5ce 100644
--- a/components/exo/client_controlled_shell_surface.h
+++ b/components/exo/client_controlled_shell_surface.h
@@ -195,8 +195,8 @@
   bool IsInputEnabled(Surface* surface) const override;
   void OnSetFrame(SurfaceFrameType type) override;
   void OnSetFrameColors(SkColor active_color, SkColor inactive_color) override;
-  void SetSnappedToLeft() override;
-  void SetSnappedToRight() override;
+  void SetSnappedToPrimary() override;
+  void SetSnappedToSecondary() override;
   void SetPip() override;
   void UnsetPip() override;
 
diff --git a/components/exo/client_controlled_shell_surface_unittest.cc b/components/exo/client_controlled_shell_surface_unittest.cc
index 3a69e1a..a37648c 100644
--- a/components/exo/client_controlled_shell_surface_unittest.cc
+++ b/components/exo/client_controlled_shell_surface_unittest.cc
@@ -2645,7 +2645,7 @@
       display::Screen::GetScreen()->GetPrimaryDisplay();
   gfx::Rect initial_native_bounds(100, 100, 100, 100);
   shell_surface->SetBounds(primary_display.id(), initial_native_bounds);
-  shell_surface->SetSnappedToRight();
+  shell_surface->SetSnappedToSecondary();
   surface->Commit();
 
   EXPECT_EQ(2.f, 1.f / shell_surface->GetClientToDpScale());
@@ -2711,7 +2711,7 @@
 
   ash::WindowState::Get(window)->OnWMEvent(&event);
   EXPECT_EQ(gfx::Rect(0, 32, 400, 568), delegate->requested_bounds().back());
-  shell_surface->SetSnappedToLeft();
+  shell_surface->SetSnappedToPrimary();
   shell_surface->SetGeometry(gfx::Rect(0, 0, 400, 568));
   surface->Commit();
 
@@ -2727,7 +2727,7 @@
   EXPECT_EQ(gfx::Rect(0, 32, 400, 568), delegate->requested_bounds().back());
 
   // Clean up state.
-  shell_surface->SetSnappedToLeft();
+  shell_surface->SetSnappedToPrimary();
   surface->Commit();
 }
 
diff --git a/components/exo/shell_surface_base.cc b/components/exo/shell_surface_base.cc
index ada8bbf..b3b5d12 100644
--- a/components/exo/shell_surface_base.cc
+++ b/components/exo/shell_surface_base.cc
@@ -479,24 +479,26 @@
     SetShellUseImmersiveForFullscreen(widget_->GetNativeWindow(), value);
 }
 
-void ShellSurfaceBase::ShowSnapPreviewToLeft() {
-  ShowSnapPreview(widget_->GetNativeWindow(), chromeos::SnapDirection::kLeft);
+void ShellSurfaceBase::ShowSnapPreviewToPrimary() {
+  ShowSnapPreview(widget_->GetNativeWindow(),
+                  chromeos::SnapDirection::kPrimary);
 }
 
-void ShellSurfaceBase::ShowSnapPreviewToRight() {
-  ShowSnapPreview(widget_->GetNativeWindow(), chromeos::SnapDirection::kRight);
+void ShellSurfaceBase::ShowSnapPreviewToSecondary() {
+  ShowSnapPreview(widget_->GetNativeWindow(),
+                  chromeos::SnapDirection::kSecondary);
 }
 
 void ShellSurfaceBase::HideSnapPreview() {
   ShowSnapPreview(widget_->GetNativeWindow(), chromeos::SnapDirection::kNone);
 }
 
-void ShellSurfaceBase::SetSnappedToLeft() {
-  CommitSnap(widget_->GetNativeWindow(), chromeos::SnapDirection::kLeft);
+void ShellSurfaceBase::SetSnappedToPrimary() {
+  CommitSnap(widget_->GetNativeWindow(), chromeos::SnapDirection::kPrimary);
 }
 
-void ShellSurfaceBase::SetSnappedToRight() {
-  CommitSnap(widget_->GetNativeWindow(), chromeos::SnapDirection::kRight);
+void ShellSurfaceBase::SetSnappedToSecondary() {
+  CommitSnap(widget_->GetNativeWindow(), chromeos::SnapDirection::kSecondary);
 }
 
 void ShellSurfaceBase::UnsetSnap() {
diff --git a/components/exo/shell_surface_base.h b/components/exo/shell_surface_base.h
index a4664d5..58d98ee 100644
--- a/components/exo/shell_surface_base.h
+++ b/components/exo/shell_surface_base.h
@@ -178,11 +178,11 @@
   void OnSetStartupId(const char* startup_id) override;
   void OnSetApplicationId(const char* application_id) override;
   void SetUseImmersiveForFullscreen(bool value) override;
-  void ShowSnapPreviewToLeft() override;
-  void ShowSnapPreviewToRight() override;
+  void ShowSnapPreviewToPrimary() override;
+  void ShowSnapPreviewToSecondary() override;
   void HideSnapPreview() override;
-  void SetSnappedToLeft() override;
-  void SetSnappedToRight() override;
+  void SetSnappedToPrimary() override;
+  void SetSnappedToSecondary() override;
   void UnsetSnap() override;
   void OnActivationRequested() override;
   void OnSetServerStartResize() override;
diff --git a/components/exo/sub_surface.h b/components/exo/sub_surface.h
index b5589f4..492c7aa6 100644
--- a/components/exo/sub_surface.h
+++ b/components/exo/sub_surface.h
@@ -67,11 +67,11 @@
   void OnActivationRequested() override {}
   void OnNewOutputAdded() override {}
   void OnSetServerStartResize() override {}
-  void ShowSnapPreviewToLeft() override {}
-  void ShowSnapPreviewToRight() override {}
+  void ShowSnapPreviewToPrimary() override {}
+  void ShowSnapPreviewToSecondary() override {}
   void HideSnapPreview() override {}
-  void SetSnappedToLeft() override {}
-  void SetSnappedToRight() override {}
+  void SetSnappedToPrimary() override {}
+  void SetSnappedToSecondary() override {}
   void UnsetSnap() override {}
   void SetCanGoBack() override {}
   void UnsetCanGoBack() override {}
diff --git a/components/exo/surface.cc b/components/exo/surface.cc
index 05ffa08c..644cdf4b 100644
--- a/components/exo/surface.cc
+++ b/components/exo/surface.cc
@@ -601,14 +601,14 @@
     delegate_->SetUseImmersiveForFullscreen(value);
 }
 
-void Surface::ShowSnapPreviewToRight() {
+void Surface::ShowSnapPreviewToSecondary() {
   if (delegate_)
-    delegate_->ShowSnapPreviewToRight();
+    delegate_->ShowSnapPreviewToSecondary();
 }
 
-void Surface::ShowSnapPreviewToLeft() {
+void Surface::ShowSnapPreviewToPrimary() {
   if (delegate_)
-    delegate_->ShowSnapPreviewToLeft();
+    delegate_->ShowSnapPreviewToPrimary();
 }
 
 void Surface::HideSnapPreview() {
@@ -616,14 +616,14 @@
     delegate_->HideSnapPreview();
 }
 
-void Surface::SetSnappedToRight() {
+void Surface::SetSnappedToSecondary() {
   if (delegate_)
-    delegate_->SetSnappedToRight();
+    delegate_->SetSnappedToSecondary();
 }
 
-void Surface::SetSnappedToLeft() {
+void Surface::SetSnappedToPrimary() {
   if (delegate_)
-    delegate_->SetSnappedToLeft();
+    delegate_->SetSnappedToPrimary();
 }
 
 void Surface::UnsetSnap() {
diff --git a/components/exo/surface.h b/components/exo/surface.h
index c43cb1f..b9bb06ef 100644
--- a/components/exo/surface.h
+++ b/components/exo/surface.h
@@ -204,14 +204,16 @@
   // (plain fullscreen), the titlebar and shelf are always hidden.
   void SetUseImmersiveForFullscreen(bool value);
 
-  // Called to show the snap preview to the right or left, or to hide it.
-  void ShowSnapPreviewToRight();
-  void ShowSnapPreviewToLeft();
+  // Called to show the snap preview to the primary or secondary position, or
+  // to hide it.
+  void ShowSnapPreviewToSecondary();
+  void ShowSnapPreviewToPrimary();
   void HideSnapPreview();
 
-  // Called when the client was snapped to right or left, or reset.
-  void SetSnappedToRight();
-  void SetSnappedToLeft();
+  // Called when the client was snapped to primary or secondary position, or
+  // reset.
+  void SetSnappedToSecondary();
+  void SetSnappedToPrimary();
   void UnsetSnap();
 
   // Whether the current client window can go back, as per its navigation list.
diff --git a/components/exo/surface_delegate.h b/components/exo/surface_delegate.h
index 085ef29..51a9010 100644
--- a/components/exo/surface_delegate.h
+++ b/components/exo/surface_delegate.h
@@ -59,14 +59,16 @@
   // Called when surface was requested to start resize.
   virtual void OnSetServerStartResize() = 0;
 
-  // Called to show the snap preview to the right or left, or to hide it.
-  virtual void ShowSnapPreviewToLeft() = 0;
-  virtual void ShowSnapPreviewToRight() = 0;
+  // Called to show the snap preview to the primary or secondary position, or
+  // to hide it.
+  virtual void ShowSnapPreviewToPrimary() = 0;
+  virtual void ShowSnapPreviewToSecondary() = 0;
   virtual void HideSnapPreview() = 0;
 
-  // Called when the client was snapped to right or left, and reset.
-  virtual void SetSnappedToLeft() = 0;
-  virtual void SetSnappedToRight() = 0;
+  // Called when the client was snapped to primary or secondary position, and
+  // reset.
+  virtual void SetSnappedToPrimary() = 0;
+  virtual void SetSnappedToSecondary() = 0;
   virtual void UnsetSnap() = 0;
 
   // Whether the current client window can go back, as per its navigation list.
diff --git a/components/exo/surface_tree_host.h b/components/exo/surface_tree_host.h
index cb2d524..65082066 100644
--- a/components/exo/surface_tree_host.h
+++ b/components/exo/surface_tree_host.h
@@ -99,11 +99,11 @@
   void OnActivationRequested() override {}
   void OnNewOutputAdded() override;
   void OnSetServerStartResize() override {}
-  void ShowSnapPreviewToLeft() override {}
-  void ShowSnapPreviewToRight() override {}
+  void ShowSnapPreviewToPrimary() override {}
+  void ShowSnapPreviewToSecondary() override {}
   void HideSnapPreview() override {}
-  void SetSnappedToLeft() override {}
-  void SetSnappedToRight() override {}
+  void SetSnappedToPrimary() override {}
+  void SetSnappedToSecondary() override {}
   void UnsetSnap() override {}
   void SetCanGoBack() override {}
   void UnsetCanGoBack() override {}
diff --git a/components/exo/test/exo_test_helper.cc b/components/exo/test/exo_test_helper.cc
index 46e0cbff..459597d 100644
--- a/components/exo/test/exo_test_helper.cc
+++ b/components/exo/test/exo_test_helper.cc
@@ -98,9 +98,9 @@
            requested_state == chromeos::WindowStateType::kSecondarySnapped);
 
     if (requested_state == chromeos::WindowStateType::kPrimarySnapped)
-      shell_surface_->SetSnappedToLeft();
+      shell_surface_->SetSnappedToPrimary();
     else
-      shell_surface_->SetSnappedToRight();
+      shell_surface_->SetSnappedToSecondary();
   }
 
   Commit();
diff --git a/components/exo/wayland/zaura_shell.cc b/components/exo/wayland/zaura_shell.cc
index 5f95967..0f3a0c4 100644
--- a/components/exo/wayland/zaura_shell.cc
+++ b/components/exo/wayland/zaura_shell.cc
@@ -194,11 +194,11 @@
 }
 
 void aura_surface_set_snap_left(wl_client* client, wl_resource* resource) {
-  GetUserDataAs<AuraSurface>(resource)->SetSnapLeft();
+  GetUserDataAs<AuraSurface>(resource)->SetSnapPrimary();
 }
 
 void aura_surface_set_snap_right(wl_client* client, wl_resource* resource) {
-  GetUserDataAs<AuraSurface>(resource)->SetSnapRight();
+  GetUserDataAs<AuraSurface>(resource)->SetSnapSecondary();
 }
 
 void aura_surface_unset_snap(wl_client* client, wl_resource* resource) {
@@ -383,20 +383,20 @@
       surface_->HideSnapPreview();
       break;
     case ZAURA_SURFACE_SNAP_DIRECTION_LEFT:
-      surface_->ShowSnapPreviewToLeft();
+      surface_->ShowSnapPreviewToPrimary();
       break;
     case ZAURA_SURFACE_SNAP_DIRECTION_RIGHT:
-      surface_->ShowSnapPreviewToRight();
+      surface_->ShowSnapPreviewToSecondary();
       break;
   }
 }
 
-void AuraSurface::SetSnapLeft() {
-  surface_->SetSnappedToLeft();
+void AuraSurface::SetSnapPrimary() {
+  surface_->SetSnappedToPrimary();
 }
 
-void AuraSurface::SetSnapRight() {
-  surface_->SetSnappedToRight();
+void AuraSurface::SetSnapSecondary() {
+  surface_->SetSnappedToSecondary();
 }
 
 void AuraSurface::UnsetSnap() {
diff --git a/components/exo/wayland/zaura_shell.h b/components/exo/wayland/zaura_shell.h
index 4685a3c..9c2a72e 100644
--- a/components/exo/wayland/zaura_shell.h
+++ b/components/exo/wayland/zaura_shell.h
@@ -50,8 +50,8 @@
   void DrawAttention();
   void SetFullscreenMode(uint32_t mode);
   void IntentToSnap(uint32_t snap_direction);
-  void SetSnapLeft();
-  void SetSnapRight();
+  void SetSnapPrimary();
+  void SetSnapSecondary();
   void UnsetSnap();
   void SetWindowSessionId(int32_t window_session_id);
   void SetCanGoBack();
diff --git a/components/exo/wayland/zaura_shell_unittest.cc b/components/exo/wayland/zaura_shell_unittest.cc
index cf1ce3f..399bc9c 100644
--- a/components/exo/wayland/zaura_shell_unittest.cc
+++ b/components/exo/wayland/zaura_shell_unittest.cc
@@ -95,11 +95,11 @@
   MOCK_METHOD(void, OnActivationRequested, (), (override));
   MOCK_METHOD(void, OnNewOutputAdded, (), (override));
   MOCK_METHOD(void, OnSetServerStartResize, (), (override));
-  MOCK_METHOD(void, ShowSnapPreviewToLeft, (), (override));
-  MOCK_METHOD(void, ShowSnapPreviewToRight, (), (override));
+  MOCK_METHOD(void, ShowSnapPreviewToPrimary, (), (override));
+  MOCK_METHOD(void, ShowSnapPreviewToSecondary, (), (override));
   MOCK_METHOD(void, HideSnapPreview, (), (override));
-  MOCK_METHOD(void, SetSnappedToRight, (), (override));
-  MOCK_METHOD(void, SetSnappedToLeft, (), (override));
+  MOCK_METHOD(void, SetSnappedToSecondary, (), (override));
+  MOCK_METHOD(void, SetSnappedToPrimary, (), (override));
   MOCK_METHOD(void, UnsetSnap, (), (override));
   MOCK_METHOD(void, SetCanGoBack, (), (override));
   MOCK_METHOD(void, UnsetCanGoBack, (), (override));
diff --git a/components/exo/wayland/zcr_remote_shell_impl.cc b/components/exo/wayland/zcr_remote_shell_impl.cc
index 5fcc159..f5a4ec9 100644
--- a/components/exo/wayland/zcr_remote_shell_impl.cc
+++ b/components/exo/wayland/zcr_remote_shell_impl.cc
@@ -1248,12 +1248,13 @@
 
 void remote_surface_set_snapped_to_left(wl_client* client,
                                         wl_resource* resource) {
-  GetUserDataAs<ClientControlledShellSurface>(resource)->SetSnappedToLeft();
+  GetUserDataAs<ClientControlledShellSurface>(resource)->SetSnappedToPrimary();
 }
 
 void remote_surface_set_snapped_to_right(wl_client* client,
                                          wl_resource* resource) {
-  GetUserDataAs<ClientControlledShellSurface>(resource)->SetSnappedToRight();
+  GetUserDataAs<ClientControlledShellSurface>(resource)
+      ->SetSnappedToSecondary();
 }
 
 void remote_surface_start_resize(wl_client* client,
diff --git a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
index 83504ee..989c1cb 100644
--- a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
+++ b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
@@ -585,10 +585,10 @@
                            ZAURA_SURFACE_INTENT_TO_SNAP_SINCE_VERSION) {
     uint32_t zaura_shell_snap_direction = ZAURA_SURFACE_SNAP_DIRECTION_NONE;
     switch (snap_direction) {
-      case WaylandWindowSnapDirection::kLeft:
+      case WaylandWindowSnapDirection::kPrimary:
         zaura_shell_snap_direction = ZAURA_SURFACE_SNAP_DIRECTION_LEFT;
         break;
-      case WaylandWindowSnapDirection::kRight:
+      case WaylandWindowSnapDirection::kSecondary:
         zaura_shell_snap_direction = ZAURA_SURFACE_SNAP_DIRECTION_RIGHT;
         break;
       case WaylandWindowSnapDirection::kNone:
@@ -608,10 +608,10 @@
   if (aura_surface_ && zaura_surface_get_version(aura_surface_.get()) >=
                            ZAURA_SURFACE_UNSET_SNAP_SINCE_VERSION) {
     switch (snap_direction) {
-      case WaylandWindowSnapDirection::kLeft:
+      case WaylandWindowSnapDirection::kPrimary:
         zaura_surface_set_snap_left(aura_surface_.get());
         return;
-      case WaylandWindowSnapDirection::kRight:
+      case WaylandWindowSnapDirection::kSecondary:
         zaura_surface_set_snap_right(aura_surface_.get());
         return;
       case WaylandWindowSnapDirection::kNone:
diff --git a/ui/platform_window/extensions/wayland_extension.h b/ui/platform_window/extensions/wayland_extension.h
index d810ae31..b48a97e7 100644
--- a/ui/platform_window/extensions/wayland_extension.h
+++ b/ui/platform_window/extensions/wayland_extension.h
@@ -13,8 +13,8 @@
 
 enum class WaylandWindowSnapDirection {
   kNone,
-  kLeft,
-  kRight,
+  kPrimary,
+  kSecondary,
 };
 
 class COMPONENT_EXPORT(PLATFORM_WINDOW) WaylandExtension {