snap-group: Implement kebab button on the divider (Part I)
This CL implements the kebab button shown on the split view divider on mouse hover on the divider. An expanded menu will be shown on toggling the kebab button. For Part I, the kebab button and expanded menu widget are implemented with only the unlock button API available for use. The APIs to swap windows, update left/top window, update right/bottom window will be addressed in kebab button Part II. Demo: http://b/266631690#comment3 Fixed: b/266631690 Test: Manually + added unit tests Change-Id: I10f3919a49c44c05606dff9a83a11cecfbda766a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4379099 Reviewed-by: Xiaoqian Dai <xdai@chromium.org> Commit-Queue: Michele Fan <michelefan@chromium.org> Cr-Commit-Position: refs/heads/main@{#1127719}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
d24633099d
commit
7acf33acd8
ash
BUILD.gnash_strings.grd
ash_strings_grd
IDS_ASH_SNAP_GROUP_MORE_OPTIONS.png.sha1IDS_ASH_SNAP_GROUP_SWAP_WINDOWS.png.sha1IDS_ASH_SNAP_GROUP_UPDATE_LEFT_WINDOW.png.sha1IDS_ASH_SNAP_GROUP_UPDATE_RIGHT_WINDOW.png.sha1
resources
vector_icons
wm
snap_group
snap_group_controller.ccsnap_group_controller.hsnap_group_expanded_menu_view.ccsnap_group_expanded_menu_view.hsnap_group_lock_or_unlock_button.ccsnap_group_lock_or_unlock_button.hsnap_group_unittest.cc
splitview
split_view_constants.hsplit_view_controller.ccsplit_view_divider.hsplit_view_divider_view.ccsplit_view_divider_view.h
workspace
@ -2392,8 +2392,10 @@ component("ash") {
|
||||
"wm/snap_group/snap_group_constants.h",
|
||||
"wm/snap_group/snap_group_controller.cc",
|
||||
"wm/snap_group/snap_group_controller.h",
|
||||
"wm/snap_group/snap_group_lock_button.cc",
|
||||
"wm/snap_group/snap_group_lock_button.h",
|
||||
"wm/snap_group/snap_group_expanded_menu_view.cc",
|
||||
"wm/snap_group/snap_group_expanded_menu_view.h",
|
||||
"wm/snap_group/snap_group_lock_or_unlock_button.cc",
|
||||
"wm/snap_group/snap_group_lock_or_unlock_button.h",
|
||||
"wm/splitview/split_view_constants.h",
|
||||
"wm/splitview/split_view_controller.cc",
|
||||
"wm/splitview/split_view_controller.h",
|
||||
|
@ -5628,6 +5628,18 @@ Here are some things you can try to get started.
|
||||
<message name="IDS_ASH_SNAP_GROUP_CLICK_TO_UNLOCK_WINDOWS" desc="Click to unlock the locked windows.">
|
||||
Unlock the windows
|
||||
</message>
|
||||
<message name="IDS_ASH_SNAP_GROUP_MORE_OPTIONS" desc="Click to see more options.">
|
||||
More options
|
||||
</message>
|
||||
<message name="IDS_ASH_SNAP_GROUP_SWAP_WINDOWS" desc="Swap the windows in the snap group.">
|
||||
Swap the windows
|
||||
</message>
|
||||
<message name="IDS_ASH_SNAP_GROUP_UPDATE_LEFT_WINDOW" desc="Update the left window in the snap group in horizontal screen orientation.">
|
||||
Update the left window
|
||||
</message>
|
||||
<message name="IDS_ASH_SNAP_GROUP_UPDATE_RIGHT_WINDOW" desc="Update the right window in the snap group in horizontal screen orientation.">
|
||||
Update the right window
|
||||
</message>
|
||||
|
||||
<!-- Switch Between TABLET/LAPTOP MODE-->
|
||||
<message name="IDS_ASH_SWITCH_TO_TABLET_MODE" desc="Alert of switching to tablet mode.">
|
||||
|
@ -0,0 +1 @@
|
||||
e0e57ae4a2f7c4bbf8b9f8c22325f18a997813e1
|
@ -0,0 +1 @@
|
||||
4425d424e46891a4f62e028eb53d825cddfff7d5
|
@ -0,0 +1 @@
|
||||
6d05aea173742d52e32ff0c4b2d522db040d02e8
|
@ -0,0 +1 @@
|
||||
726098f05fe7334e8f4382f7509239cec3d1dbf3
|
@ -314,6 +314,10 @@ aggregate_vector_icons("ash_vector_icons") {
|
||||
"show_closed_caption.icon",
|
||||
"six_files.icon",
|
||||
"small_close_button.icon",
|
||||
"snap_group_kebab.icon",
|
||||
"snap_group_swap_windows.icon",
|
||||
"snap_group_update_primary_window.icon",
|
||||
"snap_group_update_secondary_window.icon",
|
||||
"sort_alphabetical.icon",
|
||||
"sort_color.icon",
|
||||
"stylus_battery_status_unknown.icon",
|
||||
|
23
ash/resources/vector_icons/snap_group_kebab.icon
Normal file
23
ash/resources/vector_icons/snap_group_kebab.icon
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
CANVAS_DIMENSIONS, 20,
|
||||
MOVE_TO, 10, 14,
|
||||
CUBIC_TO, 11.1f, 14, 12, 14.9f, 12, 16,
|
||||
CUBIC_TO, 12, 17.11f, 11.1f, 18, 10, 18,
|
||||
CUBIC_TO, 8.9f, 18, 8, 17.11f, 8, 16,
|
||||
CUBIC_TO, 8, 14.9f, 8.9f, 14, 10, 14,
|
||||
CLOSE,
|
||||
MOVE_TO, 10, 12,
|
||||
CUBIC_TO, 8.9f, 12, 8, 11.11f, 8, 10,
|
||||
CUBIC_TO, 8, 8.9f, 8.9f, 8, 10, 8,
|
||||
CUBIC_TO, 11.1f, 8, 12, 8.9f, 12, 10,
|
||||
CUBIC_TO, 12, 11.11f, 11.1f, 12, 10, 12,
|
||||
CLOSE,
|
||||
MOVE_TO, 10, 6,
|
||||
CUBIC_TO, 8.9f, 6, 8, 5.11f, 8, 4,
|
||||
CUBIC_TO, 8, 2.9f, 8.9f, 2, 10, 2,
|
||||
CUBIC_TO, 11.1f, 2, 12, 2.9f, 12, 4,
|
||||
CUBIC_TO, 12, 5.11f, 11.1f, 6, 10, 6,
|
||||
CLOSE
|
28
ash/resources/vector_icons/snap_group_swap_windows.icon
Normal file
28
ash/resources/vector_icons/snap_group_swap_windows.icon
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
CANVAS_DIMENSIONS, 24,
|
||||
MOVE_TO, 7, 20,
|
||||
LINE_TO, 2, 15,
|
||||
LINE_TO, 7, 10,
|
||||
LINE_TO, 8.4f, 11.43f,
|
||||
LINE_TO, 5.83f, 14,
|
||||
H_LINE_TO, 13,
|
||||
V_LINE_TO, 16,
|
||||
H_LINE_TO, 5.83f,
|
||||
LINE_TO, 8.4f, 18.58f,
|
||||
LINE_TO, 7, 20,
|
||||
CLOSE,
|
||||
MOVE_TO, 17, 14,
|
||||
LINE_TO, 15.6f, 12.58f,
|
||||
LINE_TO, 18.18f, 10,
|
||||
H_LINE_TO, 11,
|
||||
V_LINE_TO, 8,
|
||||
H_LINE_TO, 18.18f,
|
||||
LINE_TO, 15.6f, 5.43f,
|
||||
LINE_TO, 17, 4,
|
||||
LINE_TO, 22, 9,
|
||||
LINE_TO, 17, 14,
|
||||
CLOSE,
|
||||
NEW_PATH
|
@ -0,0 +1,27 @@
|
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
CANVAS_DIMENSIONS, 24,
|
||||
MOVE_TO, 4.8f, 12,
|
||||
CUBIC_TO, 4.8f, 16.01f, 7.95f, 19.2f, 11.75f, 19.2f,
|
||||
CUBIC_TO, 13.37f, 19.2f, 14.86f, 18.63f, 16.04f, 17.67f,
|
||||
LINE_TO, 17.56f, 19.53f,
|
||||
CUBIC_TO, 15.97f, 20.82f, 13.95f, 21.6f, 11.75f, 21.6f,
|
||||
CUBIC_TO, 6.56f, 21.6f, 2.4f, 17.27f, 2.4f, 12,
|
||||
CUBIC_TO, 2.4f, 6.73f, 6.56f, 2.4f, 11.75f, 2.4f,
|
||||
CUBIC_TO, 13.95f, 2.4f, 15.97f, 3.18f, 17.56f, 4.47f,
|
||||
LINE_TO, 16.04f, 6.33f,
|
||||
CUBIC_TO, 14.86f, 5.37f, 13.37f, 4.8f, 11.75f, 4.8f,
|
||||
CUBIC_TO, 7.95f, 4.8f, 4.8f, 7.99f, 4.8f, 12,
|
||||
CLOSE,
|
||||
NEW_PATH,
|
||||
MOVE_TO, 21.6f, 10.8f,
|
||||
V_LINE_TO, 13.2f,
|
||||
LINE_TO, 13.5f, 13.2f,
|
||||
V_LINE_TO, 16.16f,
|
||||
LINE_TO, 9, 12,
|
||||
LINE_TO, 13.5f, 7.84f,
|
||||
V_LINE_TO, 10.8f,
|
||||
LINE_TO, 21.6f, 10.8f,
|
||||
CLOSE
|
@ -0,0 +1,27 @@
|
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
CANVAS_DIMENSIONS, 24,
|
||||
MOVE_TO, 19.2f, 12,
|
||||
CUBIC_TO, 19.2f, 7.99f, 16.05f, 4.8f, 12.25f, 4.8f,
|
||||
CUBIC_TO, 10.63f, 4.8f, 9.14f, 5.37f, 7.96f, 6.33f,
|
||||
LINE_TO, 6.44f, 4.47f,
|
||||
CUBIC_TO, 8.03f, 3.18f, 10.05f, 2.4f, 12.25f, 2.4f,
|
||||
CUBIC_TO, 17.44f, 2.4f, 21.6f, 6.73f, 21.6f, 12,
|
||||
CUBIC_TO, 21.6f, 17.27f, 17.44f, 21.6f, 12.25f, 21.6f,
|
||||
CUBIC_TO, 10.05f, 21.6f, 8.03f, 20.82f, 6.44f, 19.53f,
|
||||
LINE_TO, 7.96f, 17.67f,
|
||||
CUBIC_TO, 9.14f, 18.63f, 10.63f, 19.2f, 12.25f, 19.2f,
|
||||
CUBIC_TO, 16.05f, 19.2f, 19.2f, 16.01f, 19.2f, 12,
|
||||
CLOSE,
|
||||
NEW_PATH,
|
||||
MOVE_TO, 2.4f, 13.2f,
|
||||
V_LINE_TO, 10.8f,
|
||||
LINE_TO, 10.5f, 10.8f,
|
||||
V_LINE_TO, 7.84f,
|
||||
LINE_TO, 15, 12,
|
||||
LINE_TO, 10.5f, 16.16f,
|
||||
V_LINE_TO, 13.2f,
|
||||
LINE_TO, 2.4f, 13.2f,
|
||||
CLOSE
|
@ -66,15 +66,24 @@ bool SnapGroupController::RemoveSnapGroup(SnapGroup* snap_group) {
|
||||
|
||||
bool SnapGroupController::RemoveSnapGroupContainingWindow(
|
||||
aura::Window* window) {
|
||||
if (window_to_snap_group_map_.find(window) ==
|
||||
window_to_snap_group_map_.end()) {
|
||||
SnapGroup* snap_group = GetSnapGroupForGivenWindow(window);
|
||||
if (snap_group == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SnapGroup* snap_group = window_to_snap_group_map_.find(window)->second;
|
||||
return RemoveSnapGroup(snap_group);
|
||||
}
|
||||
|
||||
SnapGroup* SnapGroupController::GetSnapGroupForGivenWindow(
|
||||
aura::Window* window) {
|
||||
if (window_to_snap_group_map_.find(window) ==
|
||||
window_to_snap_group_map_.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return window_to_snap_group_map_.find(window)->second;
|
||||
}
|
||||
|
||||
bool SnapGroupController::IsArm1AutomaticallyLockEnabled() const {
|
||||
return features::IsSnapGroupEnabled() &&
|
||||
features::kAutomaticallyLockGroup.Get();
|
||||
|
@ -51,6 +51,10 @@ class ASH_EXPORT SnapGroupController {
|
||||
// given `window` has been removed successfully. Returns false otherwise.
|
||||
bool RemoveSnapGroupContainingWindow(aura::Window* window);
|
||||
|
||||
// Returns the corresponding `SnapGroup` if the given `window` belongs to a
|
||||
// snap group or nullptr otherwise.
|
||||
SnapGroup* GetSnapGroupForGivenWindow(aura::Window* window);
|
||||
|
||||
// Returns true if the feature flag `kSnapGroup` is enabled and the feature
|
||||
// param `kAutomaticallyLockGroup` is true, i.e. a snap group will be created
|
||||
// automatically on two windows snapped.
|
||||
|
101
ash/wm/snap_group/snap_group_expanded_menu_view.cc
Normal file
101
ash/wm/snap_group/snap_group_expanded_menu_view.cc
Normal file
@ -0,0 +1,101 @@
|
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "ash/wm/snap_group/snap_group_expanded_menu_view.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "ash/resources/vector_icons/vector_icons.h"
|
||||
#include "ash/strings/grit/ash_strings.h"
|
||||
#include "ash/style/ash_color_id.h"
|
||||
#include "ash/style/icon_button.h"
|
||||
#include "ash/wm/snap_group/snap_group.h"
|
||||
#include "ash/wm/snap_group/snap_group_lock_or_unlock_button.h"
|
||||
#include "ash/wm/splitview/split_view_constants.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "base/functional/callback_forward.h"
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/compositor/layer.h"
|
||||
#include "ui/views/background.h"
|
||||
#include "ui/views/layout/box_layout.h"
|
||||
#include "ui/views/view.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr auto kExpandedMenuPadding = gfx::Insets::VH(8, 3);
|
||||
constexpr int kSpaceBetweenButton = 3;
|
||||
|
||||
} // namespace
|
||||
|
||||
SnapGroupExpandedMenuView::SnapGroupExpandedMenuView(SnapGroup* snap_group)
|
||||
: swap_windows_button_(AddChildView(std::make_unique<IconButton>(
|
||||
base::BindRepeating(
|
||||
&SnapGroupExpandedMenuView::OnSwapWindowsButtonPressed,
|
||||
base::Unretained(this)),
|
||||
IconButton::Type::kMediumFloating,
|
||||
&kSnapGroupSwapWindowsIcon,
|
||||
IDS_ASH_SNAP_GROUP_SWAP_WINDOWS,
|
||||
/*is_togglable=*/false,
|
||||
/*has_border=*/true))),
|
||||
update_primary_window_button_(AddChildView(std::make_unique<IconButton>(
|
||||
base::BindRepeating(
|
||||
&SnapGroupExpandedMenuView::OnUpdatePrimaryWindowButtonPressed,
|
||||
base::Unretained(this)),
|
||||
IconButton::Type::kMediumFloating,
|
||||
&kSnapGroupUpdatePrimaryWindowIcon,
|
||||
IDS_ASH_SNAP_GROUP_UPDATE_LEFT_WINDOW,
|
||||
/*is_togglable=*/false,
|
||||
/*has_border=*/true))),
|
||||
update_secondary_window_button_(AddChildView(std::make_unique<IconButton>(
|
||||
base::BindRepeating(
|
||||
&SnapGroupExpandedMenuView::OnUpdateSecondaryWindowButtonPressed,
|
||||
base::Unretained(this)),
|
||||
IconButton::Type::kMediumFloating,
|
||||
&kSnapGroupUpdateSecondaryWindowIcon,
|
||||
IDS_ASH_SNAP_GROUP_UPDATE_RIGHT_WINDOW,
|
||||
/*is_togglable=*/false,
|
||||
/*has_border=*/true))),
|
||||
unlock_button_(AddChildView(std::make_unique<SnapGroupLockOrUnlockButton>(
|
||||
snap_group->window1(),
|
||||
snap_group->window2()))) {
|
||||
SetPaintToLayer();
|
||||
SetBackground(views::CreateThemedSolidBackground(kColorAshShieldAndBase80));
|
||||
layer()->SetFillsBoundsOpaquely(false);
|
||||
layer()->SetRoundedCornerRadius(
|
||||
gfx::RoundedCornersF(kExpandedMenuRoundedCornerRadius));
|
||||
|
||||
auto* box_layout = SetLayoutManager(std::make_unique<views::BoxLayout>(
|
||||
views::BoxLayout::Orientation::kVertical, kExpandedMenuPadding,
|
||||
kSpaceBetweenButton));
|
||||
box_layout->set_cross_axis_alignment(
|
||||
views::BoxLayout::CrossAxisAlignment::kCenter);
|
||||
box_layout->set_main_axis_alignment(
|
||||
views::BoxLayout::MainAxisAlignment::kCenter);
|
||||
}
|
||||
|
||||
SnapGroupExpandedMenuView::~SnapGroupExpandedMenuView() = default;
|
||||
|
||||
void SnapGroupExpandedMenuView::OnUpdatePrimaryWindowButtonPressed() {
|
||||
// TODO(b/267663000): Implement this function.
|
||||
base::DoNothing();
|
||||
}
|
||||
|
||||
void SnapGroupExpandedMenuView::OnUpdateSecondaryWindowButtonPressed() {
|
||||
// TODO(b/267663000): Implement this function.
|
||||
base::DoNothing();
|
||||
}
|
||||
|
||||
void SnapGroupExpandedMenuView::OnSwapWindowsButtonPressed() {
|
||||
// TODO(b/267663000): Implement this function.
|
||||
base::DoNothing();
|
||||
}
|
||||
|
||||
BEGIN_METADATA(SnapGroupExpandedMenuView, views::View)
|
||||
END_METADATA
|
||||
|
||||
} // namespace ash
|
67
ash/wm/snap_group/snap_group_expanded_menu_view.h
Normal file
67
ash/wm/snap_group/snap_group_expanded_menu_view.h
Normal file
@ -0,0 +1,67 @@
|
||||
// Copyright 2023 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_WM_SNAP_GROUP_SNAP_GROUP_EXPANDED_MENU_VIEW_H_
|
||||
#define ASH_WM_SNAP_GROUP_SNAP_GROUP_EXPANDED_MENU_VIEW_H_
|
||||
|
||||
#include "ui/views/view.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
class IconButton;
|
||||
class SnapGroup;
|
||||
class SnapGroupLockOrUnlockButton;
|
||||
|
||||
// A view that acts as the contents view of the snap group expanded menu widget
|
||||
// which will show or hide on the kebab button toggled. Note that this view will
|
||||
// only be available for the clamshell mode, the tablet mode is to be
|
||||
// implemented.
|
||||
class SnapGroupExpandedMenuView : public views::View {
|
||||
public:
|
||||
METADATA_HEADER(SnapGroupExpandedMenuView);
|
||||
|
||||
explicit SnapGroupExpandedMenuView(SnapGroup* snap_group);
|
||||
SnapGroupExpandedMenuView(const SnapGroupExpandedMenuView&) = delete;
|
||||
SnapGroupExpandedMenuView& operator=(const SnapGroupExpandedMenuView&) =
|
||||
delete;
|
||||
~SnapGroupExpandedMenuView() override;
|
||||
|
||||
IconButton* swap_windows_button_for_testing() const {
|
||||
return swap_windows_button_;
|
||||
}
|
||||
IconButton* update_primary_window_button_for_testing() const {
|
||||
return update_primary_window_button_;
|
||||
}
|
||||
IconButton* update_secondary_window_button_for_testing() const {
|
||||
return update_secondary_window_button_;
|
||||
}
|
||||
SnapGroupLockOrUnlockButton* unlock_button_for_testing() const {
|
||||
return unlock_button_;
|
||||
}
|
||||
|
||||
private:
|
||||
// Called when the `swap_windows_button_` is clicked to swap the two windows
|
||||
// in the snap group.
|
||||
void OnSwapWindowsButtonPressed();
|
||||
|
||||
// Called when the `update_primary_window_button_` is clicked to update the
|
||||
// primary window in the snap group by invoking the overview session shown
|
||||
// on the other half of the screen.
|
||||
void OnUpdatePrimaryWindowButtonPressed();
|
||||
|
||||
// Called when the `update_secondary_window_button_` is clicked. to update
|
||||
// the secondary window in the snap group by invoking the overview session
|
||||
// shown on the other half of the screen.
|
||||
void OnUpdateSecondaryWindowButtonPressed();
|
||||
|
||||
// Child views of this class, which are listed from top to bottom.
|
||||
IconButton* swap_windows_button_;
|
||||
IconButton* update_primary_window_button_;
|
||||
IconButton* update_secondary_window_button_;
|
||||
SnapGroupLockOrUnlockButton* unlock_button_;
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_WM_SNAP_GROUP_SNAP_GROUP_EXPANDED_MENU_VIEW_H_
|
23
ash/wm/snap_group/snap_group_lock_button.cc → ash/wm/snap_group/snap_group_lock_or_unlock_button.cc
23
ash/wm/snap_group/snap_group_lock_button.cc → ash/wm/snap_group/snap_group_lock_or_unlock_button.cc
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "ash/wm/snap_group/snap_group_lock_button.h"
|
||||
#include "ash/wm/snap_group/snap_group_lock_or_unlock_button.h"
|
||||
|
||||
#include "ash/resources/vector_icons/vector_icons.h"
|
||||
#include "ash/shell.h"
|
||||
@ -10,6 +10,8 @@
|
||||
#include "ash/style/ash_color_id.h"
|
||||
#include "ash/wm/snap_group/snap_group_constants.h"
|
||||
#include "ash/wm/snap_group/snap_group_controller.h"
|
||||
#include "ash/wm/splitview/split_view_controller.h"
|
||||
#include "ash/wm/splitview/split_view_divider.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/base/models/image_model.h"
|
||||
@ -19,10 +21,11 @@
|
||||
|
||||
namespace ash {
|
||||
|
||||
SnapGroupLockButton::SnapGroupLockButton(aura::Window* window1,
|
||||
aura::Window* window2)
|
||||
: ImageButton(base::BindRepeating(&SnapGroupLockButton::OnLockButtonPressed,
|
||||
base::Unretained(this))),
|
||||
SnapGroupLockOrUnlockButton::SnapGroupLockOrUnlockButton(aura::Window* window1,
|
||||
aura::Window* window2)
|
||||
: ImageButton(
|
||||
base::BindRepeating(&SnapGroupLockOrUnlockButton::OnLockButtonPressed,
|
||||
base::Unretained(this))),
|
||||
window1_(window1),
|
||||
window2_(window2) {
|
||||
SetImageHorizontalAlignment(ALIGN_CENTER);
|
||||
@ -34,9 +37,9 @@ SnapGroupLockButton::SnapGroupLockButton(aura::Window* window1,
|
||||
RefreshLockButton();
|
||||
}
|
||||
|
||||
SnapGroupLockButton::~SnapGroupLockButton() = default;
|
||||
SnapGroupLockOrUnlockButton::~SnapGroupLockOrUnlockButton() = default;
|
||||
|
||||
void SnapGroupLockButton::OnLockButtonPressed() {
|
||||
void SnapGroupLockOrUnlockButton::OnLockButtonPressed() {
|
||||
DCHECK(window1_);
|
||||
DCHECK(window2_);
|
||||
SnapGroupController* snap_group_controller =
|
||||
@ -53,7 +56,7 @@ void SnapGroupLockButton::OnLockButtonPressed() {
|
||||
RefreshLockButton();
|
||||
}
|
||||
|
||||
void SnapGroupLockButton::RefreshLockButton() {
|
||||
void SnapGroupLockOrUnlockButton::RefreshLockButton() {
|
||||
const bool locked =
|
||||
Shell::Get()->snap_group_controller()->AreWindowsInSnapGroup(window1_,
|
||||
window2_);
|
||||
@ -67,7 +70,7 @@ void SnapGroupLockButton::RefreshLockButton() {
|
||||
: IDS_ASH_SNAP_GROUP_CLICK_TO_LOCK_WINDOWS));
|
||||
}
|
||||
|
||||
BEGIN_METADATA(SnapGroupLockButton, views::ImageButton)
|
||||
BEGIN_METADATA(SnapGroupLockOrUnlockButton, views::ImageButton)
|
||||
END_METADATA
|
||||
|
||||
} // namespace ash
|
||||
} // namespace ash
|
22
ash/wm/snap_group/snap_group_lock_button.h → ash/wm/snap_group/snap_group_lock_or_unlock_button.h
22
ash/wm/snap_group/snap_group_lock_button.h → ash/wm/snap_group/snap_group_lock_or_unlock_button.h
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ASH_WM_SNAP_GROUP_SNAP_GROUP_LOCK_BUTTON_H_
|
||||
#define ASH_WM_SNAP_GROUP_SNAP_GROUP_LOCK_BUTTON_H_
|
||||
#ifndef ASH_WM_SNAP_GROUP_SNAP_GROUP_LOCK_OR_UNLOCK_BUTTON_H_
|
||||
#define ASH_WM_SNAP_GROUP_SNAP_GROUP_LOCK_OR_UNLOCK_BUTTON_H_
|
||||
|
||||
#include "ui/base/metadata/metadata_header_macros.h"
|
||||
#include "ui/views/controls/button/image_button.h"
|
||||
@ -17,15 +17,15 @@ namespace ash {
|
||||
// Contents view of the lock widget that appears below the resize widget when
|
||||
// two windows are snapped. It acts as the entry point for the creating or
|
||||
// removing the `SnapGroup`. This entry point is guarded by the feature flag
|
||||
// `kSnapGroup` and will only be enabled when the feature param
|
||||
// `kAutomaticallyLockGroup` is false.
|
||||
class SnapGroupLockButton : public views::ImageButton {
|
||||
// `kSnapGroup`.
|
||||
class SnapGroupLockOrUnlockButton : public views::ImageButton {
|
||||
public:
|
||||
METADATA_HEADER(SnapGroupLockButton);
|
||||
SnapGroupLockButton(aura::Window* window1, aura::Window* window2);
|
||||
SnapGroupLockButton(const SnapGroupLockButton&) = delete;
|
||||
SnapGroupLockButton& operator=(const SnapGroupLockButton&) = delete;
|
||||
~SnapGroupLockButton() override;
|
||||
METADATA_HEADER(SnapGroupLockOrUnlockButton);
|
||||
SnapGroupLockOrUnlockButton(aura::Window* window1, aura::Window* window2);
|
||||
SnapGroupLockOrUnlockButton(const SnapGroupLockOrUnlockButton&) = delete;
|
||||
SnapGroupLockOrUnlockButton& operator=(const SnapGroupLockOrUnlockButton&) =
|
||||
delete;
|
||||
~SnapGroupLockOrUnlockButton() override;
|
||||
|
||||
// Called on lock button is pressed to create or remove a snap group and
|
||||
// `RefreshLockButton()`.
|
||||
@ -41,4 +41,4 @@ class SnapGroupLockButton : public views::ImageButton {
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_WM_SNAP_GROUP_SNAP_GROUP_LOCK_BUTTON_H_
|
||||
#endif // ASH_WM_SNAP_GROUP_SNAP_GROUP_LOCK_OR_UNLOCK_BUTTON_H_
|
@ -12,6 +12,7 @@
|
||||
#include "ash/shell.h"
|
||||
#include "ash/strings/grit/ash_strings.h"
|
||||
#include "ash/style/ash_color_id.h"
|
||||
#include "ash/style/icon_button.h"
|
||||
#include "ash/test/ash_test_base.h"
|
||||
#include "ash/test/ash_test_util.h"
|
||||
#include "ash/wm/mru_window_tracker.h"
|
||||
@ -19,10 +20,12 @@
|
||||
#include "ash/wm/overview/overview_item.h"
|
||||
#include "ash/wm/overview/overview_test_util.h"
|
||||
#include "ash/wm/snap_group/snap_group_controller.h"
|
||||
#include "ash/wm/snap_group/snap_group_lock_button.h"
|
||||
#include "ash/wm/snap_group/snap_group_expanded_menu_view.h"
|
||||
#include "ash/wm/snap_group/snap_group_lock_or_unlock_button.h"
|
||||
#include "ash/wm/splitview/split_view_constants.h"
|
||||
#include "ash/wm/splitview/split_view_controller.h"
|
||||
#include "ash/wm/splitview/split_view_divider.h"
|
||||
#include "ash/wm/splitview/split_view_divider_view.h"
|
||||
#include "ash/wm/window_state.h"
|
||||
#include "ash/wm/wm_event.h"
|
||||
#include "ash/wm/workspace/multi_window_resize_controller.h"
|
||||
@ -62,6 +65,49 @@ const gfx::Rect work_area_bounds() {
|
||||
return display::Screen::GetScreen()->GetPrimaryDisplay().work_area();
|
||||
}
|
||||
|
||||
IconButton* kebab_button() {
|
||||
SplitViewDividerView* divider_view =
|
||||
split_view_divider()->divider_view_for_testing();
|
||||
CHECK(divider_view);
|
||||
return divider_view->kebab_button_for_testing();
|
||||
}
|
||||
|
||||
views::Widget* snap_group_expanded_menu_widget() {
|
||||
SplitViewDividerView* divider_view =
|
||||
split_view_divider()->divider_view_for_testing();
|
||||
CHECK(divider_view);
|
||||
return divider_view->snap_group_expanded_menu_widget_for_testing();
|
||||
}
|
||||
|
||||
SnapGroupExpandedMenuView* snap_group_expanded_menu_view() {
|
||||
SplitViewDividerView* divider_view =
|
||||
split_view_divider()->divider_view_for_testing();
|
||||
CHECK(divider_view);
|
||||
return divider_view->snap_group_expanded_menu_view_for_testing();
|
||||
}
|
||||
|
||||
IconButton* swap_windows_button() {
|
||||
DCHECK(snap_group_expanded_menu_view());
|
||||
return snap_group_expanded_menu_view()->swap_windows_button_for_testing();
|
||||
}
|
||||
|
||||
IconButton* update_primary_window_button() {
|
||||
DCHECK(snap_group_expanded_menu_view());
|
||||
return snap_group_expanded_menu_view()
|
||||
->update_primary_window_button_for_testing();
|
||||
}
|
||||
|
||||
IconButton* update_secondary_window_button() {
|
||||
DCHECK(snap_group_expanded_menu_view());
|
||||
return snap_group_expanded_menu_view()
|
||||
->update_secondary_window_button_for_testing();
|
||||
}
|
||||
|
||||
SnapGroupLockOrUnlockButton* unlock_button() {
|
||||
DCHECK(snap_group_expanded_menu_view());
|
||||
return snap_group_expanded_menu_view()->unlock_button_for_testing();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
class SnapGroupTest : public AshTestBase {
|
||||
@ -265,6 +311,7 @@ class SnapGroupEntryPointArm1Test : public SnapGroupTest {
|
||||
EXPECT_TRUE(split_view_divider());
|
||||
EXPECT_EQ(0.5f, *WindowState::Get(window1)->snap_ratio());
|
||||
EXPECT_EQ(0.5f, *WindowState::Get(window2)->snap_ratio());
|
||||
EXPECT_TRUE(kebab_button());
|
||||
}
|
||||
|
||||
private:
|
||||
@ -460,7 +507,7 @@ TEST_F(SnapGroupEntryPointArm1Test, NotShowOverviewIfEmpty) {
|
||||
}
|
||||
|
||||
// Tests that the hit area of the split view divider can be outside of its
|
||||
// bounds with the extra insets with a value of `kSplitViewDividerExtraInset`.
|
||||
// bounds with the extra insets whose value is `kSplitViewDividerExtraInset`.
|
||||
TEST_F(SnapGroupEntryPointArm1Test, SplitViewDividerEnlargedHitArea) {
|
||||
std::unique_ptr<aura::Window> w1(CreateTestWindow());
|
||||
std::unique_ptr<aura::Window> w2(CreateTestWindow());
|
||||
@ -482,6 +529,31 @@ TEST_F(SnapGroupEntryPointArm1Test, SplitViewDividerEnlargedHitArea) {
|
||||
cached_divider_center_point + move_vector);
|
||||
}
|
||||
|
||||
// Tests that the snap group expanded menu with four buttons will show on mouse
|
||||
// cliked on the kebab button and hide when clicking again.
|
||||
TEST_F(SnapGroupEntryPointArm1Test, ExpandedMenuViewTest) {
|
||||
std::unique_ptr<aura::Window> w1(CreateTestWindow());
|
||||
std::unique_ptr<aura::Window> w2(CreateTestWindow());
|
||||
SnapTwoTestWindowsInArm1(w1.get(), w2.get(), /*horizontal=*/true);
|
||||
|
||||
gfx::Rect kebab_button_bounds_in_screen = kebab_button()->GetBoundsInScreen();
|
||||
auto* event_generator = GetEventGenerator();
|
||||
event_generator->MoveMouseTo(kebab_button_bounds_in_screen.CenterPoint());
|
||||
event_generator->PressLeftButton();
|
||||
event_generator->ReleaseLeftButton();
|
||||
EXPECT_TRUE(snap_group_expanded_menu_widget());
|
||||
EXPECT_TRUE(snap_group_expanded_menu_view());
|
||||
EXPECT_TRUE(swap_windows_button());
|
||||
EXPECT_TRUE(update_primary_window_button());
|
||||
EXPECT_TRUE(update_secondary_window_button());
|
||||
EXPECT_TRUE(unlock_button());
|
||||
|
||||
event_generator->PressLeftButton();
|
||||
event_generator->ReleaseLeftButton();
|
||||
EXPECT_FALSE(snap_group_expanded_menu_widget());
|
||||
EXPECT_FALSE(snap_group_expanded_menu_view());
|
||||
}
|
||||
|
||||
// A test fixture that tests the user-initiated snap group entry point. This
|
||||
// entry point is guarded by the feature flag `kSnapGroup` and will only be
|
||||
// enabled when the feature param `kAutomaticallyLockGroup` is false.
|
||||
@ -572,7 +644,7 @@ class SnapGroupEntryPointArm2Test : public SnapGroupTest {
|
||||
private:
|
||||
// Verifies that the icon image and the tooltip of the lock button gets
|
||||
// updated correctly based on the `locked` state.
|
||||
void VerifyLockButton(bool locked, SnapGroupLockButton* lock_button) {
|
||||
void VerifyLockButton(bool locked, SnapGroupLockOrUnlockButton* lock_button) {
|
||||
const SkColor color =
|
||||
lock_button->GetColorProvider()->GetColor(kColorAshIconColorPrimary);
|
||||
const gfx::ImageSkia locked_icon_image =
|
||||
|
@ -86,6 +86,9 @@ constexpr float kMinDividerPositionRatio = 0.15f;
|
||||
// make it easier to handle located event.
|
||||
constexpr gfx::Insets kSplitViewDividerExtraInset = gfx::Insets::VH(0, -2);
|
||||
|
||||
// Corner radius for the expanded menu that shows on toggling the kebab button.
|
||||
constexpr int kExpandedMenuRoundedCornerRadius = 20;
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_WM_SPLITVIEW_SPLIT_VIEW_CONSTANTS_H_
|
||||
|
@ -2640,15 +2640,6 @@ void SplitViewController::OnWindowSnapped(
|
||||
UpdateSnappedBounds(window == primary_window_ ? secondary_window_
|
||||
: primary_window_);
|
||||
}
|
||||
|
||||
if (state_ == State::kBothSnapped &&
|
||||
ShouldAutomaticallyGroupOnWindowsSnappedInClamshell()) {
|
||||
SnapGroupController* snap_group_controller =
|
||||
Shell::Get()->snap_group_controller();
|
||||
snap_group_controller->AddSnapGroup(primary_window_, secondary_window_);
|
||||
DCHECK(snap_group_controller->AreWindowsInSnapGroup(primary_window_,
|
||||
secondary_window_));
|
||||
}
|
||||
}
|
||||
|
||||
void SplitViewController::OnSnappedWindowDetached(aura::Window* window,
|
||||
|
@ -114,6 +114,10 @@ class ASH_EXPORT SplitViewDivider : public aura::WindowObserver,
|
||||
void OnTransientChildRemoved(aura::Window* window,
|
||||
aura::Window* transient) override;
|
||||
|
||||
SplitViewDividerView* divider_view_for_testing() const {
|
||||
return divider_view_;
|
||||
}
|
||||
|
||||
private:
|
||||
void CreateDividerWidget(SplitViewController* controller);
|
||||
|
||||
|
@ -12,6 +12,9 @@
|
||||
#include "ash/strings/grit/ash_strings.h"
|
||||
#include "ash/style/ash_color_provider.h"
|
||||
#include "ash/system/screen_layout_observer.h"
|
||||
#include "ash/wm/snap_group/snap_group.h"
|
||||
#include "ash/wm/snap_group/snap_group_controller.h"
|
||||
#include "ash/wm/snap_group/snap_group_expanded_menu_view.h"
|
||||
#include "ash/wm/splitview/split_view_constants.h"
|
||||
#include "ash/wm/splitview/split_view_controller.h"
|
||||
#include "ash/wm/splitview/split_view_divider.h"
|
||||
@ -21,7 +24,9 @@
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/compositor/layer.h"
|
||||
#include "ui/compositor/scoped_layer_animation_settings.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
#include "ui/gfx/geometry/rounded_corners_f.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
#include "ui/views/background.h"
|
||||
#include "ui/views/highlight_border.h"
|
||||
|
||||
@ -29,6 +34,11 @@ namespace ash {
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr int kKebabButtonDistanceFromBottom = 24;
|
||||
constexpr gfx::Size kKebabButtonSize{4, 24};
|
||||
constexpr int kDistanceBetweenKebabButtonAndExpandedMenu = 8;
|
||||
constexpr int kExpandedMenuHeight = 150;
|
||||
|
||||
bool IsInTabletMode() {
|
||||
TabletModeController* tablet_mode_controller =
|
||||
Shell::Get()->tablet_mode_controller();
|
||||
@ -50,6 +60,20 @@ SplitViewDividerView::SplitViewDividerView(SplitViewController* controller,
|
||||
SetBackground(
|
||||
views::CreateSolidBackground(AshColorProvider::Get()->GetBaseLayerColor(
|
||||
AshColorProvider::BaseLayerType::kOpaque)));
|
||||
|
||||
if (ShouldAutomaticallyGroupOnWindowsSnappedInClamshell()) {
|
||||
kebab_button_ = AddChildView(std::make_unique<IconButton>(
|
||||
base::BindRepeating(&SplitViewDividerView::OnKebabButtonPressed,
|
||||
base::Unretained(this)),
|
||||
IconButton::Type::kMediumFloating, &kSnapGroupKebabIcon,
|
||||
IDS_ASH_SNAP_GROUP_MORE_OPTIONS,
|
||||
/*is_togglable=*/false,
|
||||
/*has_border=*/false));
|
||||
kebab_button_->SetPaintToLayer();
|
||||
kebab_button_->layer()->SetFillsBoundsOpaquely(false);
|
||||
kebab_button_->SetPreferredSize(kKebabButtonSize);
|
||||
kebab_button_->SetVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
void SplitViewDividerView::DoSpawningAnimation(int spawn_position) {
|
||||
@ -99,6 +123,31 @@ void SplitViewDividerView::Layout() {
|
||||
SetBoundsRect(GetLocalBounds());
|
||||
divider_handler_view_->Refresh(
|
||||
split_view_controller_->is_resizing_with_divider());
|
||||
|
||||
if (ShouldAutomaticallyGroupOnWindowsSnappedInClamshell()) {
|
||||
const gfx::Size kebab_button_size = kebab_button_->GetPreferredSize();
|
||||
const gfx::Rect kebab_button_bounds(
|
||||
(width() - kebab_button_size.width()) / 2.f,
|
||||
height() - kebab_button_size.height() - kKebabButtonDistanceFromBottom,
|
||||
kebab_button_size.width(), kebab_button_size.height());
|
||||
kebab_button_->SetBoundsRect(kebab_button_bounds);
|
||||
|
||||
if (snap_group_expanded_menu_widget_) {
|
||||
gfx::Rect divider_bounds_in_screen =
|
||||
split_view_controller_->split_view_divider()
|
||||
->GetDividerBoundsInScreen(
|
||||
/*is_dragging=*/false);
|
||||
const gfx::Rect expanded_menu_bounds(
|
||||
divider_bounds_in_screen.x() + kSplitviewDividerShortSideLength / 2 -
|
||||
kExpandedMenuRoundedCornerRadius,
|
||||
kebab_button_bounds.y() - kExpandedMenuHeight -
|
||||
kDistanceBetweenKebabButtonAndExpandedMenu,
|
||||
kExpandedMenuRoundedCornerRadius * 2, kExpandedMenuHeight);
|
||||
divider_bounds_in_screen.ClampToCenteredSize(
|
||||
gfx::Size(kExpandedMenuRoundedCornerRadius * 2, kExpandedMenuHeight));
|
||||
snap_group_expanded_menu_widget_->SetBounds(expanded_menu_bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SplitViewDividerView::OnThemeChanged() {
|
||||
@ -210,6 +259,30 @@ void SplitViewDividerView::OnResizeStatusChanged() {
|
||||
split_view_controller_->is_resizing_with_divider());
|
||||
}
|
||||
|
||||
void SplitViewDividerView::OnKebabButtonPressed() {
|
||||
should_show_expanded_menu_ = !should_show_expanded_menu_;
|
||||
if (!should_show_expanded_menu_) {
|
||||
snap_group_expanded_menu_widget_.reset();
|
||||
snap_group_expanded_menu_view_ = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!snap_group_expanded_menu_widget_) {
|
||||
snap_group_expanded_menu_widget_ = std::make_unique<views::Widget>();
|
||||
snap_group_expanded_menu_widget_->Init(CreateWidgetInitParams(
|
||||
split_view_controller_->root_window(), "SnapGroupExpandedMenuWidget"));
|
||||
SnapGroupController* snap_group_controller =
|
||||
Shell::Get()->snap_group_controller();
|
||||
SnapGroup* snap_group = snap_group_controller->GetSnapGroupForGivenWindow(
|
||||
split_view_controller_->primary_window());
|
||||
snap_group_expanded_menu_view_ =
|
||||
snap_group_expanded_menu_widget_->SetContentsView(
|
||||
std::make_unique<SnapGroupExpandedMenuView>(snap_group));
|
||||
}
|
||||
snap_group_expanded_menu_widget_->Show();
|
||||
Layout();
|
||||
}
|
||||
|
||||
BEGIN_METADATA(SplitViewDividerView, views::View)
|
||||
END_METADATA
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#ifndef ASH_WM_SPLITVIEW_SPLIT_VIEW_DIVIDER_VIEW_H_
|
||||
#define ASH_WM_SPLITVIEW_SPLIT_VIEW_DIVIDER_VIEW_H_
|
||||
|
||||
#include "ash/style/icon_button.h"
|
||||
#include "ui/views/view.h"
|
||||
#include "ui/views/view_targeter_delegate.h"
|
||||
#include "ui/views/widget/unique_widget_ptr.h"
|
||||
@ -14,6 +15,7 @@ namespace ash {
|
||||
class SplitViewController;
|
||||
class SplitViewDivider;
|
||||
class SplitViewDividerHandlerView;
|
||||
class SnapGroupExpandedMenuView;
|
||||
|
||||
// A view that acts as the contents view of the split view divider widget.
|
||||
class SplitViewDividerView : public views::View,
|
||||
@ -42,12 +44,37 @@ class SplitViewDividerView : public views::View,
|
||||
bool DoesIntersectRect(const views::View* target,
|
||||
const gfx::Rect& rect) const override;
|
||||
|
||||
IconButton* kebab_button_for_testing() const { return kebab_button_; }
|
||||
views::Widget* snap_group_expanded_menu_widget_for_testing() const {
|
||||
return snap_group_expanded_menu_widget_.get();
|
||||
}
|
||||
SnapGroupExpandedMenuView* snap_group_expanded_menu_view_for_testing() const {
|
||||
return snap_group_expanded_menu_view_;
|
||||
}
|
||||
|
||||
private:
|
||||
void OnResizeStatusChanged();
|
||||
|
||||
// Called when the `kebab_button_` is pressed which toggles between showing or
|
||||
// hiding the `snap_group_expanded_menu_widget_`.
|
||||
void OnKebabButtonPressed();
|
||||
|
||||
SplitViewController* split_view_controller_;
|
||||
SplitViewDividerHandlerView* divider_handler_view_ = nullptr;
|
||||
SplitViewDivider* divider_;
|
||||
|
||||
// A vertical 3-dot button that shows on the split view divider when
|
||||
// `ShouldAutomaticallyGroupOnWindowsSnappedInClamshell()` is true.
|
||||
IconButton* kebab_button_;
|
||||
|
||||
// The snap group expanded menu widget and its contents view.
|
||||
views::UniqueWidgetPtr snap_group_expanded_menu_widget_;
|
||||
SnapGroupExpandedMenuView* snap_group_expanded_menu_view_ = nullptr;
|
||||
|
||||
// True if the `snap_group_expanded_menu_widget_` should show
|
||||
// `OnKebabButtonPressed()` and false otherwise. The value will be updated on
|
||||
// the `kebab_button_` is clicked.
|
||||
bool should_show_expanded_menu_ = false;
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "ash/wm/resize_shadow_controller.h"
|
||||
#include "ash/wm/snap_group/snap_group_constants.h"
|
||||
#include "ash/wm/snap_group/snap_group_controller.h"
|
||||
#include "ash/wm/snap_group/snap_group_lock_button.h"
|
||||
#include "ash/wm/snap_group/snap_group_lock_or_unlock_button.h"
|
||||
#include "ash/wm/window_util.h"
|
||||
#include "ash/wm/wm_metrics.h"
|
||||
#include "ash/wm/workspace/workspace_window_resizer.h"
|
||||
@ -562,7 +562,7 @@ void MultiWindowResizeController::ShowNow() {
|
||||
lock_widget_->Init(CreateWidgetParams(
|
||||
parent_window, /*widget_name=*/"SnapGroupLockWidget"));
|
||||
lock_button_ = lock_widget_->SetContentsView(
|
||||
std::make_unique<SnapGroupLockButton>(window1, window2));
|
||||
std::make_unique<SnapGroupLockOrUnlockButton>(window1, window2));
|
||||
|
||||
gfx::Rect lock_widget_show_bounds_in_screen =
|
||||
ConvertRectToScreen(windows_.window1->parent(),
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/wm/overview/overview_observer.h"
|
||||
#include "ash/wm/snap_group/snap_group_lock_button.h"
|
||||
#include "ash/wm/window_state.h"
|
||||
#include "ash/wm/window_state_observer.h"
|
||||
#include "base/scoped_multi_source_observation.h"
|
||||
@ -23,14 +22,16 @@
|
||||
|
||||
namespace gfx {
|
||||
class PointF;
|
||||
}
|
||||
} // namespace gfx
|
||||
|
||||
namespace views {
|
||||
class Widget;
|
||||
}
|
||||
} // namespace views
|
||||
|
||||
namespace ash {
|
||||
|
||||
class MultiWindowResizeControllerTest;
|
||||
class SnapGroupLockOrUnlockButton;
|
||||
class WorkspaceWindowResizer;
|
||||
|
||||
// MultiWindowResizeController is responsible for determining and showing a
|
||||
@ -78,7 +79,9 @@ class ASH_EXPORT MultiWindowResizeController
|
||||
void OnOverviewModeStarting() override;
|
||||
void OnOverviewModeEndingAnimationComplete(bool canceled) override;
|
||||
|
||||
SnapGroupLockButton* lock_button_for_testing() const { return lock_button_; }
|
||||
SnapGroupLockOrUnlockButton* lock_button_for_testing() const {
|
||||
return lock_button_;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class MultiWindowResizeControllerTest;
|
||||
@ -220,7 +223,7 @@ class ASH_EXPORT MultiWindowResizeController
|
||||
std::unique_ptr<views::Widget> lock_widget_;
|
||||
|
||||
// The contents view of the `lock_widget_`.
|
||||
SnapGroupLockButton* lock_button_;
|
||||
SnapGroupLockOrUnlockButton* lock_button_;
|
||||
|
||||
// If non-null we're in a resize loop.
|
||||
std::unique_ptr<WorkspaceWindowResizer> window_resizer_;
|
||||
|
Reference in New Issue
Block a user