| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_NAVIGATION_OVERLAY_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_NAVIGATION_OVERLAY_H_ |
| 6 #define CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_NAVIGATION_OVERLAY_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_NAVIGATION_OVERLAY_H_ |
| 7 | 7 |
| 8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "content/browser/web_contents/aura/overscroll_window_animation.h" | 10 #include "content/browser/web_contents/aura/overscroll_window_animation.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // overscroll completes, this screenshot window is returned by | 25 // overscroll completes, this screenshot window is returned by |
| 26 // OnOverscrollComplete and |window_| is set to own it. | 26 // OnOverscrollComplete and |window_| is set to own it. |
| 27 // There are two overscroll cases, for the first one the main window is the web | 27 // There are two overscroll cases, for the first one the main window is the web |
| 28 // contents window. At this stage, |window_| is null. The second case is | 28 // contents window. At this stage, |window_| is null. The second case is |
| 29 // triggered if the user overscrolls after |window_| is set, before the page | 29 // triggered if the user overscrolls after |window_| is set, before the page |
| 30 // finishes loading. When this happens, |window_| is the main window. | 30 // finishes loading. When this happens, |window_| is the main window. |
| 31 class CONTENT_EXPORT OverscrollNavigationOverlay | 31 class CONTENT_EXPORT OverscrollNavigationOverlay |
| 32 : public WebContentsObserver, | 32 : public WebContentsObserver, |
| 33 public OverscrollWindowAnimation::Delegate { | 33 public OverscrollWindowAnimation::Delegate { |
| 34 public: | 34 public: |
| 35 // Note that this enum is used to back an UMA histogram, so it should be | |
| 36 // treated as append-only. | |
| 37 enum NavigationDirection { NONE, FORWARD, BACK, NAVIGATION_COUNT }; | 35 enum NavigationDirection { NONE, FORWARD, BACK, NAVIGATION_COUNT }; |
| 38 | 36 |
| 39 OverscrollNavigationOverlay(WebContentsImpl* web_contents, | 37 OverscrollNavigationOverlay(WebContentsImpl* web_contents, |
| 40 aura::Window* web_contents_window); | 38 aura::Window* web_contents_window); |
| 41 | 39 |
| 42 ~OverscrollNavigationOverlay() override; | 40 ~OverscrollNavigationOverlay() override; |
| 43 | 41 |
| 44 // Returns a pointer to the relay delegate we own. | 42 // Returns a pointer to the relay delegate we own. |
| 45 OverscrollControllerDelegate* relay_delegate() { return owa_.get(); } | 43 OverscrollControllerDelegate* relay_delegate() { return owa_.get(); } |
| 46 | 44 |
| 47 private: | 45 private: |
| 48 friend class OverscrollNavigationOverlayTest; | 46 friend class OverscrollNavigationOverlayTest; |
| 49 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, WithScreenshot); | 47 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, WithScreenshot); |
| 50 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, WithoutScreenshot); | 48 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, WithoutScreenshot); |
| 51 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, CannotNavigate); | 49 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, CannotNavigate); |
| 50 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, ForwardNavigation); |
| 51 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, |
| 52 ForwardNavigationCancelled); |
| 52 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, CancelNavigation); | 53 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, CancelNavigation); |
| 53 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, | 54 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, |
| 54 CancelAfterSuccessfulNavigation); | 55 CancelAfterSuccessfulNavigation); |
| 55 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, OverlayWindowSwap); | 56 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, OverlayWindowSwap); |
| 56 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, | 57 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, |
| 57 CloseDuringAnimation); | 58 CloseDuringAnimation); |
| 58 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, | 59 FRIEND_TEST_ALL_PREFIXES(OverscrollNavigationOverlayTest, |
| 59 ImmediateLoadOnNavigate); | 60 ImmediateLoadOnNavigate); |
| 60 | 61 |
| 61 // Resets state and starts observing |web_contents_| for page load/paint | 62 // Resets state and starts observing |web_contents_| for page load/paint |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 116 |
| 116 // The window that hosts the web contents. | 117 // The window that hosts the web contents. |
| 117 aura::Window* web_contents_window_; | 118 aura::Window* web_contents_window_; |
| 118 | 119 |
| 119 DISALLOW_COPY_AND_ASSIGN(OverscrollNavigationOverlay); | 120 DISALLOW_COPY_AND_ASSIGN(OverscrollNavigationOverlay); |
| 120 }; | 121 }; |
| 121 | 122 |
| 122 } // namespace content | 123 } // namespace content |
| 123 | 124 |
| 124 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_NAVIGATION_OVERLAY_H_ | 125 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_NAVIGATION_OVERLAY_H_ |
| OLD | NEW |