| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 BrowserControls_h | 5 #ifndef BrowserControls_h |
| 6 #define BrowserControls_h | 6 #define BrowserControls_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/WebBrowserControlsState.h" | 10 #include "public/platform/WebBrowserControlsState.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 class FrameHost; | 13 class Page; |
| 14 class FloatSize; | 14 class FloatSize; |
| 15 | 15 |
| 16 // This class encapsulate data and logic required to show/hide browser controls | 16 // This class encapsulate data and logic required to show/hide browser controls |
| 17 // duplicating cc::BrowserControlsManager behaviour. Browser controls' | 17 // duplicating cc::BrowserControlsManager behaviour. Browser controls' |
| 18 // self-animation to completion is still handled by compositor and kicks in | 18 // self-animation to completion is still handled by compositor and kicks in |
| 19 // when scrolling is complete (i.e, upon ScrollEnd or FlingEnd). | 19 // when scrolling is complete (i.e, upon ScrollEnd or FlingEnd). |
| 20 class CORE_EXPORT BrowserControls final | 20 class CORE_EXPORT BrowserControls final |
| 21 : public GarbageCollected<BrowserControls> { | 21 : public GarbageCollected<BrowserControls> { |
| 22 public: | 22 public: |
| 23 static BrowserControls* create(const FrameHost& host) { | 23 static BrowserControls* create(const Page& page) { |
| 24 return new BrowserControls(host); | 24 return new BrowserControls(page); |
| 25 } | 25 } |
| 26 | 26 |
| 27 DECLARE_TRACE(); | 27 DECLARE_TRACE(); |
| 28 | 28 |
| 29 // The amount that the viewport was shrunk by to accommodate the top | 29 // The amount that the viewport was shrunk by to accommodate the top |
| 30 // controls. | 30 // controls. |
| 31 float layoutHeight(); | 31 float layoutHeight(); |
| 32 // The amount that browser controls are currently shown. | 32 // The amount that browser controls are currently shown. |
| 33 float contentOffset(); | 33 float contentOffset(); |
| 34 | 34 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 45 | 45 |
| 46 void scrollBegin(); | 46 void scrollBegin(); |
| 47 | 47 |
| 48 // Scrolls browser controls vertically if possible and returns the remaining | 48 // Scrolls browser controls vertically if possible and returns the remaining |
| 49 // scroll amount. | 49 // scroll amount. |
| 50 FloatSize scrollBy(FloatSize scrollDelta); | 50 FloatSize scrollBy(FloatSize scrollDelta); |
| 51 | 51 |
| 52 WebBrowserControlsState permittedState() const { return m_permittedState; } | 52 WebBrowserControlsState permittedState() const { return m_permittedState; } |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 explicit BrowserControls(const FrameHost&); | 55 explicit BrowserControls(const Page&); |
| 56 void resetBaseline(); | 56 void resetBaseline(); |
| 57 | 57 |
| 58 Member<const FrameHost> m_frameHost; | 58 Member<const Page> m_page; |
| 59 | 59 |
| 60 // The browser controls height regardless of whether it is visible or not. | 60 // The browser controls height regardless of whether it is visible or not. |
| 61 float m_height; | 61 float m_height; |
| 62 | 62 |
| 63 // The browser controls shown amount (normalized from 0 to 1) since the last | 63 // The browser controls shown amount (normalized from 0 to 1) since the last |
| 64 // compositor commit. This value is updated from two sources: | 64 // compositor commit. This value is updated from two sources: |
| 65 // (1) compositor (impl) thread at the beginning of frame if it has | 65 // (1) compositor (impl) thread at the beginning of frame if it has |
| 66 // scrolled browser controls since last commit. | 66 // scrolled browser controls since last commit. |
| 67 // (2) blink (main) thread updates this value if it scrolls browser controls | 67 // (2) blink (main) thread updates this value if it scrolls browser controls |
| 68 // when responding to gesture scroll events. | 68 // when responding to gesture scroll events. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 79 // If this is true, then the embedder shrunk the WebView size by the top | 79 // If this is true, then the embedder shrunk the WebView size by the top |
| 80 // controls height. | 80 // controls height. |
| 81 bool m_shrinkViewport; | 81 bool m_shrinkViewport; |
| 82 | 82 |
| 83 // Constraints on the browser controls state | 83 // Constraints on the browser controls state |
| 84 WebBrowserControlsState m_permittedState; | 84 WebBrowserControlsState m_permittedState; |
| 85 }; | 85 }; |
| 86 } // namespace blink | 86 } // namespace blink |
| 87 | 87 |
| 88 #endif // BrowserControls_h | 88 #endif // BrowserControls_h |
| OLD | NEW |