Push API: Add PUSH_DELIVERY_STATUS_INVALID_MESSAGE
[chromium-blink-merge.git] / cc / input / scroll_elasticity_helper.h
blobbf444ee2dab9c048c16635c33ecebc2a94a8cab8
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 CC_INPUT_SCROLL_ELASTICITY_HELPER_H_
6 #define CC_INPUT_SCROLL_ELASTICITY_HELPER_H_
8 #include "base/time/time.h"
9 #include "cc/base/cc_export.h"
10 #include "ui/gfx/geometry/scroll_offset.h"
11 #include "ui/gfx/geometry/vector2d_f.h"
13 namespace cc {
15 class LayerTreeHostImpl;
17 // ScrollElasticityHelper is based on
18 // WebKit/Source/platform/mac/ScrollElasticityController.h
20 * Copyright (C) 2011 Apple Inc. All rights reserved.
22 * Redistribution and use in source and binary forms, with or without
23 * modification, are permitted provided that the following conditions
24 * are met:
25 * 1. Redistributions of source code must retain the above copyright
26 * notice, this list of conditions and the following disclaimer.
27 * 2. Redistributions in binary form must reproduce the above copyright
28 * notice, this list of conditions and the following disclaimer in the
29 * documentation and/or other materials provided with the distribution.
31 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
32 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
33 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
34 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
35 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
39 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
41 * THE POSSIBILITY OF SUCH DAMAGE.
44 // Interface between a LayerTreeHostImpl and the ScrollElasticityController. It
45 // would be possible, in principle, for LayerTreeHostImpl to implement this
46 // interface itself. This artificial boundary is introduced to reduce the amount
47 // of logic and state held directly inside LayerTreeHostImpl.
48 class CC_EXPORT ScrollElasticityHelper {
49 public:
50 static ScrollElasticityHelper* CreateForLayerTreeHostImpl(
51 LayerTreeHostImpl* layer_tree_host_impl);
53 virtual ~ScrollElasticityHelper() {}
55 // The amount that the view is stretched past the normal allowable bounds.
56 virtual gfx::Vector2dF StretchAmount() const = 0;
57 virtual void SetStretchAmount(const gfx::Vector2dF& stretch_amount) = 0;
59 // Functions for the scrolling of the root scroll layer.
60 virtual gfx::ScrollOffset ScrollOffset() const = 0;
61 virtual gfx::ScrollOffset MaxScrollOffset() const = 0;
62 virtual void ScrollBy(const gfx::Vector2dF& delta) = 0;
64 // Request that the controller have its Animate method called for the next
65 // frame.
66 virtual void RequestAnimate() = 0;
69 } // namespace cc
71 #endif // CC_INPUT_SCROLL_ELASTICITY_HELPER_H_