Commit 3f3e178f authored by Xiaodan Zhu's avatar Xiaodan Zhu Committed by Commit Bot

Turn on the reverse scrolling gesture feature.

This CL enable the feature of reverse scrolling gestures.

 - Enable reverse scrolling gesture feature.
 - Get rid of the notification for overview gestures.
 - Add toast for the gestures entering overview when the natural
 scrolling is OFF.

Bug: 1107183
Change-Id: Ibbabca1b5deb5b37c8b697ff732f5312519e3adc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2510350Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Xiaodan Zhu <zxdan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824219}
parent 4400e53b
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include "ash/touch/touch_devices_controller.h" #include "ash/touch/touch_devices_controller.h"
#include "ash/wallpaper/wallpaper_controller_impl.h" #include "ash/wallpaper/wallpaper_controller_impl.h"
#include "ash/wm/desks/desks_restore_util.h" #include "ash/wm/desks/desks_restore_util.h"
#include "ash/wm/gestures/wm_gesture_handler.h"
#include "chromeos/components/quick_answers/public/cpp/quick_answers_prefs.h" #include "chromeos/components/quick_answers/public/cpp/quick_answers_prefs.h"
#include "chromeos/constants/chromeos_pref_names.h" #include "chromeos/constants/chromeos_pref_names.h"
#include "chromeos/services/assistant/public/cpp/assistant_prefs.h" #include "chromeos/services/assistant/public/cpp/assistant_prefs.h"
...@@ -75,7 +74,6 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry, bool for_test) { ...@@ -75,7 +74,6 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry, bool for_test) {
ShelfController::RegisterProfilePrefs(registry); ShelfController::RegisterProfilePrefs(registry);
TouchDevicesController::RegisterProfilePrefs(registry, for_test); TouchDevicesController::RegisterProfilePrefs(registry, for_test);
tray::VPNListView::RegisterProfilePrefs(registry); tray::VPNListView::RegisterProfilePrefs(registry);
WmGestureHandler::RegisterProfilePrefs(registry);
MediaTray::RegisterProfilePrefs(registry); MediaTray::RegisterProfilePrefs(registry);
// Provide prefs registered in the browser for ash_unittests. // Provide prefs registered in the browser for ash_unittests.
......
...@@ -520,11 +520,11 @@ This file contains the strings for ash. ...@@ -520,11 +520,11 @@ This file contains the strings for ash.
<message name="IDS_GESTURE_NOTIFICATION_MESSAGE_LEARN_MORE" desc="The body of the notification to show off new gestures. This notification body links to the help page for the gestures."> <message name="IDS_GESTURE_NOTIFICATION_MESSAGE_LEARN_MORE" desc="The body of the notification to show off new gestures. This notification body links to the help page for the gestures.">
Use gestures to quickly switch between apps and interact with your Chromebook in tablet mode. Use gestures to quickly switch between apps and interact with your Chromebook in tablet mode.
</message> </message>
<message name="IDS_OVERVIEW_REVERSE_GESTURE_NOTIFICATION_TITLE" desc="The title of the notification to change reverse gesture when entering/exiting overview mode"> <message name="IDS_CHANGE_ENTER_OVERVIEW_REVERSE_GESTURE" desc="The toast of changing enter overview gesture">
The Overview touchpad gesture has changed The touchpad gesture to enter Overview has changed. Swipe up with three fingers to enter Overview.
</message> </message>
<message name="IDS_OVERVIEW_REVERSE_GESTURE_NOTIFICATION_MESSAGE" desc="The body of the notification to change reverse gesture when entering/exiting overview mode"> <message name="IDS_CHANGE_EXIT_OVERVIEW_REVERSE_GESTURE" desc="The toast of changing exit overview gesture">
Swipe up with three fingers to open and down to close the Overview. The touchpad gesture to exit Overview has changed. Swipe down with three fingers to exit Overview.
</message> </message>
<message name="IDS_CHANGE_NEXT_DESK_REVERSE_GESTURE" desc="The toast of changing reverse gesture to switch to the next desk."> <message name="IDS_CHANGE_NEXT_DESK_REVERSE_GESTURE" desc="The toast of changing reverse gesture to switch to the next desk.">
The touchpad gesture to switch to the next desk has changed. Swipe right with four fingers to switch to the next desk. The touchpad gesture to switch to the next desk has changed. Swipe right with four fingers to switch to the next desk.
......
33e60d7fae900329ccf2d68cfd7a84138a10b515
\ No newline at end of file
89bcdf911a81ba210c539d5ad983c6b8208ff9a9
\ No newline at end of file
20bc6189a45f4cd148cfa3bae5f41ed4b9223588
\ No newline at end of file
20bc6189a45f4cd148cfa3bae5f41ed4b9223588
\ No newline at end of file
...@@ -118,7 +118,7 @@ const base::Feature kHideShelfControlsInTabletMode{ ...@@ -118,7 +118,7 @@ const base::Feature kHideShelfControlsInTabletMode{
"HideShelfControlsInTabletMode", base::FEATURE_ENABLED_BY_DEFAULT}; "HideShelfControlsInTabletMode", base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kReverseScrollGestures{"EnableReverseScrollGestures", const base::Feature kReverseScrollGestures{"EnableReverseScrollGestures",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kSystemTrayMicGainSetting{"SystemTrayMicGainSetting", const base::Feature kSystemTrayMicGainSetting{"SystemTrayMicGainSetting",
base::FEATURE_ENABLED_BY_DEFAULT}; base::FEATURE_ENABLED_BY_DEFAULT};
......
...@@ -579,11 +579,6 @@ const char kColorModeThemed[] = "cros.system.color_mode_themed"; ...@@ -579,11 +579,6 @@ const char kColorModeThemed[] = "cros.system.color_mode_themed";
const char kAppNotificationBadgingEnabled[] = const char kAppNotificationBadgingEnabled[] =
"ash.app_notification_badging_enabled"; "ash.app_notification_badging_enabled";
// An integer pref that counts how many times the reverse gesture notification
// shows.
const char kReverseGestureNotificationCount[] =
"ash.wm.reverse_gesture_notification_count";
// An integer pref that indicates whether global media controls is pinned to // An integer pref that indicates whether global media controls is pinned to
// shelf or it's unset and need to be determined by screen size during runtime. // shelf or it's unset and need to be determined by screen size during runtime.
const char kGlobalMediaControlsPinned[] = const char kGlobalMediaControlsPinned[] =
......
...@@ -209,8 +209,6 @@ ASH_PUBLIC_EXPORT extern const char kColorModeThemed[]; ...@@ -209,8 +209,6 @@ ASH_PUBLIC_EXPORT extern const char kColorModeThemed[];
ASH_PUBLIC_EXPORT extern const char kAppNotificationBadgingEnabled[]; ASH_PUBLIC_EXPORT extern const char kAppNotificationBadgingEnabled[];
ASH_PUBLIC_EXPORT extern const char kReverseGestureNotificationCount[];
ASH_PUBLIC_EXPORT extern const char kGlobalMediaControlsPinned[]; ASH_PUBLIC_EXPORT extern const char kGlobalMediaControlsPinned[];
} // namespace prefs } // namespace prefs
......
This diff is collapsed.
...@@ -55,8 +55,6 @@ class ASH_EXPORT WmGestureHandler { ...@@ -55,8 +55,6 @@ class ASH_EXPORT WmGestureHandler {
// otherwise. // otherwise.
bool ProcessScrollEvent(const ui::ScrollEvent& event); bool ProcessScrollEvent(const ui::ScrollEvent& event);
static void RegisterProfilePrefs(PrefRegistrySimple* registry);
private: private:
// A struct containing the relevant data during a scroll session. // A struct containing the relevant data during a scroll session.
struct ScrollData { struct ScrollData {
......
...@@ -33,9 +33,6 @@ constexpr int kNumFingersForWindowCycle = 2; ...@@ -33,9 +33,6 @@ constexpr int kNumFingersForWindowCycle = 2;
constexpr int kNumFingersForHighlight = 3; constexpr int kNumFingersForHighlight = 3;
constexpr int kNumFingersForDesksSwitch = 4; constexpr int kNumFingersForDesksSwitch = 4;
constexpr char kOverviewGestureNotificationId[] =
"ash.wm.reverse_overview_gesture";
bool InOverviewSession() { bool InOverviewSession() {
return Shell::Get()->overview_controller()->InOverviewSession(); return Shell::Get()->overview_controller()->InOverviewSession();
} }
...@@ -51,18 +48,6 @@ bool IsNaturalScrollOn() { ...@@ -51,18 +48,6 @@ bool IsNaturalScrollOn() {
pref->GetBoolean(prefs::kNaturalScroll); pref->GetBoolean(prefs::kNaturalScroll);
} }
bool IsOverviewReverseGestureNotificationShown() {
return message_center::MessageCenter::Get()->FindVisibleNotificationById(
kOverviewGestureNotificationId);
}
void CloseOverviewReverseGestureNotification() {
if (IsOverviewReverseGestureNotificationShown()) {
message_center::MessageCenter::Get()->RemoveNotification(
kOverviewGestureNotificationId, true);
}
}
int GetOffsetX(int offset) { int GetOffsetX(int offset) {
// The handler code uses the new directions which is the reverse of the old // The handler code uses the new directions which is the reverse of the old
// handler code. Reverse the offset if the ReverseScrollGestures feature is // handler code. Reverse the offset if the ReverseScrollGestures feature is
...@@ -141,32 +126,17 @@ TEST_F(WmGestureHandlerTest, WrongVerticalScrolls) { ...@@ -141,32 +126,17 @@ TEST_F(WmGestureHandlerTest, WrongVerticalScrolls) {
const float long_scroll = 2 * WmGestureHandler::kVerticalThresholdDp; const float long_scroll = 2 * WmGestureHandler::kVerticalThresholdDp;
// Swiping down can enter overview but a notification will be shown. // Swiping down cannot enter overview.
Scroll(0, -long_scroll, 3); Scroll(0, -long_scroll, 3);
EXPECT_TRUE(InOverviewSession());
// Notification is shown for the first time.
EXPECT_TRUE(IsOverviewReverseGestureNotificationShown());
CloseOverviewReverseGestureNotification();
// Swiping up can exit overview, but a notification will be shown.
Scroll(0, long_scroll, 3);
EXPECT_FALSE(InOverviewSession()); EXPECT_FALSE(InOverviewSession());
// Notification is shown for the second time.
EXPECT_TRUE(IsOverviewReverseGestureNotificationShown());
CloseOverviewReverseGestureNotification();
// Swiping down triggers the notification for the last time. // Enter overview.
Scroll(0, -long_scroll, 3); Scroll(0, long_scroll, 3);
EXPECT_TRUE(InOverviewSession()); EXPECT_TRUE(InOverviewSession());
// Notification is shown for the third (last) time.
EXPECT_TRUE(IsOverviewReverseGestureNotificationShown());
CloseOverviewReverseGestureNotification();
// Doing wrong gesture again won't trigger notification anymore. // Swiping up cannot exit overview.
Scroll(0, long_scroll, 3); Scroll(0, long_scroll, 3);
EXPECT_FALSE(InOverviewSession()); EXPECT_TRUE(InOverviewSession());
// No notification will be shown anymore.
EXPECT_FALSE(IsOverviewReverseGestureNotificationShown());
} }
// Tests three or four finger horizontal scroll gesture (depending on flags) to // Tests three or four finger horizontal scroll gesture (depending on flags) to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment