Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(725)

Unified Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 2690573002: MacViews: Handle three-finger swipe gestures for navigation. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/frame/browser_view.cc
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index f4dbf87a9b3440d7ce19808cf32bf6b2c92f3fe7..222aa7a8d3016e2de0810fc1d5fc5e681ad4f80a 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -1980,6 +1980,26 @@ void BrowserView::OnNativeThemeChanged(const ui::NativeTheme* theme) {
chrome::MaybeShowInvertBubbleView(this);
}
+void BrowserView::OnGestureEvent(ui::GestureEvent* event) {
+#if defined(OS_MACOSX)
+ if (event->details().type() == ui::ET_GESTURE_SWIPE) {
sky 2017/02/10 19:08:33 Can you structure this code to be a bit more reada
themblsha 2017/02/15 17:35:34 base::Optional<int> should be a better way to do i
+ unsigned int command = 0;
sky 2017/02/10 19:08:33 Aren't command ids ints?
themblsha 2017/02/15 17:35:34 The code was adapted from the browser_window_contr
+ if (event->details().swipe_left())
tapted 2017/02/13 11:26:24 -[BrowserWindowController swipeWithEvent:] only tr
themblsha 2017/02/15 17:35:34 In my testing the -swipeWithEvent: is always calle
tapted 2017/02/15 22:25:52 Can you comment about this where you construct the
themblsha 2017/02/16 15:27:49 Done.
+ command = IDC_FORWARD;
+ else if (event->details().swipe_right())
tapted 2017/02/13 11:26:24 I really think left/right around the right are aro
themblsha 2017/02/15 17:35:34 I originally tested the behaviour to match Safari
+ command = IDC_BACK;
+
+ if (chrome::IsCommandEnabled(browser(), command)) {
+ chrome::ExecuteCommandWithDisposition(
+ browser(), command, ui::DispositionFromEventFlags(event->flags()));
+ }
+ return;
+ }
+#endif // OS_MACOSX
+
+ ClientView::OnGestureEvent(event);
+}
+
///////////////////////////////////////////////////////////////////////////////
// BrowserView, ui::AcceleratorTarget overrides:

Powered by Google App Engine
This is Rietveld 408576698