File: web_contents_view_overscroll_animator_mac.h

package info (click to toggle)
chromium-browser 41.0.2272.118-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 2,189,132 kB
  • sloc: cpp: 9,691,462; ansic: 3,341,451; python: 712,689; asm: 518,779; xml: 208,926; java: 169,820; sh: 119,353; perl: 68,907; makefile: 28,311; yacc: 13,305; objc: 11,385; tcl: 3,186; cs: 2,225; sql: 2,217; lex: 2,215; lisp: 1,349; pascal: 1,256; awk: 407; ruby: 155; sed: 53; php: 14; exp: 11
file content (61 lines) | stat: -rw-r--r-- 2,753 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// 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;

// The direction of the overscroll animations. Backwards means that the user
// wants to navigate backwards in the navigation history. The opposite applies
// to forwards.
enum OverscrollAnimatorDirection {
  OVERSCROLL_ANIMATOR_DIRECTION_BACKWARDS,
  OVERSCROLL_ANIMATOR_DIRECTION_FORWARDS,
};
}  // namespace content

// NSViews that intend to manage the animation associated with an overscroll
// must implement this protocol.
@protocol WebContentsOverscrollAnimator
// Some implementations require the WebContentsView to supply a snapshot of a
// previous navigation state. This method determines whether the snapshot passed
// to the overscroll animator is expected to be non-nil.
- (BOOL)needsNavigationSnapshot;

// Begin an overscroll animation. The method -needsNavigationSnapshot determines
// whether |snapshot| can be nil.
- (void)beginOverscrollInDirection:
            (content::OverscrollAnimatorDirection)direction
                navigationSnapshot:(NSImage*)snapshot;

// 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 RenderWidgetHost's
// NativeView 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.
- (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_