Index: content/browser/web_contents/web_contents_view_overscroll_animator_mac.h |
diff --git a/content/browser/web_contents/web_contents_view_overscroll_animator_mac.h b/content/browser/web_contents/web_contents_view_overscroll_animator_mac.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..850721f1129c69ede7fab78919a02588ac503cab |
--- /dev/null |
+++ b/content/browser/web_contents/web_contents_view_overscroll_animator_mac.h |
@@ -0,0 +1,52 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_OVERSCROLL_ANIMATOR_MAC_H_ |
+#define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_OVERSCROLL_ANIMATOR_MAC_H_ |
+ |
+#import <Cocoa/Cocoa.h> |
+ |
+namespace content { |
+class WebContentsImpl; |
+} |
+ |
+// NSViews that intend to manage the animation associated with an overscroll |
+// must implement this protocol. |
+@protocol WebContentsOverscrollAnimator |
+// Begin an overscroll animation to the left or the right. |
+- (void)beginOverscrollLeft:(BOOL)left; |
Avi (use Gerrit)
2014/06/06 23:09:44
I would much rather see a two-value enum.
erikchen
2014/06/07 00:34:03
Done.
|
+ |
+// Some implementations require the WebContentsView to supply a snapshot of a |
+// previous navigation state. The WebContentsView should call this method at the |
+// beginning of an overscroll animation, and supply a snapshot if required. |
+- (BOOL)needsNavigationSnapshot; |
+ |
+// Supply a snapshot for use during the overscroll animation. |
+- (void)supplyNavigationSnapshot:(NSImage*)image; |
Avi (use Gerrit)
2014/06/06 23:09:44
I don't understand how this goes. Is the WebConten
erikchen
2014/06/07 00:34:03
I've reworked the methods in question to clarify t
|
+ |
+// Due to the nature of some of the overscroll animations, implementators of |
+// this protocol must have control over the layout of the RenderWidgetHost's |
+// NativeView. When there is no overscroll animation in progress, the |
+// implementor must guarantee that the frame of the RenderWidetHost's NativeView |
Avi (use Gerrit)
2014/06/06 23:09:44
s/RenderWidetHost/RenderWidgetHost/
erikchen
2014/06/07 00:34:03
Done.
|
+// in screen coordinates is the same as its own frame in screen coordinates. |
+// Due to the odd ownership cycles of the RenderWidgetHost's NativeView, it is |
+// important that its presence in the NSView hierarchy is the only strong |
+// reference, and that when it gets removed from the NSView hierarchy, it will |
+// be dealloc'ed shortly thereafter. |
+- (void)addRenderWidgetHostNativeView:(NSView*)view; |
+ |
+// During an overscroll animation, |progress| ranges from 0 to 2, and indicates |
+// how close the overscroll is to completing. If the overscroll ends with |
+// |progress| >= 1, then the overscroll is considered completed. |
Avi (use Gerrit)
2014/06/06 23:09:44
These usually are 0-1 ranged. Why 0-2?
erikchen
2014/06/07 00:34:03
I could keep progress from 0-1, and compare agains
|
+- (void)updateOverscrollProgress:(CGFloat)progress; |
+ |
+// Animate the finish of the overscroll and perform a navigation. The navigation |
+// may not happen synchronously, but is guaranteed to eventually occur. |
+- (void)completeOverscroll:(content::WebContentsImpl*)webContents; |
+ |
+// Animate the cancellation of the overscroll. |
+- (void)cancelOverscroll; |
+@end |
+ |
+#endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_OVERSCROLL_ANIMATOR_MAC_H_ |