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..2aca6a477d8b531e3d9cb261e5a2792b8ea1a845 100644 |
--- a/chrome/browser/ui/views/frame/browser_view.cc |
+++ b/chrome/browser/ui/views/frame/browser_view.cc |
@@ -271,6 +271,23 @@ void PaintAttachedBookmarkBar(gfx::Canvas* canvas, |
} |
} |
+bool GetGestureCommand(ui::GestureEvent* event, int* command) { |
+ DCHECK(command); |
+ *command = 0; |
+#if defined(OS_MACOSX) |
+ if (event->details().type() == ui::ET_GESTURE_SWIPE) { |
+ if (event->details().swipe_left()) { |
+ *command = IDC_BACK; |
+ return true; |
+ } else if (event->details().swipe_right()) { |
+ *command = IDC_FORWARD; |
+ return true; |
+ } |
+ } |
+#endif // OS_MACOSX |
+ return false; |
+} |
+ |
} // namespace |
/////////////////////////////////////////////////////////////////////////////// |
@@ -1938,6 +1955,18 @@ void BrowserView::Layout() { |
IsToolbarVisible() ? FocusBehavior::ALWAYS : FocusBehavior::NEVER); |
} |
+void BrowserView::OnGestureEvent(ui::GestureEvent* event) { |
+ int command; |
+ if (GetGestureCommand(event, &command) && |
+ chrome::IsCommandEnabled(browser(), command)) { |
+ chrome::ExecuteCommandWithDisposition( |
+ browser(), command, ui::DispositionFromEventFlags(event->flags())); |
+ return; |
+ } |
+ |
+ ClientView::OnGestureEvent(event); |
+} |
+ |
void BrowserView::ViewHierarchyChanged( |
const ViewHierarchyChangedDetails& details) { |
if (!initialized_ && details.is_add && details.child == this && GetWidget()) { |