| 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" |
| 11 #include "content/browser/web_contents/aura/types.h" |
| 11 #include "content/browser/web_contents/web_contents_view_aura.h" | 12 #include "content/browser/web_contents/web_contents_view_aura.h" |
| 12 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 13 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
| 14 #include "ui/gfx/image/image.h" | 15 #include "ui/gfx/image/image.h" |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 | 18 |
| 18 class OverscrollNavigationOverlayTest; | 19 class OverscrollNavigationOverlayTest; |
| 19 | 20 |
| 20 // When a history navigation is triggered at the end of an overscroll | 21 // When a history navigation is triggered at the end of an overscroll |
| 21 // navigation, it is necessary to show the history-screenshot until the page is | 22 // navigation, it is necessary to show the history-screenshot until the page is |
| 22 // done navigating and painting. This class accomplishes this by calling the | 23 // done navigating and painting. This class accomplishes this by calling the |
| 23 // navigation and creating, showing and destroying the screenshot window on top | 24 // navigation and creating, showing and destroying the screenshot window on top |
| 24 // of the page until the page has completed loading and painting. When the | 25 // of the page until the page has completed loading and painting. When the |
| 25 // overscroll completes, this screenshot window is returned by | 26 // overscroll completes, this screenshot window is returned by |
| 26 // OnOverscrollComplete and |window_| is set to own it. | 27 // OnOverscrollComplete and |window_| is set to own it. |
| 27 // There are two overscroll cases, for the first one the main window is the web | 28 // 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 | 29 // 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 | 30 // triggered if the user overscrolls after |window_| is set, before the page |
| 30 // finishes loading. When this happens, |window_| is the main window. | 31 // finishes loading. When this happens, |window_| is the main window. |
| 31 class CONTENT_EXPORT OverscrollNavigationOverlay | 32 class CONTENT_EXPORT OverscrollNavigationOverlay |
| 32 : public WebContentsObserver, | 33 : public WebContentsObserver, |
| 33 public OverscrollWindowAnimation::Delegate { | 34 public OverscrollWindowAnimation::Delegate { |
| 34 public: | 35 public: |
| 35 enum NavigationDirection { NONE, FORWARD, BACK, NAVIGATION_COUNT }; | |
| 36 | |
| 37 OverscrollNavigationOverlay(WebContentsImpl* web_contents, | 36 OverscrollNavigationOverlay(WebContentsImpl* web_contents, |
| 38 aura::Window* web_contents_window); | 37 aura::Window* web_contents_window); |
| 39 | 38 |
| 40 ~OverscrollNavigationOverlay() override; | 39 ~OverscrollNavigationOverlay() override; |
| 41 | 40 |
| 42 // Returns a pointer to the relay delegate we own. | 41 // Returns a pointer to the relay delegate we own. |
| 43 OverscrollControllerDelegate* relay_delegate() { return owa_.get(); } | 42 OverscrollControllerDelegate* relay_delegate() { return owa_.get(); } |
| 44 | 43 |
| 45 private: | 44 private: |
| 46 friend class OverscrollNavigationOverlayTest; | 45 friend class OverscrollNavigationOverlayTest; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 115 |
| 117 // The window that hosts the web contents. | 116 // The window that hosts the web contents. |
| 118 aura::Window* web_contents_window_; | 117 aura::Window* web_contents_window_; |
| 119 | 118 |
| 120 DISALLOW_COPY_AND_ASSIGN(OverscrollNavigationOverlay); | 119 DISALLOW_COPY_AND_ASSIGN(OverscrollNavigationOverlay); |
| 121 }; | 120 }; |
| 122 | 121 |
| 123 } // namespace content | 122 } // namespace content |
| 124 | 123 |
| 125 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_NAVIGATION_OVERLAY_H_ | 124 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_NAVIGATION_OVERLAY_H_ |
| OLD | NEW |