Home | History | Annotate | Download | only in web_contents
      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_SLIDER_MAC_H_
      6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_OVERSCROLL_ANIMATOR_SLIDER_MAC_H_
      7 
      8 #import <Cocoa/Cocoa.h>
      9 
     10 #include "base/mac/scoped_nsobject.h"
     11 #include "base/memory/scoped_ptr.h"
     12 #include "content/browser/web_contents/web_contents_view_overscroll_animator_mac.h"
     13 
     14 namespace overscroll_animator {
     15 class WebContentsPaintObserver;
     16 }  // namespace overscroll_animator
     17 
     18 @interface OverscrollAnimatorSliderView
     19     : NSView<WebContentsOverscrollAnimator> {
     20   // This container view holds the RenderWidgetHost's NativeViews. Most of the
     21   // time, its frame in screen coordinates is the same as SliderView's frame in
     22   // screen coordinates. During an overscroll animation, it may temporarily be
     23   // relocated, but it will return to its original position after the overscroll
     24   // animation is finished.
     25   base::scoped_nsobject<NSView> middleView_;
     26 
     27   // This view is a sibling of middleView_, and is guaranteed to live below it.
     28   // Most of the time, it is hidden. During a backwards overscroll animation,
     29   // middleView_ is slid to the right, and bottomView_ peeks out from the
     30   // original position of middleView_.
     31   base::scoped_nsobject<NSImageView> bottomView_;
     32 
     33   // This view is a sibling of middleView_, and is guaranteed to live above it.
     34   // Most of the time, it is hidden. During a forwards overscroll animation,
     35   // topView_ is slid to the left from off screen, its final position exactly
     36   // covering middleView_.
     37   base::scoped_nsobject<NSImageView> topView_;
     38 
     39   // The direction of the current overscroll animation. This property has no
     40   // meaning when inOverscroll_ is false.
     41   content::OverscrollAnimatorDirection direction_;
     42 
     43   // Indicates that this view is completing or cancelling the overscroll. This
     44   // animation cannot be cancelled.
     45   BOOL animating_;
     46 
     47   // Reflects whether this view is in the process of handling an overscroll.
     48   BOOL inOverscroll_;
     49 
     50   // The most recent value passed to -updateOverscrollProgress:.
     51   CGFloat progress_;
     52 
     53   // An observer that reports the first non-empty paint of a WebContents. This
     54   // is used when completing an overscroll animation.
     55   scoped_ptr<overscroll_animator::WebContentsPaintObserver> observer_;
     56 }
     57 @end
     58 
     59 #endif  // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_VIEW_OVERSCROLL_ANIMATOR_SLIDER_MAC_H_
     60