| OLD | NEW | 
|   1 // Copyright 2015 The Chromium Authors. All rights reserved. |   1 // Copyright 2015 The Chromium Authors. All rights reserved. | 
|   2 // Use of this source code is governed by a BSD-style license that can be |   2 // Use of this source code is governed by a BSD-style license that can be | 
|   3 // found in the LICENSE file. |   3 // found in the LICENSE file. | 
|   4  |   4  | 
|   5 #ifndef TopControls_h |   5 #ifndef TopControls_h | 
|   6 #define TopControls_h |   6 #define TopControls_h | 
|   7  |   7  | 
|   8 #include "core/CoreExport.h" |   8 #include "core/CoreExport.h" | 
|   9 #include "platform/heap/Handle.h" |   9 #include "platform/heap/Handle.h" | 
|  10 #include "public/platform/WebTopControlsState.h" |  10 #include "public/platform/WebTopControlsState.h" | 
|  11 #include "wtf/OwnPtr.h" |  11 #include "wtf/OwnPtr.h" | 
|  12 #include "wtf/PassOwnPtr.h" |  12 #include "wtf/PassOwnPtr.h" | 
|  13  |  13  | 
|  14 namespace blink { |  14 namespace blink { | 
|  15 class FrameHost; |  15 class FrameHost; | 
|  16 class FloatSize; |  16 class FloatSize; | 
|  17  |  17  | 
|  18 // This class encapsulate data and logic required to show/hide top controls |  18 // This class encapsulate data and logic required to show/hide top controls | 
|  19 // duplicating cc::TopControlsManager behaviour.  Top controls' self-animation |  19 // duplicating cc::TopControlsManager behaviour.  Top controls' self-animation | 
|  20 // to completion is still handled by compositor and kicks in when scrolling is |  20 // to completion is still handled by compositor and kicks in when scrolling is | 
|  21 // complete (i.e, upon ScrollEnd or FlingEnd). |  21 // complete (i.e, upon ScrollEnd or FlingEnd). | 
|  22 class CORE_EXPORT TopControls final : public NoBaseWillBeGarbageCollectedFinaliz
    ed<TopControls> { |  22 class CORE_EXPORT TopControls final : public GarbageCollectedFinalized<TopContro
    ls> { | 
|  23     USING_FAST_MALLOC_WILL_BE_REMOVED(TopControls); |  | 
|  24 public: |  23 public: | 
|  25     static PassOwnPtrWillBeRawPtr<TopControls> create(const FrameHost& host) |  24     static RawPtr<TopControls> create(const FrameHost& host) | 
|  26     { |  25     { | 
|  27         return adoptPtrWillBeNoop(new TopControls(host)); |  26         return new TopControls(host); | 
|  28     } |  27     } | 
|  29  |  28  | 
|  30     ~TopControls(); |  29     ~TopControls(); | 
|  31     DECLARE_TRACE(); |  30     DECLARE_TRACE(); | 
|  32  |  31  | 
|  33     // The amount that the viewport was shrunk by to accommodate the top |  32     // The amount that the viewport was shrunk by to accommodate the top | 
|  34     // controls. |  33     // controls. | 
|  35     float layoutHeight(); |  34     float layoutHeight(); | 
|  36     // The amount that top controls are currently shown. |  35     // The amount that top controls are currently shown. | 
|  37     float contentOffset(); |  36     float contentOffset(); | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
|  48     void scrollBegin(); |  47     void scrollBegin(); | 
|  49  |  48  | 
|  50     // Scrolls top controls vertically if possible and returns the remaining scr
    oll |  49     // Scrolls top controls vertically if possible and returns the remaining scr
    oll | 
|  51     // amount. |  50     // amount. | 
|  52     FloatSize scrollBy(FloatSize scrollDelta); |  51     FloatSize scrollBy(FloatSize scrollDelta); | 
|  53  |  52  | 
|  54 private: |  53 private: | 
|  55     explicit TopControls(const FrameHost&); |  54     explicit TopControls(const FrameHost&); | 
|  56     void resetBaseline(); |  55     void resetBaseline(); | 
|  57  |  56  | 
|  58     RawPtrWillBeMember<const FrameHost> m_frameHost; |  57     Member<const FrameHost> m_frameHost; | 
|  59  |  58  | 
|  60     // The top controls height regardless of whether it is visible or not. |  59     // The top controls height regardless of whether it is visible or not. | 
|  61     float m_height; |  60     float m_height; | 
|  62  |  61  | 
|  63     // The top controls shown amount (normalized from 0 to 1) since the last |  62     // The top controls shown amount (normalized from 0 to 1) since the last | 
|  64     // compositor commit. This value is updated from two sources: |  63     // compositor commit. This value is updated from two sources: | 
|  65     // (1) compositor (impl) thread at the beginning of frame if it has |  64     // (1) compositor (impl) thread at the beginning of frame if it has | 
|  66     //     scrolled top controls since last commit. |  65     //     scrolled top controls since last commit. | 
|  67     // (2) blink (main) thread updates this value if it scrolls top controls |  66     // (2) blink (main) thread updates this value if it scrolls top controls | 
|  68     //     when responding to gesture scroll events. |  67     //     when responding to gesture scroll events. | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
|  80     // controls height. |  79     // controls height. | 
|  81     bool m_shrinkViewport; |  80     bool m_shrinkViewport; | 
|  82  |  81  | 
|  83     // Constraints on the top controls state |  82     // Constraints on the top controls state | 
|  84     WebTopControlsState m_permittedState; |  83     WebTopControlsState m_permittedState; | 
|  85  |  84  | 
|  86 }; |  85 }; | 
|  87 } // namespace blink |  86 } // namespace blink | 
|  88  |  87  | 
|  89 #endif // TopControls_h |  88 #endif // TopControls_h | 
| OLD | NEW |