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/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/browser/render_widget_host_view.h" | 12 #include "content/public/browser/render_widget_host_view.h" |
13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
14 #include "ui/aura_extra/image_window_delegate.h" | 14 #include "ui/aura_extra/image_window_delegate.h" |
15 #include "ui/base/layout.h" | 15 #include "ui/base/layout.h" |
16 #include "ui/compositor/layer.h" | 16 #include "ui/compositor/layer.h" |
17 #include "ui/compositor/layer_animation_observer.h" | 17 #include "ui/compositor/layer_animation_observer.h" |
| 18 #include "ui/compositor/paint_context.h" |
18 #include "ui/compositor/scoped_layer_animation_settings.h" | 19 #include "ui/compositor/scoped_layer_animation_settings.h" |
19 #include "ui/gfx/canvas.h" | 20 #include "ui/gfx/canvas.h" |
20 #include "ui/gfx/image/image_png_rep.h" | 21 #include "ui/gfx/image/image_png_rep.h" |
21 #include "ui/gfx/image/image_skia.h" | 22 #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|. |
(...skipping 22 matching lines...) Expand all Loading... |
50 ~ImageLayerDelegate() override {} | 51 ~ImageLayerDelegate() override {} |
51 | 52 |
52 void SetImage(const gfx::Image& image) { | 53 void SetImage(const gfx::Image& image) { |
53 image_ = image; | 54 image_ = image; |
54 image_size_ = image.AsImageSkia().size(); | 55 image_size_ = image.AsImageSkia().size(); |
55 } | 56 } |
56 const gfx::Image& image() const { return image_; } | 57 const gfx::Image& image() const { return image_; } |
57 | 58 |
58 private: | 59 private: |
59 // Overridden from ui::LayerDelegate: | 60 // Overridden from ui::LayerDelegate: |
60 void OnPaintLayer(gfx::Canvas* canvas) override { | 61 void OnPaintLayer(const ui::PaintContext& context) override { |
| 62 gfx::Canvas* canvas = context.canvas(); |
61 if (image_.IsEmpty()) { | 63 if (image_.IsEmpty()) { |
62 canvas->DrawColor(SK_ColorWHITE); | 64 canvas->DrawColor(SK_ColorWHITE); |
63 } else { | 65 } else { |
64 SkISize size = canvas->sk_canvas()->getDeviceSize(); | 66 SkISize size = canvas->sk_canvas()->getDeviceSize(); |
65 if (size.width() != image_size_.width() || | 67 if (size.width() != image_size_.width() || |
66 size.height() != image_size_.height()) { | 68 size.height() != image_size_.height()) { |
67 canvas->DrawColor(SK_ColorWHITE); | 69 canvas->DrawColor(SK_ColorWHITE); |
68 } | 70 } |
69 canvas->DrawImageInt(image_.AsImageSkia(), 0, 0); | 71 canvas->DrawImageInt(image_.AsImageSkia(), 0, 0); |
70 } | 72 } |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 308 |
307 void OverscrollNavigationOverlay::DidStopLoading() { | 309 void OverscrollNavigationOverlay::DidStopLoading() { |
308 // Don't compare URLs in this case - it's possible they won't match if | 310 // 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 | 311 // a gesture-nav initiated navigation was interrupted by some other in-site |
310 // navigation ((e.g., from a script, or from a bookmark). | 312 // navigation ((e.g., from a script, or from a bookmark). |
311 loading_complete_ = true; | 313 loading_complete_ = true; |
312 StopObservingIfDone(); | 314 StopObservingIfDone(); |
313 } | 315 } |
314 | 316 |
315 } // namespace content | 317 } // namespace content |
OLD | NEW |