summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-20 19:10:57 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-20 19:10:57 +0000
commit3f396b93f0ff66f61893316a9bcac5506347aa31 (patch)
treee86340046c6eaa8be2db7af561a0d2f9aaef053d /chrome
parent805c2555e0a56b0083fd198345e45956f546654e (diff)
downloadchromium_src-3f396b93f0ff66f61893316a9bcac5506347aa31.zip
chromium_src-3f396b93f0ff66f61893316a9bcac5506347aa31.tar.gz
chromium_src-3f396b93f0ff66f61893316a9bcac5506347aa31.tar.bz2
Support multi-touch gestures for back&forward.
Review URL: http://codereview.chromium.org/115579 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16505 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm21
1 files changed, 21 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index 9469bba..5258fc9 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -660,4 +660,25 @@ willPositionSheet:(NSWindow *)sheet
return [views arrayByAddingObjectsFromArray:browserViews];
}
+// Undocumented method for multi-touch gestures in 10.5. Future OS's will
+// likely add a public API, but the worst that will happen is that this will
+// turn into dead code and just won't get called.
+- (void)swipeWithEvent:(NSEvent*)event {
+ // Map forwards and backwards to history; left is positive, right is negative.
+ unsigned int command = 0;
+ if ([event deltaX] > 0.5)
+ command = IDC_BACK;
+ else if ([event deltaX] < -0.5)
+ command = IDC_FORWARD;
+ else if ([event deltaY] > 0.5)
+ ; // TODO(pinkerton): figure out page-up
+ else if ([event deltaY] < -0.5)
+ ; // TODO(pinkerton): figure out page-down
+
+ // Ensure the command is valid first (ExecuteCommand() won't do that) and
+ // then make it so.
+ if (browser_->command_updater()->IsCommandEnabled(command))
+ browser_->ExecuteCommand(command);
+}
+
@end