| 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/gesture_nav_simple.h" | 5 #include "content/browser/web_contents/aura/gesture_nav_simple.h" |
| 6 | 6 |
| 7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
| 8 #include "content/browser/frame_host/navigation_controller_impl.h" | 8 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 9 #include "content/browser/renderer_host/overscroll_controller.h" | 9 #include "content/browser/renderer_host/overscroll_controller.h" |
| 10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
| 11 #include "content/browser/web_contents/web_contents_view.h" | 11 #include "content/browser/web_contents/web_contents_view.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/overscroll_configuration.h" | 13 #include "content/public/browser/overscroll_configuration.h" |
| 14 #include "content/public/common/content_client.h" | 14 #include "content/public/common/content_client.h" |
| 15 #include "ui/aura/window.h" | 15 #include "ui/aura/window.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/layer_delegate.h" | 18 #include "ui/compositor/layer_delegate.h" |
| 19 #include "ui/compositor/paint_context.h" | 19 #include "ui/compositor/paint_recorder.h" |
| 20 #include "ui/compositor/scoped_layer_animation_settings.h" | 20 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 21 #include "ui/gfx/animation/tween.h" | 21 #include "ui/gfx/animation/tween.h" |
| 22 #include "ui/gfx/canvas.h" | 22 #include "ui/gfx/canvas.h" |
| 23 #include "ui/gfx/image/image.h" | 23 #include "ui/gfx/image/image.h" |
| 24 #include "ui/resources/grit/ui_resources.h" | 24 #include "ui/resources/grit/ui_resources.h" |
| 25 | 25 |
| 26 namespace content { | 26 namespace content { |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 bool left() const { return left_arrow_; } | 84 bool left() const { return left_arrow_; } |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 // ui::LayerDelegate: | 87 // ui::LayerDelegate: |
| 88 void OnPaintLayer(const ui::PaintContext& context) override { | 88 void OnPaintLayer(const ui::PaintContext& context) override { |
| 89 SkPaint paint; | 89 SkPaint paint; |
| 90 paint.setColor(SkColorSetARGB(0xa0, 0, 0, 0)); | 90 paint.setColor(SkColorSetARGB(0xa0, 0, 0, 0)); |
| 91 paint.setStyle(SkPaint::kFill_Style); | 91 paint.setStyle(SkPaint::kFill_Style); |
| 92 paint.setAntiAlias(true); | 92 paint.setAntiAlias(true); |
| 93 | 93 |
| 94 gfx::Canvas* canvas = context.canvas(); | 94 ui::PaintRecorder recorder(context); |
| 95 canvas->DrawCircle( | 95 recorder.canvas()->DrawCircle( |
| 96 gfx::Point(left_arrow_ ? 0 : kArrowWidth, kArrowHeight / 2), | 96 gfx::Point(left_arrow_ ? 0 : kArrowWidth, kArrowHeight / 2), |
| 97 kArrowWidth, | 97 kArrowWidth, paint); |
| 98 paint); | 98 recorder.canvas()->DrawImageInt( |
| 99 canvas->DrawImageInt(*image_.ToImageSkia(), | 99 *image_.ToImageSkia(), left_arrow_ ? 0 : kArrowWidth - image_.Width(), |
| 100 left_arrow_ ? 0 : kArrowWidth - image_.Width(), | 100 (kArrowHeight - image_.Height()) / 2); |
| 101 (kArrowHeight - image_.Height()) / 2); | |
| 102 } | 101 } |
| 103 | 102 |
| 104 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override {} | 103 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override {} |
| 105 | 104 |
| 106 void OnDeviceScaleFactorChanged(float device_scale_factor) override {} | 105 void OnDeviceScaleFactorChanged(float device_scale_factor) override {} |
| 107 | 106 |
| 108 base::Closure PrepareForLayerBoundsChange() override { | 107 base::Closure PrepareForLayerBoundsChange() override { |
| 109 return base::Closure(); | 108 return base::Closure(); |
| 110 } | 109 } |
| 111 | 110 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 clip_layer_->SetBounds(window->layer()->bounds()); | 227 clip_layer_->SetBounds(window->layer()->bounds()); |
| 229 clip_layer_->SetMasksToBounds(true); | 228 clip_layer_->SetMasksToBounds(true); |
| 230 clip_layer_->Add(arrow_.get()); | 229 clip_layer_->Add(arrow_.get()); |
| 231 | 230 |
| 232 ui::Layer* parent = window->layer()->parent(); | 231 ui::Layer* parent = window->layer()->parent(); |
| 233 parent->Add(clip_layer_.get()); | 232 parent->Add(clip_layer_.get()); |
| 234 parent->StackAtTop(clip_layer_.get()); | 233 parent->StackAtTop(clip_layer_.get()); |
| 235 } | 234 } |
| 236 | 235 |
| 237 } // namespace content | 236 } // namespace content |
| OLD | NEW |