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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 // Stop observing the page and start the final overlay fade-out animation | 73 // Stop observing the page and start the final overlay fade-out animation |
74 // if the page-load has completed and the page has been painted, and a | 74 // if the page-load has completed and the page has been painted, and a |
75 // window-slide isn't in progress. | 75 // window-slide isn't in progress. |
76 void StopObservingIfDone(); | 76 void StopObservingIfDone(); |
77 | 77 |
78 // Creates a layer to be used for window-slide. |offset| is the offset of the | 78 // Creates a layer to be used for window-slide. |offset| is the offset of the |
79 // NavigationEntry for the screenshot image to display. | 79 // NavigationEntry for the screenshot image to display. |
80 ui::Layer* CreateSlideLayer(int offset); | 80 ui::Layer* CreateSlideLayer(int offset); |
81 | 81 |
82 // IPC message callbacks. | |
83 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); | |
84 | |
85 // Overridden from WindowSlider::Delegate: | 82 // Overridden from WindowSlider::Delegate: |
86 virtual ui::Layer* CreateBackLayer() OVERRIDE; | 83 virtual ui::Layer* CreateBackLayer() OVERRIDE; |
87 virtual ui::Layer* CreateFrontLayer() OVERRIDE; | 84 virtual ui::Layer* CreateFrontLayer() OVERRIDE; |
88 virtual void OnWindowSlideCompleting() OVERRIDE; | 85 virtual void OnWindowSlideCompleting() OVERRIDE; |
89 virtual void OnWindowSlideCompleted() OVERRIDE; | 86 virtual void OnWindowSlideCompleted() OVERRIDE; |
90 virtual void OnWindowSlideAborted() OVERRIDE; | 87 virtual void OnWindowSlideAborted() OVERRIDE; |
91 virtual void OnWindowSliderDestroyed() OVERRIDE; | 88 virtual void OnWindowSliderDestroyed() OVERRIDE; |
92 | 89 |
93 // Overridden from WebContentsObserver: | 90 // Overridden from WebContentsObserver: |
94 virtual void DocumentOnLoadCompletedInMainFrame() OVERRIDE; | |
95 virtual void DidFirstVisuallyNonEmptyPaint() OVERRIDE; | 91 virtual void DidFirstVisuallyNonEmptyPaint() OVERRIDE; |
96 virtual void DidStopLoading(RenderViewHost* host) OVERRIDE; | |
97 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
98 | 92 |
99 // The WebContents which is being navigated. | 93 // The WebContents which is being navigated. |
100 WebContentsImpl* web_contents_; | 94 WebContentsImpl* web_contents_; |
101 | 95 |
102 // The screenshot overlay window. | 96 // The screenshot overlay window. |
103 scoped_ptr<aura::Window> window_; | 97 scoped_ptr<aura::Window> window_; |
104 | 98 |
105 // This is the WindowDelegate of |window_|. The delegate manages its own | 99 // This is the WindowDelegate of |window_|. The delegate manages its own |
106 // lifetime (destroys itself when |window_| is destroyed). | 100 // lifetime (destroys itself when |window_| is destroyed). |
107 ImageWindowDelegate* image_delegate_; | 101 ImageWindowDelegate* image_delegate_; |
108 | 102 |
109 bool loading_complete_; | |
110 bool received_paint_update_; | 103 bool received_paint_update_; |
111 | 104 |
112 // Unique ID of the NavigationEntry we are navigating to. This is needed to | 105 // Unique ID of the NavigationEntry we are navigating to. This is needed to |
113 // filter on WebContentsObserver callbacks and is used to dismiss the overlay | 106 // filter on WebContentsObserver callbacks and is used to dismiss the overlay |
114 // when the relevant page loads and paints. | 107 // when the relevant page loads and paints. |
115 int pending_entry_id_; | 108 int pending_entry_id_; |
116 | 109 |
117 // The |WindowSlider| that allows sliding history layers while the page is | 110 // The |WindowSlider| that allows sliding history layers while the page is |
118 // being reloaded. | 111 // being reloaded. |
119 scoped_ptr<WindowSlider> window_slider_; | 112 scoped_ptr<WindowSlider> window_slider_; |
120 | 113 |
121 // The direction of the in-progress slide (if any). | 114 // The direction of the in-progress slide (if any). |
122 SlideDirection slide_direction_; | 115 SlideDirection slide_direction_; |
123 | 116 |
124 // The LayerDelegate used for the back/front layers during a slide. | 117 // The LayerDelegate used for the back/front layers during a slide. |
125 scoped_ptr<ImageLayerDelegate> layer_delegate_; | 118 scoped_ptr<ImageLayerDelegate> layer_delegate_; |
126 | 119 |
127 // During tests, the aura windows don't get any paint updates. So the overlay | 120 // During tests, the aura windows don't get any paint updates. So the overlay |
128 // container keeps waiting for a paint update it never receives, causing a | 121 // container keeps waiting for a paint update it never receives, causing a |
129 // timeout. So during tests, disable the wait for paint updates. | 122 // timeout. So during tests, disable the wait for paint updates. |
130 bool need_paint_update_; | 123 bool need_paint_update_; |
131 | 124 |
132 DISALLOW_COPY_AND_ASSIGN(OverscrollNavigationOverlay); | 125 DISALLOW_COPY_AND_ASSIGN(OverscrollNavigationOverlay); |
133 }; | 126 }; |
134 | 127 |
135 } // namespace content | 128 } // namespace content |
136 | 129 |
137 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_NAVIGATION_OVERLAY_H_ | 130 #endif // CONTENT_BROWSER_WEB_CONTENTS_AURA_OVERSCROLL_NAVIGATION_OVERLAY_H_ |
OLD | NEW |