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 #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h" | 5 #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h" |
6 | 6 |
7 #include "content/browser/frame_host/navigation_entry_impl.h" | 7 #include "content/browser/frame_host/navigation_entry_impl.h" |
8 #include "content/browser/renderer_host/render_view_host_impl.h" | 8 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 9 #include "content/browser/web_contents/aura/overscroll_layer_wrapper.h" |
| 10 #include "content/browser/web_contents/aura/overscroll_window_delegate.h" |
9 #include "content/browser/web_contents/web_contents_impl.h" | 11 #include "content/browser/web_contents/web_contents_impl.h" |
10 #include "content/common/view_messages.h" | 12 #include "content/common/view_messages.h" |
11 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/browser/render_widget_host_view.h" | 14 #include "content/public/browser/render_widget_host_view.h" |
13 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
14 #include "ui/aura_extra/image_window_delegate.h" | 16 #include "ui/aura_extra/image_window_delegate.h" |
15 #include "ui/base/layout.h" | 17 #include "ui/base/layout.h" |
16 #include "ui/compositor/layer.h" | 18 #include "ui/compositor/layer.h" |
17 #include "ui/compositor/layer_animation_observer.h" | 19 #include "ui/compositor/layer_animation_observer.h" |
18 #include "ui/compositor/scoped_layer_animation_settings.h" | 20 #include "ui/compositor/scoped_layer_animation_settings.h" |
19 #include "ui/gfx/canvas.h" | 21 #include "ui/gfx/canvas.h" |
20 #include "ui/gfx/image/image_png_rep.h" | 22 #include "ui/gfx/image/image_png_rep.h" |
21 #include "ui/gfx/image/image_skia.h" | |
22 | 23 |
23 namespace content { | 24 namespace content { |
24 namespace { | 25 namespace { |
25 | 26 |
26 // Returns true if the entry's URL or any of the URLs in entry's redirect chain | 27 // Returns true if the entry's URL or any of the URLs in entry's redirect chain |
27 // match |url|. | 28 // match |url|. |
28 bool DoesEntryMatchURL(NavigationEntry* entry, const GURL& url) { | 29 bool DoesEntryMatchURL(NavigationEntry* entry, const GURL& url) { |
29 if (!entry) | 30 if (!entry) |
30 return false; | 31 return false; |
31 if (entry->GetURL() == url) | 32 if (entry->GetURL() == url) |
32 return true; | 33 return true; |
33 const std::vector<GURL>& redirect_chain = entry->GetRedirectChain(); | 34 const std::vector<GURL>& redirect_chain = entry->GetRedirectChain(); |
34 for (std::vector<GURL>::const_iterator it = redirect_chain.begin(); | 35 for (std::vector<GURL>::const_iterator it = redirect_chain.begin(); |
35 it != redirect_chain.end(); | 36 it != redirect_chain.end(); |
36 it++) { | 37 it++) { |
37 if (*it == url) | 38 if (*it == url) |
38 return true; | 39 return true; |
39 } | 40 } |
40 return false; | 41 return false; |
41 } | 42 } |
42 | 43 |
43 } // namespace | 44 } // namespace |
44 | 45 |
45 // A LayerDelegate that paints an image for the layer. | 46 // A LayerDelegate that paints an image for the layer. |
| 47 // TODO move to overscroll_window.h |
46 class ImageLayerDelegate : public ui::LayerDelegate { | 48 class ImageLayerDelegate : public ui::LayerDelegate { |
47 public: | 49 public: |
48 ImageLayerDelegate() {} | 50 ImageLayerDelegate() {} |
49 | 51 |
50 ~ImageLayerDelegate() override {} | 52 ~ImageLayerDelegate() override {} |
51 | 53 |
52 void SetImage(const gfx::Image& image) { | 54 void SetImage(const gfx::Image& image) { |
53 image_ = image; | 55 image_ = image; |
54 image_size_ = image.AsImageSkia().size(); | 56 image_size_ = image.AsImageSkia().size(); |
55 } | 57 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 125 |
124 private: | 126 private: |
125 ~OverlayDismissAnimator() override {} | 127 ~OverlayDismissAnimator() override {} |
126 | 128 |
127 scoped_ptr<ui::Layer> layer_; | 129 scoped_ptr<ui::Layer> layer_; |
128 | 130 |
129 DISALLOW_COPY_AND_ASSIGN(OverlayDismissAnimator); | 131 DISALLOW_COPY_AND_ASSIGN(OverlayDismissAnimator); |
130 }; | 132 }; |
131 | 133 |
132 OverscrollNavigationOverlay::OverscrollNavigationOverlay( | 134 OverscrollNavigationOverlay::OverscrollNavigationOverlay( |
133 WebContentsImpl* web_contents) | 135 WebContentsImpl* web_contents, |
134 : web_contents_(web_contents), | 136 OverscrollWindowAnimation* owa, |
135 image_delegate_(NULL), | 137 aura::Window* web_contents_window) |
| 138 : direction_(OverscrollWindowAnimation::NONE), |
| 139 web_contents_(web_contents), |
| 140 image_delegate_(nullptr), |
136 loading_complete_(false), | 141 loading_complete_(false), |
137 received_paint_update_(false), | 142 received_paint_update_(false), |
138 slide_direction_(SLIDE_UNKNOWN) { | 143 owa_(owa), |
| 144 web_contents_window_(web_contents_window) { |
139 } | 145 } |
140 | 146 |
141 OverscrollNavigationOverlay::~OverscrollNavigationOverlay() { | 147 OverscrollNavigationOverlay::~OverscrollNavigationOverlay() { |
142 } | 148 } |
143 | 149 |
144 void OverscrollNavigationOverlay::StartObserving() { | 150 void OverscrollNavigationOverlay::StartObserving() { |
| 151 LOG(ERROR) << "Starting to observe"; |
145 loading_complete_ = false; | 152 loading_complete_ = false; |
146 received_paint_update_ = false; | 153 received_paint_update_ = false; |
147 overlay_dismiss_layer_.reset(); | 154 overlay_dismiss_layer_.reset(); |
148 Observe(web_contents_); | 155 Observe(web_contents_); |
149 | 156 |
150 // Make sure the overlay window is on top. | 157 // Make sure the overlay window is on top. |
151 if (window_.get() && window_->parent()) | 158 if (window_.get() && window_->parent()) |
152 window_->parent()->StackChildAtTop(window_.get()); | 159 window_->parent()->StackChildAtTop(window_.get()); |
153 | 160 |
154 // Assumes the navigation has been initiated. | 161 // Assumes the navigation has been initiated. |
155 NavigationEntry* pending_entry = | 162 NavigationEntry* pending_entry = |
156 web_contents_->GetController().GetPendingEntry(); | 163 web_contents_->GetController().GetPendingEntry(); |
| 164 |
157 // Save url of the pending entry to identify when it loads and paints later. | 165 // Save url of the pending entry to identify when it loads and paints later. |
158 // Under some circumstances navigation can leave a null pending entry - | 166 // Under some circumstances navigation can leave a null pending entry - |
159 // see comments in NavigationControllerImpl::NavigateToPendingEntry(). | 167 // see comments in NavigationControllerImpl::NavigateToPendingEntry(). |
160 pending_entry_url_ = pending_entry ? pending_entry->GetURL() : GURL(); | 168 pending_entry_url_ = pending_entry ? pending_entry->GetURL() : GURL(); |
| 169 LOG(ERROR) << "URL: " << pending_entry_url_.GetContent(); |
161 } | 170 } |
162 | 171 |
163 void OverscrollNavigationOverlay::SetOverlayWindow( | 172 void OverscrollNavigationOverlay::SetupOverlayWindow() { |
164 scoped_ptr<aura::Window> window, | 173 LOG(ERROR) << "ONO: Setting overlay window"; |
165 aura_extra::ImageWindowDelegate* delegate) { | 174 // TODO use OverscrollWindowDelegate instead. |
166 window_ = window.Pass(); | 175 aura_extra::ImageWindowDelegate* image_delegate = |
| 176 new aura_extra::ImageWindowDelegate(); |
| 177 image_delegate->set_background_color(SK_ColorWHITE); |
| 178 gfx::Image image = GetImageForDirection(direction_); |
| 179 if (image.IsEmpty()) |
| 180 LOG(ERROR) << "Image is empty"; |
| 181 image_delegate->SetImage(image); |
| 182 window_.reset(new aura::Window(image_delegate)); |
| 183 window_->SetType(ui::wm::WINDOW_TYPE_CONTROL); |
| 184 window_->SetTransparent(true); |
| 185 window_->Init(aura::WINDOW_LAYER_TEXTURED); |
| 186 window_->layer()->SetMasksToBounds(false); |
| 187 window_->SetName("OverscrollOverlay"); |
| 188 window_->layer()->SetLayerBrightness(-0.1f); |
| 189 web_contents_window_->AddChild(window_.get()); |
| 190 |
| 191 gfx::Rect bounds = gfx::Rect(web_contents_window_->bounds().size()); |
| 192 if (direction_ == OverscrollWindowAnimation::FORWARD) |
| 193 bounds.Offset(base::i18n::IsRTL() ? -bounds.width() : bounds.width(), 0); |
| 194 window_->SetBounds(bounds); |
| 195 window_->Show(); |
| 196 /*window_ = window.Pass(); |
167 if (window_.get() && window_->parent()) | 197 if (window_.get() && window_->parent()) |
168 window_->parent()->StackChildAtTop(window_.get()); | 198 window_->parent()->StackChildAtTop(window_.get()); |
169 image_delegate_ = delegate; | 199 image_delegate_ = delegate; |
170 | 200 |
171 if (window_.get() && delegate->has_image()) { | 201 if (window_.get() && delegate->has_image()) { |
172 window_slider_.reset(new WindowSlider(this, | 202 window_slider_.reset(new WindowSlider(this, |
173 window_->parent(), | 203 window_->parent(), |
174 window_.get())); | 204 window_.get())); |
175 slide_direction_ = SLIDE_UNKNOWN; | 205 slide_direction_ = SLIDE_UNKNOWN; |
176 } else { | 206 } else { |
177 window_slider_.reset(); | 207 window_slider_.reset(); |
| 208 }*/ |
| 209 } |
| 210 |
| 211 const gfx::Image OverscrollNavigationOverlay::GetImageForDirection( |
| 212 OverscrollWindowAnimation::Direction direction) const { |
| 213 const NavigationControllerImpl& controller = web_contents_->GetController(); |
| 214 const NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( |
| 215 controller.GetEntryAtOffset( |
| 216 direction == OverscrollWindowAnimation::FORWARD ? 1 : -1)); |
| 217 |
| 218 if (entry && entry->screenshot().get()) { |
| 219 std::vector<gfx::ImagePNGRep> image_reps; |
| 220 image_reps.push_back(gfx::ImagePNGRep(entry->screenshot(), 1.0f)); |
| 221 return gfx::Image(image_reps); |
178 } | 222 } |
| 223 return gfx::Image(); |
| 224 } |
| 225 |
| 226 scoped_ptr<OverscrollLayerWrapper> OverscrollNavigationOverlay::CreateLayer() { |
| 227 LOG(ERROR) << "ONO: CreateLayer"; |
| 228 scoped_ptr<OverscrollLayerWrapper> layer_wrapper( |
| 229 new OverscrollLayerWrapper()); |
| 230 if (!window_) { |
| 231 SetupOverlayWindow(); |
| 232 if (direction_ == OverscrollWindowAnimation::FORWARD) { |
| 233 layer_wrapper->WrapWindow(window_.get()); |
| 234 web_contents_window_->StackChildAbove( |
| 235 window_.get(), web_contents_->GetContentNativeView()); |
| 236 } else { |
| 237 layer_wrapper->WrapWindow(web_contents_->GetContentNativeView()); |
| 238 web_contents_window_->StackChildBelow( |
| 239 window_.get(), web_contents_->GetContentNativeView()); |
| 240 } |
| 241 } else { |
| 242 LOG(ERROR) << "NOT IMPLEMENTED: SET UP LAYER"; |
| 243 // TODO set up the layer. |
| 244 } |
| 245 return layer_wrapper.Pass(); |
| 246 } |
| 247 |
| 248 scoped_ptr<OverscrollLayerWrapper> |
| 249 OverscrollNavigationOverlay::CreateFrontLayer() { |
| 250 LOG(ERROR) << "ONO: Create front layer"; |
| 251 if (!web_contents_->GetController().CanGoForward()) |
| 252 return nullptr; |
| 253 direction_ = OverscrollWindowAnimation::FORWARD; |
| 254 return CreateLayer(); |
| 255 } |
| 256 |
| 257 scoped_ptr<OverscrollLayerWrapper> |
| 258 OverscrollNavigationOverlay::CreateBackLayer() { |
| 259 LOG(ERROR) << "ONO: Create back layer"; |
| 260 if (!web_contents_->GetController().CanGoBack()) |
| 261 return nullptr; |
| 262 direction_ = OverscrollWindowAnimation::BACKWARD; |
| 263 return CreateLayer(); |
| 264 } |
| 265 |
| 266 void OverscrollNavigationOverlay::OnOverscrollCompleted() { |
| 267 // TODO write actual code. |
| 268 LOG(ERROR) << "ONO: OnOverscrollCompleted"; |
| 269 window_.reset(); |
| 270 } |
| 271 |
| 272 void OverscrollNavigationOverlay::OnOverscrollCompleting() { |
| 273 |
| 274 } |
| 275 |
| 276 void OverscrollNavigationOverlay::FadeOutOverscrollWindow() { |
| 277 LOG(ERROR) << "FadeOutOverscrollWindow"; |
| 278 // TODO maybe we do not need this check. |
| 279 if (!window_) |
| 280 return; |
| 281 aura::Window* contents = web_contents_->GetContentNativeView(); |
| 282 contents->layer()->SetLayerBrightness(1.f); |
| 283 { |
| 284 ui::ScopedLayerAnimationSettings settings(contents->layer()->GetAnimator()); |
| 285 settings.SetPreemptionStrategy( |
| 286 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 287 settings.SetTweenType(gfx::Tween::EASE_OUT); |
| 288 contents->layer()->SetLayerBrightness(0.f); |
| 289 } |
| 290 scoped_ptr<ui::Layer> dismiss_layer = window_->AcquireLayer(); |
| 291 window_.reset(); |
| 292 (new OverlayDismissAnimator(dismiss_layer.Pass()))->Animate(); |
179 } | 293 } |
180 | 294 |
181 void OverscrollNavigationOverlay::StopObservingIfDone() { | 295 void OverscrollNavigationOverlay::StopObservingIfDone() { |
| 296 LOG(ERROR) << "Stop observing if done"; |
182 // Normally we dismiss the overlay once we receive a paint update, however | 297 // Normally we dismiss the overlay once we receive a paint update, however |
183 // for in-page navigations DidFirstVisuallyNonEmptyPaint() does not get | 298 // for in-page navigations DidFirstVisuallyNonEmptyPaint() does not get |
184 // called, and we rely on loading_complete_ for those cases. | 299 // called, and we rely on loading_complete_ for those cases. |
185 if (!received_paint_update_ && !loading_complete_) | 300 if (!received_paint_update_ && !loading_complete_) |
186 return; | 301 return; |
187 | 302 |
188 // If a slide is in progress, then do not destroy the window or the slide. | 303 if (owa_->is_animation_in_progress()) |
189 if (window_slider_.get() && window_slider_->IsSlideInProgress()) | |
190 return; | 304 return; |
191 | 305 |
192 // The layer to be animated by OverlayDismissAnimator | 306 // The layer to be animated by OverlayDismissAnimator |
193 scoped_ptr<ui::Layer> overlay_dismiss_layer; | 307 scoped_ptr<ui::Layer> overlay_dismiss_layer; |
194 if (overlay_dismiss_layer_) | 308 if (overlay_dismiss_layer_) |
195 overlay_dismiss_layer = overlay_dismiss_layer_.Pass(); | 309 overlay_dismiss_layer = overlay_dismiss_layer_.Pass(); |
196 else if (window_.get()) | 310 else if (window_.get()) |
197 overlay_dismiss_layer = window_->AcquireLayer(); | 311 overlay_dismiss_layer = window_->AcquireLayer(); |
| 312 LOG(ERROR) << "Resetting window slider"; |
198 Observe(NULL); | 313 Observe(NULL); |
199 window_slider_.reset(); | |
200 window_.reset(); | |
201 image_delegate_ = NULL; | |
202 if (overlay_dismiss_layer.get()) { | |
203 // OverlayDismissAnimator deletes overlay_dismiss_layer and itself when the | |
204 // animation completes. | |
205 (new OverlayDismissAnimator(overlay_dismiss_layer.Pass()))->Animate(); | |
206 } | |
207 } | 314 } |
208 | 315 |
| 316 // TODO delete these *Layer functions. |
209 ui::Layer* OverscrollNavigationOverlay::CreateSlideLayer(int offset) { | 317 ui::Layer* OverscrollNavigationOverlay::CreateSlideLayer(int offset) { |
210 const NavigationControllerImpl& controller = web_contents_->GetController(); | |
211 const NavigationEntryImpl* entry = controller.GetEntryAtOffset(offset); | |
212 | |
213 gfx::Image image; | |
214 if (entry && entry->screenshot().get()) { | |
215 std::vector<gfx::ImagePNGRep> image_reps; | |
216 image_reps.push_back(gfx::ImagePNGRep(entry->screenshot(), 1.0f)); | |
217 image = gfx::Image(image_reps); | |
218 } | |
219 if (!layer_delegate_) | 318 if (!layer_delegate_) |
220 layer_delegate_.reset(new ImageLayerDelegate()); | 319 layer_delegate_.reset(new ImageLayerDelegate()); |
221 layer_delegate_->SetImage(image); | 320 // TODO fixme. |
| 321 layer_delegate_->SetImage( |
| 322 GetImageForDirection(offset == -1 ? OverscrollWindowAnimation::BACKWARD |
| 323 : OverscrollWindowAnimation::FORWARD)); |
222 | 324 |
223 ui::Layer* layer = new ui::Layer(ui::LAYER_TEXTURED); | 325 ui::Layer* layer = new ui::Layer(ui::LAYER_TEXTURED); |
224 layer->set_delegate(layer_delegate_.get()); | 326 layer->set_delegate(layer_delegate_.get()); |
225 return layer; | 327 return layer; |
226 } | 328 } |
227 | 329 |
228 ui::Layer* OverscrollNavigationOverlay::CreateBackLayer() { | 330 /*ui::Layer* OverscrollNavigationOverlay::CreateBackLayer() { |
229 if (!web_contents_->GetController().CanGoBack()) | 331 if (!web_contents_->GetController().CanGoBack()) |
230 return NULL; | 332 return NULL; |
231 slide_direction_ = SLIDE_BACK; | 333 slide_direction_ = SLIDE_BACK; |
232 return CreateSlideLayer(-1); | 334 return CreateSlideLayer(-1); |
233 } | 335 } |
234 | 336 |
235 ui::Layer* OverscrollNavigationOverlay::CreateFrontLayer() { | 337 ui::Layer* OverscrollNavigationOverlay::CreateFrontLayer() { |
236 if (!web_contents_->GetController().CanGoForward()) | 338 if (!web_contents_->GetController().CanGoForward()) |
237 return NULL; | 339 return NULL; |
238 slide_direction_ = SLIDE_FRONT; | 340 slide_direction_ = SLIDE_FRONT; |
239 return CreateSlideLayer(1); | 341 return CreateSlideLayer(1); |
240 } | 342 } |
241 | 343 |
242 void OverscrollNavigationOverlay::OnWindowSlideCompleting() { | 344 void OverscrollNavigationOverlay::OnWindowSlideCompleting() { |
243 if (slide_direction_ == SLIDE_UNKNOWN) | 345 if (slide_direction_ == SLIDE_UNKNOWN) |
244 return; | 346 return; |
245 | 347 |
246 // Perform the navigation. | 348 // Perform the navigation. |
247 if (slide_direction_ == SLIDE_BACK) | 349 if (slide_direction_ == SLIDE_BACK) |
248 web_contents_->GetController().GoBack(); | 350 web_contents_->GetController().GoBack(); |
249 else if (slide_direction_ == SLIDE_FRONT) | 351 else if (slide_direction_ == SLIDE_FRONT) |
250 web_contents_->GetController().GoForward(); | 352 web_contents_->GetController().GoForward(); |
251 else | 353 else |
252 NOTREACHED(); | 354 NOTREACHED(); |
253 | 355 |
254 // Reset state and wait for the new navigation page to complete | 356 // Reset state and wait for the new navigation page to complete |
255 // loading/painting. | 357 // loading/painting. |
256 StartObserving(); | 358 StartObserving(); |
257 } | 359 }*/ |
258 | 360 |
259 void OverscrollNavigationOverlay::OnWindowSlideCompleted( | 361 /*void OverscrollNavigationOverlay::OnWindowSlideAborted() { |
260 scoped_ptr<ui::Layer> layer) { | |
261 if (slide_direction_ == SLIDE_UNKNOWN) { | |
262 window_slider_.reset(); | |
263 StopObservingIfDone(); | |
264 return; | |
265 } | |
266 | |
267 // Change the image used for the overlay window. | |
268 image_delegate_->SetImage(layer_delegate_->image()); | |
269 window_->layer()->SetTransform(gfx::Transform()); | |
270 window_->SchedulePaintInRect(gfx::Rect(window_->bounds().size())); | |
271 slide_direction_ = SLIDE_UNKNOWN; | |
272 // We may end up dismissing the overlay before it has a chance to repaint, so | |
273 // set the slider layer to be the one animated by OverlayDismissAnimator. | |
274 if (layer.get()) | |
275 overlay_dismiss_layer_ = layer.Pass(); | |
276 StopObservingIfDone(); | 362 StopObservingIfDone(); |
277 } | 363 } |
278 | 364 |
279 void OverscrollNavigationOverlay::OnWindowSlideAborted() { | |
280 StopObservingIfDone(); | |
281 } | |
282 | |
283 void OverscrollNavigationOverlay::OnWindowSliderDestroyed() { | 365 void OverscrollNavigationOverlay::OnWindowSliderDestroyed() { |
284 // We only want to take an action here if WindowSlider is being destroyed | 366 // We only want to take an action here if WindowSlider is being destroyed |
285 // outside of OverscrollNavigationOverlay. If window_slider_.get() is NULL, | 367 // outside of OverscrollNavigationOverlay. If window_slider_.get() is NULL, |
286 // then OverscrollNavigationOverlay is the one destroying WindowSlider, and | 368 // then OverscrollNavigationOverlay is the one destroying WindowSlider, and |
287 // we don't need to do anything. | 369 // we don't need to do anything. |
288 // This check prevents StopObservingIfDone() being called multiple times | 370 // This check prevents StopObservingIfDone() being called multiple times |
289 // (including recursively) for a single event. | 371 // (including recursively) for a single event. |
290 if (window_slider_.get()) { | 372 if (window_slider_.get()) { |
291 // The slider has just been destroyed. Release the ownership. | 373 // The slider has just been destroyed. Release the ownership. |
292 ignore_result(window_slider_.release()); | 374 ignore_result(window_slider_.release()); |
293 StopObservingIfDone(); | 375 StopObservingIfDone(); |
294 } | 376 } |
295 } | 377 }*/ |
296 | 378 |
297 void OverscrollNavigationOverlay::DidFirstVisuallyNonEmptyPaint() { | 379 void OverscrollNavigationOverlay::DidFirstVisuallyNonEmptyPaint() { |
| 380 LOG(ERROR) << "Did first visually non empty paint"; |
298 NavigationEntry* visible_entry = | 381 NavigationEntry* visible_entry = |
299 web_contents_->GetController().GetVisibleEntry(); | 382 web_contents_->GetController().GetVisibleEntry(); |
300 if (pending_entry_url_.is_empty() || | 383 if (pending_entry_url_.is_empty() || |
301 DoesEntryMatchURL(visible_entry, pending_entry_url_)) { | 384 DoesEntryMatchURL(visible_entry, pending_entry_url_)) { |
302 received_paint_update_ = true; | 385 received_paint_update_ = true; |
303 StopObservingIfDone(); | 386 StopObservingIfDone(); |
304 } | 387 } |
305 } | 388 } |
306 | 389 |
307 void OverscrollNavigationOverlay::DidStopLoading(RenderViewHost* host) { | 390 void OverscrollNavigationOverlay::DidStopLoading(RenderViewHost* host) { |
| 391 LOG(ERROR) << "Did stop loading"; |
308 // Don't compare URLs in this case - it's possible they won't match if | 392 // Don't compare URLs in this case - it's possible they won't match if |
309 // a gesture-nav initiated navigation was interrupted by some other in-site | 393 // a gesture-nav initiated navigation was interrupted by some other in-site |
310 // navigation ((e.g., from a script, or from a bookmark). | 394 // navigation ((e.g., from a script, or from a bookmark). |
311 loading_complete_ = true; | 395 loading_complete_ = true; |
312 StopObservingIfDone(); | 396 StopObservingIfDone(); |
313 } | 397 } |
314 | 398 |
| 399 /*aura::Window* OverscrollNavigationOverlay::GetWindowToAnimateForOverscroll() |
| 400 const { |
| 401 return direction_ == OverscrollNavigationOverlay::FORWARD |
| 402 ? window_.get() |
| 403 : web_contents_->GetContentNativeView(); |
| 404 } |
| 405 |
| 406 gfx::Rect OverscrollNavigationOverlay::GetStarterBounds() const { |
| 407 gfx::Rect bounds = gfx::Rect(web_contents_window_->bounds().size()); |
| 408 if (direction_ == OverscrollNavigationOverlay::FORWARD) { |
| 409 // The overlay will be sliding in from the right edge towards the left in |
| 410 // non-RTL, or sliding in from the left edge towards the right in RTL. |
| 411 // So position the overlay window accordingly. |
| 412 bounds.Offset(base::i18n::IsRTL() ? -bounds.width() : bounds.width(), 0); |
| 413 } |
| 414 return bounds; |
| 415 }*/ |
| 416 |
315 } // namespace content | 417 } // namespace content |
OLD | NEW |