Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_OVERSCROLL_ANIMATOR_MAC_H _ | |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_OVERSCROLL_ANIMATOR_MAC_H _ | |
| 7 | |
| 8 #import <Cocoa/Cocoa.h> | |
| 9 | |
| 10 namespace content { | |
| 11 class WebContentsImpl; | |
| 12 } | |
| 13 | |
| 14 // NSViews that intend to manage the animation associated with an overscroll | |
| 15 // must implement this protocol. | |
| 16 @protocol WebContentsOverscrollAnimator | |
| 17 // Begin an overscroll animation to the left or the right. | |
| 18 - (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.
| |
| 19 | |
| 20 // Some implementations require the WebContentsView to supply a snapshot of a | |
| 21 // previous navigation state. The WebContentsView should call this method at the | |
| 22 // beginning of an overscroll animation, and supply a snapshot if required. | |
| 23 - (BOOL)needsNavigationSnapshot; | |
| 24 | |
| 25 // Supply a snapshot for use during the overscroll animation. | |
| 26 - (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
| |
| 27 | |
| 28 // Due to the nature of some of the overscroll animations, implementators of | |
| 29 // this protocol must have control over the layout of the RenderWidgetHost's | |
| 30 // NativeView. When there is no overscroll animation in progress, the | |
| 31 // 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.
| |
| 32 // in screen coordinates is the same as its own frame in screen coordinates. | |
| 33 // Due to the odd ownership cycles of the RenderWidgetHost's NativeView, it is | |
| 34 // important that its presence in the NSView hierarchy is the only strong | |
| 35 // reference, and that when it gets removed from the NSView hierarchy, it will | |
| 36 // be dealloc'ed shortly thereafter. | |
| 37 - (void)addRenderWidgetHostNativeView:(NSView*)view; | |
| 38 | |
| 39 // During an overscroll animation, |progress| ranges from 0 to 2, and indicates | |
| 40 // how close the overscroll is to completing. If the overscroll ends with | |
| 41 // |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
| |
| 42 - (void)updateOverscrollProgress:(CGFloat)progress; | |
| 43 | |
| 44 // Animate the finish of the overscroll and perform a navigation. The navigation | |
| 45 // may not happen synchronously, but is guaranteed to eventually occur. | |
| 46 - (void)completeOverscroll:(content::WebContentsImpl*)webContents; | |
| 47 | |
| 48 // Animate the cancellation of the overscroll. | |
| 49 - (void)cancelOverscroll; | |
| 50 @end | |
| 51 | |
| 52 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_OVERSCROLL_ANIMATOR_MA C_H_ | |
| OLD | NEW |