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/window_slider.h" | 10 #include "content/browser/web_contents/aura/window_slider.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // When a history navigation is triggered at the end of an overscroll | 22 // When a history navigation is triggered at the end of an overscroll |
23 // navigation, it is necessary to show the history-screenshot until the page is | 23 // navigation, it is necessary to show the history-screenshot until the page is |
24 // done navigating and painting. This class accomplishes this by showing the | 24 // done navigating and painting. This class accomplishes this by showing the |
25 // screenshot window on top of the page until the page has completed loading and | 25 // screenshot window on top of the page until the page has completed loading and |
26 // painting. | 26 // painting. |
27 class CONTENT_EXPORT OverscrollNavigationOverlay | 27 class CONTENT_EXPORT OverscrollNavigationOverlay |
28 : public WebContentsObserver, | 28 : public WebContentsObserver, |
29 public WindowSlider::Delegate { | 29 public WindowSlider::Delegate { |
30 public: | 30 public: |
31 explicit OverscrollNavigationOverlay(WebContentsImpl* web_contents); | 31 explicit OverscrollNavigationOverlay(WebContentsImpl* web_contents); |
32 virtual ~OverscrollNavigationOverlay(); | 32 ~OverscrollNavigationOverlay() override; |
33 | 33 |
34 bool has_window() const { return !!window_.get(); } | 34 bool has_window() const { return !!window_.get(); } |
35 | 35 |
36 // Resets state and starts observing |web_contents_| for page load/paint | 36 // Resets state and starts observing |web_contents_| for page load/paint |
37 // updates. This function makes sure that the screenshot window is stacked | 37 // updates. This function makes sure that the screenshot window is stacked |
38 // on top, so that it hides the content window behind it, and destroys the | 38 // on top, so that it hides the content window behind it, and destroys the |
39 // screenshot window when the page is done loading/painting. | 39 // screenshot window when the page is done loading/painting. |
40 // This should be called immediately after initiating the navigation, | 40 // This should be called immediately after initiating the navigation, |
41 // otherwise the overlay may be dismissed prematurely. | 41 // otherwise the overlay may be dismissed prematurely. |
42 void StartObserving(); | 42 void StartObserving(); |
(...skipping 27 matching lines...) Expand all Loading... |
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 // a window-slide isn't in progress and either the page has been painted or | 71 // a window-slide isn't in progress and either the page has been painted or |
72 // the page-load has completed. | 72 // the page-load has completed. |
73 void StopObservingIfDone(); | 73 void StopObservingIfDone(); |
74 | 74 |
75 // Creates a layer to be used for window-slide. |offset| is the offset of the | 75 // Creates a layer to be used for window-slide. |offset| is the offset of the |
76 // NavigationEntry for the screenshot image to display. | 76 // NavigationEntry for the screenshot image to display. |
77 ui::Layer* CreateSlideLayer(int offset); | 77 ui::Layer* CreateSlideLayer(int offset); |
78 | 78 |
79 // Overridden from WindowSlider::Delegate: | 79 // Overridden from WindowSlider::Delegate: |
80 virtual ui::Layer* CreateBackLayer() override; | 80 ui::Layer* CreateBackLayer() override; |
81 virtual ui::Layer* CreateFrontLayer() override; | 81 ui::Layer* CreateFrontLayer() override; |
82 virtual void OnWindowSlideCompleting() override; | 82 void OnWindowSlideCompleting() override; |
83 virtual void OnWindowSlideCompleted(scoped_ptr<ui::Layer> layer) override; | 83 void OnWindowSlideCompleted(scoped_ptr<ui::Layer> layer) override; |
84 virtual void OnWindowSlideAborted() override; | 84 void OnWindowSlideAborted() override; |
85 virtual void OnWindowSliderDestroyed() override; | 85 void OnWindowSliderDestroyed() override; |
86 | 86 |
87 // Overridden from WebContentsObserver: | 87 // Overridden from WebContentsObserver: |
88 virtual void DidFirstVisuallyNonEmptyPaint() override; | 88 void DidFirstVisuallyNonEmptyPaint() override; |
89 virtual void DidStopLoading(RenderViewHost* host) override; | 89 void DidStopLoading(RenderViewHost* host) override; |
90 | 90 |
91 // The WebContents which is being navigated. | 91 // The WebContents which is being navigated. |
92 WebContentsImpl* web_contents_; | 92 WebContentsImpl* web_contents_; |
93 | 93 |
94 // The screenshot overlay window. | 94 // The screenshot overlay window. |
95 scoped_ptr<aura::Window> window_; | 95 scoped_ptr<aura::Window> window_; |
96 | 96 |
97 // This is the WindowDelegate of |window_|. The delegate manages its own | 97 // This is the WindowDelegate of |window_|. The delegate manages its own |
98 // lifetime (destroys itself when |window_| is destroyed). | 98 // lifetime (destroys itself when |window_| is destroyed). |
99 ImageWindowDelegate* image_delegate_; | 99 ImageWindowDelegate* image_delegate_; |
(...skipping 19 matching lines...) Expand all Loading... |
119 | 119 |
120 // The LayerDelegate used for the back/front layers during a slide. | 120 // The LayerDelegate used for the back/front layers during a slide. |
121 scoped_ptr<ImageLayerDelegate> layer_delegate_; | 121 scoped_ptr<ImageLayerDelegate> layer_delegate_; |
122 | 122 |
123 DISALLOW_COPY_AND_ASSIGN(OverscrollNavigationOverlay); | 123 DISALLOW_COPY_AND_ASSIGN(OverscrollNavigationOverlay); |
124 }; | 124 }; |
125 | 125 |
126 } // namespace content | 126 } // namespace content |
127 | 127 |
128 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_NAVIGATION_OVERLAY_H_ | 128 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_NAVIGATION_OVERLAY_H_ |
OLD | NEW |