Chromium Code Reviews| Index: cc/input/scroll_elasticity_controller.h |
| diff --git a/cc/input/scroll_elasticity_controller.h b/cc/input/scroll_elasticity_controller.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2fb8620d48af34f0386894166dc7cd3a4658116f |
| --- /dev/null |
| +++ b/cc/input/scroll_elasticity_controller.h |
| @@ -0,0 +1,75 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
|
aelias_OOO_until_Jul13
2014/11/12 22:17:59
This double license header is not a pattern used a
ccameron
2014/11/13 00:28:37
The double license header pattern is used almost e
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CC_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ |
| +#define CC_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ |
| + |
| +#include "base/time/time.h" |
| +#include "cc/base/cc_export.h" |
| +#include "ui/gfx/geometry/vector2d_f.h" |
| + |
| +namespace cc { |
| + |
| +class CC_EXPORT ScrollElasticityController { |
| + public: |
| + virtual void WillShutdown() = 0; |
|
jdduke (slow)
2014/11/12 20:13:37
It's unfortunate to have yet another Bind/WillShut
ccameron
2014/11/13 00:28:37
Agree -- pulled this through the existing InputHan
|
| + virtual void Animate(base::TimeTicks time) = 0; |
| +}; |
| + |
| +// ScrollElasticityControllerClient is based on |
| +// WebKit/Source/platform/mac/ScrollElasticityController.h |
| +/* |
| + * Copyright (C) 2011 Apple Inc. All rights reserved. |
| + * |
| + * Redistribution and use in source and binary forms, with or without |
| + * modification, are permitted provided that the following conditions |
| + * are met: |
| + * 1. Redistributions of source code must retain the above copyright |
| + * notice, this list of conditions and the following disclaimer. |
| + * 2. Redistributions in binary form must reproduce the above copyright |
| + * notice, this list of conditions and the following disclaimer in the |
| + * documentation and/or other materials provided with the distribution. |
| + * |
| + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
| + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
| + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| + * THE POSSIBILITY OF SUCH DAMAGE. |
| + */ |
| + |
| +class CC_EXPORT ScrollElasticityControllerClient { |
| + public: |
| + virtual void BindToController(ScrollElasticityController* controller) = 0; |
| + virtual bool AllowsHorizontalStretching() = 0; |
| + virtual bool AllowsVerticalStretching() = 0; |
| + // The amount that the view is stretched past the normal allowable bounds. |
| + // The "overhang" amount. |
| + virtual gfx::Vector2dF StretchAmount() = 0; |
| + virtual bool PinnedInDirection(const gfx::Vector2dF& direction) = 0; |
| + virtual bool CanScrollHorizontally() = 0; |
| + virtual bool CanScrollVertically() = 0; |
| + |
| + // Return the absolute scroll position, not relative to the scroll origin. |
| + virtual gfx::Vector2dF AbsoluteScrollPosition() = 0; |
| + |
| + virtual void ImmediateScrollBy(const gfx::Vector2dF& scroll) = 0; |
| + virtual void ImmediateScrollByWithoutContentEdgeConstraints( |
| + const gfx::Vector2dF& scroll) = 0; |
| + virtual void StartSnapRubberbandTimer() = 0; |
| + virtual void StopSnapRubberbandTimer() = 0; |
| + |
| + // If the current scroll position is within the overhang area, this function |
| + // will cause |
| + // the page to scroll to the nearest boundary point. |
| + virtual void AdjustScrollPositionToBoundsIfNecessary() = 0; |
| +}; |
| +} // namespace cc |
| + |
| +#endif // CC_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ |