Make USB permissions work in the new permission message system
[chromium-blink-merge.git] / content / browser / web_contents / web_contents_view_overscroll_animator_mac.h
blob0603a9b99e34caebd7dafb8e1fc72d887c0b1bbe
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.
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_
8 #import <Cocoa/Cocoa.h>
10 namespace content {
11 class WebContentsImpl;
13 // The direction of the overscroll animations. Backwards means that the user
14 // wants to navigate backwards in the navigation history. The opposite applies
15 // to forwards.
16 enum OverscrollAnimatorDirection {
17 OVERSCROLL_ANIMATOR_DIRECTION_BACKWARDS,
18 OVERSCROLL_ANIMATOR_DIRECTION_FORWARDS,
20 } // namespace content
22 // NSViews that intend to manage the animation associated with an overscroll
23 // must implement this protocol.
24 @protocol WebContentsOverscrollAnimator
25 // Some implementations require the WebContentsView to supply a snapshot of a
26 // previous navigation state. This method determines whether the snapshot passed
27 // to the overscroll animator is expected to be non-nil.
28 - (BOOL)needsNavigationSnapshot;
30 // Begin an overscroll animation. The method -needsNavigationSnapshot determines
31 // whether |snapshot| can be nil.
32 - (void)beginOverscrollInDirection:
33 (content::OverscrollAnimatorDirection)direction
34 navigationSnapshot:(NSImage*)snapshot;
36 // Due to the nature of some of the overscroll animations, implementators of
37 // this protocol must have control over the layout of the RenderWidgetHost's
38 // NativeView. When there is no overscroll animation in progress, the
39 // implementor must guarantee that the frame of the RenderWidgetHost's
40 // NativeView in screen coordinates is the same as its own frame in screen
41 // coordinates.
42 // Due to the odd ownership cycles of the RenderWidgetHost's NativeView, it is
43 // important that its presence in the NSView hierarchy is the only strong
44 // reference, and that when it gets removed from the NSView hierarchy, it will
45 // be dealloc'ed shortly thereafter.
46 - (void)addRenderWidgetHostNativeView:(NSView*)view;
48 // During an overscroll animation, |progress| ranges from 0 to 2, and indicates
49 // how close the overscroll is to completing. If the overscroll ends with
50 // |progress| >= 1, then the overscroll is considered completed.
51 - (void)updateOverscrollProgress:(CGFloat)progress;
53 // Animate the finish of the overscroll and perform a navigation. The navigation
54 // may not happen synchronously, but is guaranteed to eventually occur.
55 - (void)completeOverscroll:(content::WebContentsImpl*)webContents;
57 // Animate the cancellation of the overscroll.
58 - (void)cancelOverscroll;
59 @end
61 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_OVERSCROLL_ANIMATOR_MAC_H_