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/image_window_delegate.h" | 9 #include "content/browser/web_contents/aura/image_window_delegate.h" |
10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 virtual ~ImageLayerDelegate() {} | 48 virtual ~ImageLayerDelegate() {} |
49 | 49 |
50 void SetImage(const gfx::Image& image) { | 50 void SetImage(const gfx::Image& image) { |
51 image_ = image; | 51 image_ = image; |
52 image_size_ = image.AsImageSkia().size(); | 52 image_size_ = image.AsImageSkia().size(); |
53 } | 53 } |
54 const gfx::Image& image() const { return image_; } | 54 const gfx::Image& image() const { return image_; } |
55 | 55 |
56 private: | 56 private: |
57 // Overridden from ui::LayerDelegate: | 57 // Overridden from ui::LayerDelegate: |
58 virtual void OnPaintLayer(gfx::Canvas* canvas) OVERRIDE { | 58 virtual void OnPaintLayer(gfx::Canvas* canvas) override { |
59 if (image_.IsEmpty()) { | 59 if (image_.IsEmpty()) { |
60 canvas->DrawColor(SK_ColorWHITE); | 60 canvas->DrawColor(SK_ColorWHITE); |
61 } else { | 61 } else { |
62 SkISize size = canvas->sk_canvas()->getDeviceSize(); | 62 SkISize size = canvas->sk_canvas()->getDeviceSize(); |
63 if (size.width() != image_size_.width() || | 63 if (size.width() != image_size_.width() || |
64 size.height() != image_size_.height()) { | 64 size.height() != image_size_.height()) { |
65 canvas->DrawColor(SK_ColorWHITE); | 65 canvas->DrawColor(SK_ColorWHITE); |
66 } | 66 } |
67 canvas->DrawImageInt(image_.AsImageSkia(), 0, 0); | 67 canvas->DrawImageInt(image_.AsImageSkia(), 0, 0); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 virtual void OnDelegatedFrameDamage( | 71 virtual void OnDelegatedFrameDamage( |
72 const gfx::Rect& damage_rect_in_dip) OVERRIDE {} | 72 const gfx::Rect& damage_rect_in_dip) override {} |
73 | 73 |
74 // Called when the layer's device scale factor has changed. | 74 // Called when the layer's device scale factor has changed. |
75 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE { | 75 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override { |
76 } | 76 } |
77 | 77 |
78 // Invoked prior to the bounds changing. The returned closured is run after | 78 // Invoked prior to the bounds changing. The returned closured is run after |
79 // the bounds change. | 79 // the bounds change. |
80 virtual base::Closure PrepareForLayerBoundsChange() OVERRIDE { | 80 virtual base::Closure PrepareForLayerBoundsChange() override { |
81 return base::Closure(); | 81 return base::Closure(); |
82 } | 82 } |
83 | 83 |
84 gfx::Image image_; | 84 gfx::Image image_; |
85 gfx::Size image_size_; | 85 gfx::Size image_size_; |
86 | 86 |
87 DISALLOW_COPY_AND_ASSIGN(ImageLayerDelegate); | 87 DISALLOW_COPY_AND_ASSIGN(ImageLayerDelegate); |
88 }; | 88 }; |
89 | 89 |
90 // Responsible for fading out and deleting the layer of the overlay window. | 90 // Responsible for fading out and deleting the layer of the overlay window. |
(...skipping 13 matching lines...) Expand all Loading... |
104 ui::LayerAnimator* animator = layer_->GetAnimator(); | 104 ui::LayerAnimator* animator = layer_->GetAnimator(); |
105 // This makes SetOpacity() animate with default duration (which could be | 105 // This makes SetOpacity() animate with default duration (which could be |
106 // zero, e.g. when running tests). | 106 // zero, e.g. when running tests). |
107 ui::ScopedLayerAnimationSettings settings(animator); | 107 ui::ScopedLayerAnimationSettings settings(animator); |
108 animator->AddObserver(this); | 108 animator->AddObserver(this); |
109 layer_->SetOpacity(0); | 109 layer_->SetOpacity(0); |
110 } | 110 } |
111 | 111 |
112 // Overridden from ui::LayerAnimationObserver | 112 // Overridden from ui::LayerAnimationObserver |
113 virtual void OnLayerAnimationEnded( | 113 virtual void OnLayerAnimationEnded( |
114 ui::LayerAnimationSequence* sequence) OVERRIDE { | 114 ui::LayerAnimationSequence* sequence) override { |
115 delete this; | 115 delete this; |
116 } | 116 } |
117 | 117 |
118 virtual void OnLayerAnimationAborted( | 118 virtual void OnLayerAnimationAborted( |
119 ui::LayerAnimationSequence* sequence) OVERRIDE { | 119 ui::LayerAnimationSequence* sequence) override { |
120 delete this; | 120 delete this; |
121 } | 121 } |
122 | 122 |
123 virtual void OnLayerAnimationScheduled( | 123 virtual void OnLayerAnimationScheduled( |
124 ui::LayerAnimationSequence* sequence) OVERRIDE {} | 124 ui::LayerAnimationSequence* sequence) override {} |
125 | 125 |
126 private: | 126 private: |
127 virtual ~OverlayDismissAnimator() {} | 127 virtual ~OverlayDismissAnimator() {} |
128 | 128 |
129 scoped_ptr<ui::Layer> layer_; | 129 scoped_ptr<ui::Layer> layer_; |
130 | 130 |
131 DISALLOW_COPY_AND_ASSIGN(OverlayDismissAnimator); | 131 DISALLOW_COPY_AND_ASSIGN(OverlayDismissAnimator); |
132 }; | 132 }; |
133 | 133 |
134 OverscrollNavigationOverlay::OverscrollNavigationOverlay( | 134 OverscrollNavigationOverlay::OverscrollNavigationOverlay( |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 309 |
310 void OverscrollNavigationOverlay::DidStopLoading(RenderViewHost* host) { | 310 void OverscrollNavigationOverlay::DidStopLoading(RenderViewHost* host) { |
311 // Don't compare URLs in this case - it's possible they won't match if | 311 // Don't compare URLs in this case - it's possible they won't match if |
312 // a gesture-nav initiated navigation was interrupted by some other in-site | 312 // a gesture-nav initiated navigation was interrupted by some other in-site |
313 // navigation ((e.g., from a script, or from a bookmark). | 313 // navigation ((e.g., from a script, or from a bookmark). |
314 loading_complete_ = true; | 314 loading_complete_ = true; |
315 StopObservingIfDone(); | 315 StopObservingIfDone(); |
316 } | 316 } |
317 | 317 |
318 } // namespace content | 318 } // namespace content |
OLD | NEW |