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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // This should be called immediately after initiating the navigation, | 66 // This should be called immediately after initiating the navigation, |
67 // otherwise the overlay may be dismissed prematurely. | 67 // otherwise the overlay may be dismissed prematurely. |
68 void StartObserving(); | 68 void StartObserving(); |
69 | 69 |
70 // Stop observing the page and start the final overlay fade-out animation if | 70 // Stop observing the page and start the final overlay fade-out animation if |
71 // there's no active overscroll window animation. | 71 // there's no active overscroll window animation. |
72 void StopObservingIfDone(); | 72 void StopObservingIfDone(); |
73 | 73 |
74 // Creates a window that shows a history-screenshot and is stacked relative to | 74 // Creates a window that shows a history-screenshot and is stacked relative to |
75 // the current overscroll |direction_| with the given |bounds|. | 75 // the current overscroll |direction_| with the given |bounds|. |
76 scoped_ptr<aura::Window> CreateOverlayWindow(const gfx::Rect& bounds); | 76 std::unique_ptr<aura::Window> CreateOverlayWindow(const gfx::Rect& bounds); |
77 | 77 |
78 // Returns an image with the history-screenshot for the previous or next page, | 78 // Returns an image with the history-screenshot for the previous or next page, |
79 // according to the given |direction|. | 79 // according to the given |direction|. |
80 const gfx::Image GetImageForDirection(NavigationDirection direction) const; | 80 const gfx::Image GetImageForDirection(NavigationDirection direction) const; |
81 | 81 |
82 // Overridden from OverscrollWindowAnimation::Delegate: | 82 // Overridden from OverscrollWindowAnimation::Delegate: |
83 scoped_ptr<aura::Window> CreateFrontWindow(const gfx::Rect& bounds) override; | 83 std::unique_ptr<aura::Window> CreateFrontWindow( |
84 scoped_ptr<aura::Window> CreateBackWindow(const gfx::Rect& bounds) override; | 84 const gfx::Rect& bounds) override; |
| 85 std::unique_ptr<aura::Window> CreateBackWindow( |
| 86 const gfx::Rect& bounds) override; |
85 aura::Window* GetMainWindow() const override; | 87 aura::Window* GetMainWindow() const override; |
86 void OnOverscrollCompleting() override; | 88 void OnOverscrollCompleting() override; |
87 void OnOverscrollCompleted(scoped_ptr<aura::Window> window) override; | 89 void OnOverscrollCompleted(std::unique_ptr<aura::Window> window) override; |
88 void OnOverscrollCancelled() override; | 90 void OnOverscrollCancelled() override; |
89 | 91 |
90 // Overridden from WebContentsObserver: | 92 // Overridden from WebContentsObserver: |
91 void DidFirstVisuallyNonEmptyPaint() override; | 93 void DidFirstVisuallyNonEmptyPaint() override; |
92 void DidStopLoading() override; | 94 void DidStopLoading() override; |
93 | 95 |
94 // The current overscroll direction. | 96 // The current overscroll direction. |
95 NavigationDirection direction_; | 97 NavigationDirection direction_; |
96 | 98 |
97 // The web contents that are being navigated. | 99 // The web contents that are being navigated. |
98 WebContentsImpl* web_contents_; | 100 WebContentsImpl* web_contents_; |
99 | 101 |
100 // The overlay window that shows a screenshot during an overscroll gesture and | 102 // The overlay window that shows a screenshot during an overscroll gesture and |
101 // handles overscroll events during the second overscroll case. | 103 // handles overscroll events during the second overscroll case. |
102 scoped_ptr<aura::Window> window_; | 104 std::unique_ptr<aura::Window> window_; |
103 | 105 |
104 bool loading_complete_; | 106 bool loading_complete_; |
105 bool received_paint_update_; | 107 bool received_paint_update_; |
106 | 108 |
107 // URL of the NavigationEntry we are navigating to. This is needed to | 109 // URL of the NavigationEntry we are navigating to. This is needed to |
108 // filter on WebContentsObserver callbacks and is used to dismiss the overlay | 110 // filter on WebContentsObserver callbacks and is used to dismiss the overlay |
109 // when the relevant page loads and paints. | 111 // when the relevant page loads and paints. |
110 GURL pending_entry_url_; | 112 GURL pending_entry_url_; |
111 | 113 |
112 // Manages the overscroll animations. | 114 // Manages the overscroll animations. |
113 scoped_ptr<OverscrollWindowAnimation> owa_; | 115 std::unique_ptr<OverscrollWindowAnimation> owa_; |
114 | 116 |
115 // The window that hosts the web contents. | 117 // The window that hosts the web contents. |
116 aura::Window* web_contents_window_; | 118 aura::Window* web_contents_window_; |
117 | 119 |
118 DISALLOW_COPY_AND_ASSIGN(OverscrollNavigationOverlay); | 120 DISALLOW_COPY_AND_ASSIGN(OverscrollNavigationOverlay); |
119 }; | 121 }; |
120 | 122 |
121 } // namespace content | 123 } // namespace content |
122 | 124 |
123 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_NAVIGATION_OVERLAY_H_ | 125 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_NAVIGATION_OVERLAY_H_ |
OLD | NEW |