Index: chrome/browser/renderer_host/render_widget_host_view_mac.mm |
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm |
index 682f0c9afede1232503e15064c666072b560966f..4cf8bd3ac51e13ab7c4bb4ce445f00fed56db7b0 100644 |
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm |
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm |
@@ -25,6 +25,7 @@ |
#include "chrome/browser/spellchecker/spellchecker_platform_engine.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/browser_list.h" |
+#import "chrome/browser/ui/cocoa/history_overlay_controller.h" |
#import "chrome/browser/ui/cocoa/rwhvm_editcommand_helper.h" |
#import "chrome/browser/ui/cocoa/view_id_util.h" |
#include "chrome/common/render_messages.h" |
@@ -1587,25 +1588,39 @@ void RenderWidgetHostViewMac::SetTextInputActive(bool active) { |
// that's actually done in the renderer |
// (ChromeClientImpl::shouldRubberBand()), when it decides if it should |
// rubberband or send back an event unhandled. |
+ // FIXME: Is this true with the UI up? |
(isPinnedLeft_ && !isRightScroll) || |
(isPinnedRight_ && isRightScroll))) { |
- // The way this api works: gestureAmount is between -1 and 1 (float). If |
+ |
+ // Released by the tracking handler once the gesture is complete. |
+ HistoryOverlayController* historyOverlay = |
Alexei Svitkine (slow)
2011/08/16 14:10:04
I was going to ask you about this - but Mark beat
|
+ [[HistoryOverlayController alloc] |
+ initForMode:goForward ? kHistoryOverlayModeForward : |
+ kHistoryOverlayModeBack]; |
+ |
+ // The way this api works: gestureAmount is between -1 and 1 (float). If |
// the user does the gesture for more than about 25% (i.e. < -0.25 or > |
// 0.25) and then lets go, it is accepted, we get a NSEventPhaseEnded, |
// and after that the block is called with amounts animating towards 1 |
// (or -1, depending on the direction). If the user lets go below that |
// threshold, we get NSEventPhaseCancelled, and the amount animates |
- // toward 0. |
+ // toward 0. When gestureAmount has reaches its final value, i.e. the |
+ // track animation is done, the handler is called with |isComplete| set |
+ // to |YES|. |
[theEvent trackSwipeEventWithOptions:0 |
- dampenAmountThresholdMin:-1 |
- max:1 |
+ dampenAmountThresholdMin:-50 |
Mark Mentovai
2011/08/16 05:47:22
Why the change to ±50 here? Learn anything you’re
Nico
2011/08/16 15:55:43
Hah, no. I played with this and couldn't really se
|
+ max:50 |
usingHandler:^(CGFloat gestureAmount, |
NSEventPhase phase, |
BOOL isComplete, |
BOOL *stop) { |
+ if (phase == NSEventPhaseBegan) { |
+ [historyOverlay showPanelForWindow:[self window]]; |
+ return; |
+ } |
+ |
// |gestureAmount| obeys -[NSEvent isDirectionInvertedFromDevice] |
// automatically. |
- // TODO(thakis): UI. |
Browser* browser = BrowserList::GetLastActive(); |
if (phase == NSEventPhaseEnded && browser) { |
if (goForward) |
@@ -1613,6 +1628,12 @@ void RenderWidgetHostViewMac::SetTextInputActive(bool active) { |
else |
browser->GoBack(CURRENT_TAB); |
} |
+ |
+ [historyOverlay setProgress:gestureAmount]; |
+ if (isComplete) { |
+ [historyOverlay dismiss]; |
+ [historyOverlay release]; |
+ } |
}]; |
return YES; |
} |